home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / alt / sb / programm / 292 < prev    next >
Encoding:
Text File  |  1992-07-28  |  3.9 KB  |  165 lines

  1. Newsgroups: alt.sb.programmer
  2. Path: sparky!uunet!mcsun!fuug!funic!nntp.hut.fi!nntp!then
  3. From: then@vipunen.hut.fi (Tomi  H Engdahl)
  4. Subject: Re: Decoding DTMF tones with sb ? Is it possible ?
  5. In-Reply-To: venaas@siri.unit.no's message of Tue, 28 Jul 92 10:26:14 GMT
  6. Message-ID: <THEN.92Jul29200744@vipunen.hut.fi>
  7. Sender: usenet@nntp.hut.fi (Usenet pseudouser id)
  8. Nntp-Posting-Host: vipunen.hut.fi
  9. Organization: Helsinki University of Technology, Finland
  10. References: <LAHIKAIN.92Jul27154518@mamba.lut.fi> <98=k02aT1b8R01@JUTS.ccc.amdahl.com>
  11.     <1992Jul28.102614.21751@ugle.unit.no>
  12. Distribution: alt
  13. Date: 29 Jul 92 20:07:44
  14. Lines: 149
  15.  
  16. In article <1992Jul28.102614.21751@ugle.unit.no> venaas@siri.unit.no (Stig Venaas) writes:
  17.  
  18. >1. What are the other 4 DTFMs? I know the freqs for them, but I don't
  19. >   know what they are called. Each consists of two sine waves. There
  20. >   are four choises for each of them. I know all the freqs and I know
  21. >   which pairs 0-9 uses, and I can find out which * and # uses. But
  22. >   not the other 4.
  23.  
  24. I have seen them called A, B, C and D.
  25.  
  26. >2. I need some info on how to program the SB in order to sample. I
  27. >   could look into the code for vrec, but it's not an easy way of
  28. >   getting the info.
  29.  
  30. Here is an example code which samples data using soundblaster, 
  31. then modifies the sample data and play it back through JDAC type
  32. D/A converter connected to LPT2.
  33.  
  34. Program Change_Speech_pitch;
  35.  
  36.  
  37. { (C) Tomi Engdahl 26.4.1992 }
  38.  
  39. Uses Crt;
  40.  
  41. Const
  42.    BufferLength=400;
  43.    sb_base=$220;
  44.    gameport=$201;
  45.    fm_stat=sb_base;
  46.    fm_addr=sb_base;
  47.    fm_data=sb_base+1;
  48.    afm_stat=sb_base+2;
  49.    afm_addr=sb_base+2;
  50.    afm_data=sb_base+3;
  51.    mixer_addr=sb_base+4;
  52.    mixer_data=sb_base+5;
  53.    DSP_reset=sb_base+6;
  54.  
  55.    DSP_read=sb_base+$A;
  56.    DSP_write=sb_base+$C;
  57.    DSP_wstat=sb_base+$C;
  58.    DSP_rstat=sb_base+$E;
  59.  
  60.    LPT_base=$278;
  61.  
  62.  
  63. Var
  64.    tmp:byte;
  65.    temp:integer;
  66.    buffer:array[0..1,0..BufferLength] of byte;
  67.  
  68. Function Read_SBADC:byte;
  69. Begin
  70.       Inline(
  71.       $BA/$2C/$02/      {MOV     DX,022C    }
  72.       $EC/              {IN      AL,DX      }
  73.       $A8/$80/          {TEST    AL,80      }
  74.       $75/$FB/          {JNZ     0107       }
  75.       $B0/$20/          {MOV     AL,20      }
  76.       $EE/              {OUT     DX,AL      }
  77.       $BA/$2E/$02/      {MOV     DX,022E    }
  78.       $EC/              {IN      AL,DX      }
  79.       $A8/$80/          {TEST    AL,80      }
  80.       $74/$FB/          {JZ      0112       }
  81.       $BA/$2A/$02/      {MOV     DX,022A    }
  82.       $EC/              {IN      AL,DX      }
  83.       $A2/tmp);         {MOV     a,AL       }
  84.       Read_SBADC:=tmp;
  85. End;
  86.  
  87. Procedure reset_DSP;
  88. Begin
  89.    Port[DSP_reset]:=1;
  90.    Delay(1);
  91.    Port[DSP_reset]:=0;
  92. End;
  93.  
  94. Procedure write_DSP(data:byte);
  95. Begin
  96.    Repeat Until (Port[DSP_wstat] and 128)=0;
  97.    Port[DSP_write]:=data;
  98. End;
  99.  
  100. Procedure output_sample(data:byte);
  101. Begin
  102.    {write_DSP($10);
  103.    write_DSP(data);}
  104.    Port[LPT_base]:=data;
  105. End;
  106.  
  107. Procedure set_speaker_on;
  108. Begin
  109.    write_DSP($D1);
  110. End;
  111.  
  112. Procedure set_speaker_off;
  113. Begin
  114.    write_DSP($D0);
  115. End;
  116.  
  117.  
  118. Procedure pitch_up(wbuf,rbuf:integer);
  119. Var
  120.    writep,readp:word;
  121. Begin
  122.    writep:=0;
  123.    readp:=0;
  124.    Repeat
  125.       buffer[wbuf,writep]:=read_SBADC;
  126.       {   Write(buffer[wbuf,writep],'  ');  }
  127.       Inc(writep);
  128.       output_sample(buffer[rbuf,readp]);
  129.       Inc(readp);
  130.       Inc(readp);
  131.    Until readp>=BufferLength;
  132.    readp:=0;
  133.    Repeat
  134.       buffer[wbuf,writep]:=read_SBADC;
  135.    {      Write(buffer[wbuf,writep],'  ');  }
  136.       Inc(writep);
  137.       output_sample(buffer[rbuf,readp]);
  138.       Inc(readp);
  139.       Inc(readp);
  140.    Until readp>=BufferLength;
  141. End;
  142.  
  143.  
  144. Procedure test_ADC;
  145. Begin
  146.    Repeat
  147.       Write(read_SBADC,' ');
  148.    Until KeyPressed;
  149. End;
  150.  
  151. Begin
  152.    reset_DSP;
  153. {   set_speaker_on;
  154.    test_ADC;        }
  155.    For temp:=0 to BufferLengthAT S0=0 S10=20 Q0 E1 X4
  156. AT&C1
  157.  
  158.  
  159.  
  160.  
  161. --
  162.  
  163. Tomi.Engdahl@hut.fi            "Don't force it; get a larger hammer"
  164. then@vipunen.hut.fi                        
  165.