Building a Frequency/Sound Generator

Thread Starter

tdizzle

Joined Jan 5, 2014
1
Hi

I'm trying to build a system that can generate and record sounds within the range of about 0 - 50 or 55kHz.

The aim is to be able to produce sounds that e.g. rats can hear.. and possibly even mimic or play back recordings of rat sounds using the system. Would be interesting to record a rats response too .etc. Hence why we need both a way to generate sounds and record sounds. Also apart from this it would be interesting to build a frequency generator from an electronics/hobbyist perspective! :)

With regard to producing the sound is it as simple as hooking up a transducer/speaker/tweeter to e.g. an arduino or a microcontroller of some sort and generating the frequencies using the microncontroller's pwm/timer outputs on a pin? This will produce square waves though as opposed to sine waves but still of the correct frequency right? Or do I need to use Fourier series and think of all the sine waves and harmonic frequencies that are also being produced..? Not sure if that makes sense or if I understood fourier series properly so feel free to correct me where I'm wrong.. May need an amplifier here too?

Does anyone know how the loudness of e.g. transducers change with regards to the different frequencies being produced? E.g. I've looked at normal speakers and whether e.g. hooking up a function generator to a speaker would work for what I'm trying to do but from my understanding normal speakers aren't designed to produce ultrasound? And the loudness decreases I think sharply above e.g. 20 or 22kHz since humans can't hear above these frequencies?

In terms of being able to record sounds.. Can this be done by using a transducer once again but this time it converts the sounds to electrical signals and I can just read this using e.g. an Arduino ADC pin and if I wanted to be able to e.g. hear any recorded ultrasonic sounds could the frequencies just be scaled down to the audible range by e.g. dividing by 8 or 16 or by subtracting e.g. 20 kHz if we're interested in frequencies in the 20 - 40 khZ range?

I don't know much about this topic and not sure where to begin with regards to circuit designs. Not sure if the system will be as simple as I mentioned or whether e.g. it will be more complicated and will require e.g. amplifiers, microphones, speakers.etc. Tried some books in the library but none had any practical information and circuit designs.. :/

Sorry if my post is a bit long! Any circuit designs or useful links would be much appreciated. :)

Thanks for your help :)
 

MrChips

Joined Oct 2, 2009
30,824
You are on the right track, sort of.

Square waves consist of the fundamental frequency plus all the odd numbered harmonics.
If you want to study the effects at different frequencies then you really should be outputting sine waves.

You can use a fast microcontroller and an equally fast DAC in order to generate sine waves or any arbitrary waveform. This would be more flexible than sending PWM voltages. I would be aiming for a sample rate of 1Msps.

In order to go beyond 20kHz you will have to resort to an ultrasonic transducer.

Similarly, in order to record sounds above 20kHz you can use an ultrasonic transducer followed by an amplifier. You then use a high speed waveform digitizer to sample the amplified signal. If you wish to digitize a 50kHz signal your sampling frequency must be at least twice that, i.e. 100kHz. Similarly, I would aim for a sample rate of 1Msps.
 

GopherT

Joined Nov 23, 2012
8,009
You can use a simple 555 timer to generate square waves and add a comparitor or op amp to convert that to a triangle wave. A simple potentiometer adjusts the output frequency.

Recording those sounds will be more difficult. The "microphone" will be the difficult part. Also, human hearing does go up to 22kHz for certain individuals. 18 - 20 kHz for most people while they are young. However, hearing frequency range falls off with age. Nobody can make vocalizations anywhere near that frequency. I also doubt rats can make vocalizations near their upward range of hearing.

That said, you will likely find all you need (want) with 20kHz for the recording side and that will make things much easier.

If you insist on recording up to 55kHz, how do you plan on monitoring/reviewing these high frequency recordings? How will you tell the difference between rat vocalizations from insect wing noises and mechanical noises.
 

MrChips

Joined Oct 2, 2009
30,824
If you insist on recording up to 55kHz, how do you plan on monitoring/reviewing these high frequency recordings? How will you tell the difference between rat vocalizations from insect wing noises and mechanical noises.
Interesting point. After digitizing the signal you can frequency shift the signal to the audio range. For example, you can shift 40kHz-55kHz down to 0-15kHz and then listen for characteristic sounds.
 

GopherT

Joined Nov 23, 2012
8,009
Interesting point. After digitizing the signal you can frequency shift the signal to the audio range. For example, you can shift 40kHz-55kHz down to 0-15kHz and then listen for characteristic sounds.
In the old days, reel to reel tape would be used for recording and slowed down during playback. Now that's an analog solution!
 

alexfreed

Joined Oct 8, 2012
72
No reason not to playback digital recorded samples at say 1/4 sampling rate. 0-50K will become 0-12.5K
Some sound cards can record and playback at 192K sampling rate. The only question is the bandwidth of the analog filter, but that can be modified.
 

GopherT

Joined Nov 23, 2012
8,009
No reason not to playback digital recorded samples at say 1/4 sampling rate. 0-50K will become 0-12.5K
Some sound cards can record and playback at 192K sampling rate. The only question is the bandwidth of the analog filter, but that can be modified.
Good idea,
I just wanted to make sure the OP thought thought through his entire project befor he invested a bunch of time and money. Looks like solutions exist to playback. Now to identify the source of the noises.
 

DickCappels

Joined Aug 21, 2008
10,187
Hi

I'm trying to build a system that can generate and record sounds within the range of about 0 - 50 or 55kHz.

(Most or original text removed for clarity.)
As MrChips said, above 20 kHz you will need an ultrasonic transducer, but the really difficult part will be finding a transducer for 0 Hz.
 
Top