Thread View: comp.os.msdos.programmer
3 messages
3 total messages
Started by Sonny Ovens
Sun, 17 Mar 1996 06:02
using C to access the Soundblaster
Author: Sonny Ovens
Date: Sun, 17 Mar 1996 06:02
Date: Sun, 17 Mar 1996 06:02
13 lines
1282 bytes
1282 bytes
Does anybody out there have a sample of some code that woud record voice through the soundblaster, to a file? I am using C/C++. I am having problems doing it myself, since I really dont know where to start. I am using the BLAST13 library, Although I would like to see something using any library available. All I need is the simplest program possible. Also, does anybody have any Ideas on how to have the soundblaster tell me the frequency of a tone that is at the input of the sound card? I want my program to run diferent functions when certian tones are present at the input. Not DTMF tones, just a regular sine wave type tone. I will have it activate if the tone remains the same for .75 seconds, to avoid the SB interpreting voice tones as tones I want to decode. thanks sonny@lancelot.chs.lane.edu
Re: using C to access the Soundblaster
Author: Tero Tervala
Date: Mon, 25 Mar 1996 14:53
Date: Mon, 25 Mar 1996 14:53
15 lines
1020 bytes
1020 bytes
sovens@efn.org (Sonny Ovens) writes: : Also, does anybody have any Ideas on how to have the soundblaster tell me : the frequency of a tone that is at the input of the sound card? I want my You'll have to do a program for that tone identifying, I don't know exactly how that could be done, but I think you'll have to do a spectrum analysis to the digital audio read from SB, and check which frequency has most intensity. -- --------------------------------------------------------------------- Tero "Miracle" Tervala eaytttet@sjoki.uta.fi miracle@kauhajoki.fi
Re: using C to access the Soundblaster
Author: Kazimir Kylheku
Date: Mon, 25 Mar 1996 19:10
Date: Mon, 25 Mar 1996 19:10
59 lines
3794 bytes
3794 bytes
In article <4ig9su$jn9@garcia.efn.org>, Sonny Ovens <sovens@efn.org> wrote: >Does anybody out there have a sample of some code that woud record voice >through the soundblaster, to a file? I am using C/C++. I am having >problems doing it myself, since I really dont know where to start. I am You don't start in comp.lang.c. This newsgroup is for the discussion of the C language, not sound blaster cards. >using the BLAST13 library, Although I would like to see something using >any library available. All I need is the simplest program possible. >Also, does anybody have any Ideas on how to have the soundblaster tell me >the frequency of a tone that is at the input of the sound card? I want my >program to run diferent functions when certian tones are present at the >input. Not DTMF tones, just a regular sine wave type tone. I will have it >activate if the tone remains the same for .75 seconds, to avoid the SB >interpreting voice tones as tones I want to decode. A newsgroup about signal processing would be appropriate for this topic. It's not particular to the C language, or MSDOS. I see that you did crosspost to comp.dsp already. If you have one or a small number of definite frequencies that you wish to check for you can simply see how the signal correlates with an artificial reference waveform of the given frequency. Basically, you project the input signal onto a basis consisting of a sine and a cosine function of the frequency you are trying to detect. Pretend that the signals and reference waveforms are giant vectors and you are taking a long running dot product---you multiply the signal with the sine, and with the cosine and accumulate the results into two separate running sums. Essentially, you are projecting the signal vector into the vector space spanned by the sine and cosine vector: you measure to what extent the signal has a component in the sine and in the cosine. These two are an orthogonal vector basis, because they are at 90 degrees to each other. If the input signal frequency is close to the frequency of your sine and cosine function, it will ``harmonize'' with the two and you will get some numbers which roughly tells you the coefficients of the sine and cosine component present in your signal. You can take these two numbers as a 2D vector whose direction gives you the phase angle, and length gives you the amplitude. If you sample sections that are too short, the presence of noise may mask the signal too much. If you sample for too long, you will reject more and more frequencies that are close to what you are looking for, increasingly selecting for the precise frequency. Frequencies that are not quite equal to the one you are filtering for will cause a rotation of the phase vector (related to the beats you hear when you play two notes on a guitar that are close in frequency), which will cause cancellation over the long run. You have to experiment a little bit. You also have to normalize the results by dividing by the length of the sine and cosine vector. You can do this by dividing by the sum of the squares of the cosine and sine samples alone. Checking thus for the presence of some frequency or group of frequencies is easy, but determining an arbitrary pitch is not trivial. --
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads