04-24-2018 06:13 AM
Hello guys, I'm here again with another problem.
I'm developping a VI that can estimate the speed of the car through the recording of the car passing the microphone. This is done knowing the Frequency of the car while is approaching (which is constant and higher) and the frequency of the car going away (which is also constant and lower).
So, basically I need to find out the Incoming and Outgoing frequency of the sound.
I used myDAQ to record 10 seconds of the sound but I'm stuck with the plots that I have. I was able to plot Voltage vs Time (which basically gives me the volume of the recording vs time), which is also good, because when the car is incoming the volume is going up, then reaches the peak while the distance to micriphone is zero, and then goes down while is outgoing. Having the time at which the car was passing, it was then a matter of going to the Frequency vs Time plot, and find out the frequency before the highest volume, and the frequency after. But this is where I got stuck.
Using spectral, i was able to plot dB vs Frequency, but I can't plot Frequency vs Time.
Is there any way I can plot the Frequency vs Time of a sound recording?
Thanks
04-24-2018 06:20 AM
What you are talking about is called a "spectrogram". Do a little research on it and it will explain what it is and suggest how you might create one (with LabVIEW, of course).
Bob Schor
04-24-2018 06:34 AM
Thank you for your fast answer! I tried it using the spectogram, but It couldn't fit my needs, because it ends up showing us all the frequencies.
I just can't think how I can end up with the frequency of the incoming sound and the outcoming sound! I've been trying to correlate the volume of the recording, then with the time trying to using the spectogram to take the frequency, but I can't do it in reality
04-24-2018 06:42 AM
@AndreP wrote:
Thank you for your fast answer! I tried it using the spectogram, but It couldn't fit my needs, because it ends up showing us all the frequencies.
Of course it shows you "all the frequencies". Think about "What is my Question?". You have a sound. At one time, the sound "sounds" at a higher frequency, at a later time, at a lower frequency. What does this mean? At one time, the Sound Spectrum is "shifted" to higher frequencies, at a later time, to lower frequencies.
You need to ask "How has the spectrum shifted?" In order to answer this, you need the Spectrum at different points in time, and need to look at the shift.
Suggestion -- it is always helpful to include "supplemental material" with your posts. This could include your VIs, or in this particular case, a picture of your spectrogram ...
Bob Schor
04-25-2018 03:58 AM
Ignoring the effect that the speed of sound in air is also a function of frequency ...
If your mic is in the line of the sound source trace you get a triangle formed shift.
If the mic has a distance to the trace the shift isn't a triangle anymore ...
but by characterising the shift shape you can make a good guess of the mic distance (assuming a constant speed) (nice physics homework 😉 )
As Bob noted: the STFT is your friend... look at the graph and think about how do I analyse the data seen..
Another useful function to look at is the correlation function 🙂
04-26-2018 11:52 AM - edited 04-26-2018 11:53 AM
Thank you for your help! I ended up doing this:
- From the microphone recording -> Take waveform components, and then splitting the sound in 2 (Incoming and Outcoming), this was found by looking at the maximum Voltage level from microphone (which is highest volume), and then using the index to split the original sound in 2 parts.
- One of the part is the incoming car, and the other is the outcoming car, and from each, doing a PSD and retrieving the frequency out of the maximum tone I was able to get the incoming and outcoming frequencies.
The results are correct up to the 0.5 mph!
(To be noted that the sound is generated digitally, so the distance to the source is theoretically zero). I attached the VI:
And this works for pure sounds that only have the frequency of the engine. But now, we're facing another challenge.
The next set of sounds, feature some other noises! Luckily these noises doesn't intercept the engine frequencies (which range from 447.6 Hz to 566.7Hz), but because of that other frequencies (at around 800 and so), when I'm calculating the maximum tone, it'll use the noise frequency instead of the engine frequency.
The core question here basically is: I took the Cluster from the PSD and transform it to Array. How can I now delete all the date bellow 447.6Hz and above 566.7Hz given the dB and Hz information is now split? And only be remained with all the dB information of the Frequencies between 447.6 and 566.7 Hz so when I analyse and take out the maximum tone, I know that I'm doing it out of the engine, because only the engine relies on these frequencies! I think I need to create an array with Frequency and its decibel, but only from 447 to 566 but I can't!
I have attached the VI's and some audios that we need to test.
(A0 is a simple audio file, has been tested and has correct speed)
B0, C0 and D0 are engine files with background noises. The VI doesn't correctly estimate these, but the correct speed (to confirmation) can be found in the file name.