# Sound analyizing

Hello
I want to get sound by microphone and send to ardiuno uno and then analyiz sound to freqency in this freqency channel
63,125,250,500,1000,2000,4000,8000 Hz
And show amplitude in that channels.

I used source code example in arduinofft library but it can't show frequency correctly
For example i send a tone with 1000 hz to microphone but it show maximum amplitude in another frequncey

The frequency bins of an FFT are determined by the sample rate of your input signal. To get the bands you want you will need to sum the appropriate number of bins. If you know the sample rate this can be calculated. If not the put in a known frequency and see what bins peak.

How accurate do you need his to be?
For a sound to light display you don’t need precision.

I want to use sample rate 128
But i can not determin frequency correctly by ardiunoff library
I use an example in ardiunofft that get sound by microphone and change sample rate 128 and sampling freqency 16000 then send a tone with 1000 hz but it can not determin freqency of it correctly

I want to determin amplitude of frequency in octav bands

22 TO 44 and show amplituid this band for 31.5 Hz(central freqency or cf)

44 TO 88Hz -->cf=63
88 TO 177Hz-->cf=125
177 TO 355Hz -->cf=250
355 TO 710Hz -->cf=500
710 TO 1420Hz-->cf=1000
1420 TO 2840Hz-->cf=2000
2840 TO 5680Hz--->cf=4000
5680 TO 11360Hz--->cf=8000

If maybe help becuse i am beginer in arduino and need this source code

I want to use sample rate 128

128 what? Samples per second?

I use an example in ardiunofft that get sound by microphone and change sample rate 128 and sampling freqency 16000 then send a tone with 1000 hz but it can not determin freqency of it correctly

What in your mind is the difference between sample rate and sample frequency, in my mind one is just the reciprocal of the other. So what you say makes no sense.

I want to determin amplitude of frequency in octav bands

Please re read what I said in my previous post. It seems to me you are ignoring me.

I use this code

I change sample from 64 to 128 and samplingfrequency to 16000 hz

I want to determin amplitude of frequency in octav bands ,how do it?

22 TO 44 and show amplituid this band for 31.5 Hz(central freqency or cf)

44 TO 88Hz -->cf=63
88 TO 177Hz-->cf=125
177 TO 355Hz -->cf=250
355 TO 710Hz -->cf=500
710 TO 1420Hz-->cf=1000
1420 TO 2840Hz-->cf=2000
2840 TO 5680Hz--->cf=4000
5680 TO 11360Hz--->cf=8000

I want to make analyzer for sound messurement for health hearing i need analyze sound in octavband and determin dB in per band but first i should analize sound in octaband

In a band we have low freqency and up frequency and central frequency
For example a sound has frequency 800 hz this application show amplitude in central freqency of it in 1000 Hz

See this picture understand me

Sound have 800 hz freqency but sound level show in 1000 hz

[/quote]

I want to make this sound analizer by ardinuo
How do it?

So you changed "samplingFrequency = 100; //Hz, must be less than 10000 due to ADC" to 16000? Do you really think that 16000 is less than 10000?

BTW even if you could use a sampling frequency of 16000 that would only work for audio frequencies up to 8000Hz. Anything over that present in the signal could cause all sorts of problems.

Steve

slipstick:
So you changed "samplingFrequency = 100; //Hz, must be less than 10000 due to ADC" to 16000? Do you really think that 16000 is less than 10000?

BTW even if you could use a sampling frequency of 16000 that would only work for audio frequencies up to 8000Hz. Anything over that present in the signal could cause all sorts of problems.

Steve

I change samplingfrequency to another number also 8000
But this source can not show correctly sound frequnecy
I use a ton with 1000 hz but this source show 2000 hz!

I change samplingfrequency to another number also 8000

You can change the sample numbers all you like but unless the Arduino is capable of acheaving that sample rate it will do no good.
The appropriate bin will fill up based on the real sample rate you use, there is no way the calculations can compensate for a bad sample rate.

Was that graph something you produced or something you want? You have still not told us about your real application, that is what you will use that graph for.

It looks like you will not have a sufficient sample rate to be able to group the bins how you want.

I am sorry my english is not good and i had to translate your sentences by google translator

I want to make an application to show dB in per band and then A_weighing

I want to make sound level meter analyzer
But i didnt success to find any source code to help me that analyize sound in octavband in 20 till 20 khz

What Arduino do you have?

In order to see 20KHz you need to sample at least at 40KHz and preferably much higher.

The project will require you know about FFT and windowing functions applied to the input waveform. I don’t think it is something you can do with a Uno class Arduino.

Grumpy_Mike:
Was that graph something you produced or something you want? You have still not told us about your real application, that is what you will use that graph for.

That graph is somthing i need of course i need to amplitude in per band i dont need to graph shap .that graph is from a sound level meter analizer application in android mobile

Grumpy_Mike:
What Arduino do you have?

In order to see 20KHz you need to sample at least at 40KHz and preferably much higher.

The project will require you know about FFT and windowing functions applied to the input waveform. I don’t think it is something you can do with a Uno class Arduino.

I use uno

Your mean ardunio can not analize sound at least to 8000 hz?
Idont know about FFT ,i just want source code for analize and then change something i need for achive to a weighting and show dB

Your highest frequency of interest is 11360Hz, so a sampling rate of ~30kHz is enough, given a brick-wall
analog anti-aliasing filter is employed to prevent frequencies above ~15kHz folding back.

One approach is simply to go to 40kHz sampling rate anyway, avoid the anti-aliasing filter, and then
run several bandpass digital filters on the samples to pull out the channels and separately calculate
running rms power estimates for each band. With crude low-pole-count IIR filters for each band this
might be less computation than FFT or FCT

However for true A-weighting you kind of need the detail of an FFT output produces to do the weighting properly
if accuracy is important, since the weighting varies appreciably across each octave.

Noisecontrol:
Your mean ardunio can not analize sound at least to 8000 hz?
Idont know about FFT ,i just want source code for analize and then change something i need for achive to a weighting and show dB

Its a small 8-bit microcontroller, not a DSP chip.

MarkT:
Its a small 8-bit microcontroller, not a DSP chip.

I want to analyiz sound into bands and get ampltiude value of per band then by regresion convert amplituid to dB and then decrase value of a_wiething of it
Understand my mean?
I dont want to make a wighing chipset
Even consider till 4000 hz ,cuz noise in industrial usually is 250 till 4000 hz and then wighting it

An aplication on android mobile can do analyize sound in octavband
Do arduino uno dont able it?
I see some video in youtube that analize sound

I've never used the FFT or FHT library so I'm not sure what's wrong...

FFT (and FHT) is "imperfect".

Do you have a 1kHz sine wave? A square wave has harmonics (although the 2kHz harmonic is less than the 1kHz fundamental).

Did you bias the input (so you don't clip the negative half of the waveform)? A rectified wave will also contain harmonics although again, the harmonics should be less than the fundamental.

I want to make analyzer for sound messurement for health hearing i need analyze sound in octavband and determin dB in per band but first i should analize sound in octaband

I'm not sure how that's going to work... Typically with a hearing test a single tone is played at a known frequency and known amplitude and the patient/subject presses a button or raises his/her hand when they hear a tone.

Since the frequency and amplitude are known, there is no need to "analyze" the sound.

It's straightforward, except the headphones/speakers have to be calibrated (for SPL level and frequency response) and you need a soundproof environment so that quiet tones are not drowned-out by background noise. And, neither of those are trivial.

Your mean ardunio can not analize sound at least to 8000 hz?

There are two things that affect the maximum frequency -

1. Nyquist theory says your sample rate has to be at least twice the signal frequency. The easy way to think about it is that you need to sample the positive-half of the wave at least once per cycle and the negative-half at least once per cycle.

If the signal is greater than half the sample rate you'll get aliasing (false frequencies).

The signal has to be filtered before it's digitized because the aliasing occurs when it's digitized and then it's too late to know. Every soundcard has a low-pass anti-aliasing filter.

You can build a Arduino spectrum-analyzer display/effect without a filter, and you can get-away with it because the highest frequencies in normal voice/music are low level so the alias is low-level and it's only a visual effect so it doesn't have to be perfect.

1. The Arduino ADC looses accuracy above a sample rate of 15kHz which limits you to 7500Hz for the full 10-bit accuracy.