Go Down

Topic: Real Time Audio Processing (Read 3226 times) previous topic - next topic

Grumpy_Mike

Quote
How can I make sure?
The only real way is to use an AC millivoltmeter or best of all an oscilloscope. It is a bit pointless trying to do anything in audio without a scope.

However, you could write some code that inputs the data into a small buffer, say 512 bytes, and then prints out the numbers, not to the serial monitor but to the serial plotter so you get a graph. Then you can see how big your input waveform is.

Oh and by the way:-
Quote
Can I do a 5 bit dac two of them to get a 10 bit dac
You can but it will be no better than just having a 10 bit R/2R ladder, and like I said you can't buy resistors of good enough tolerance even to make an 8 bit ladder let alone a 10 bit one. I don't think you understand this point.

zkhan

#46
Mar 01, 2019, 01:34 am Last Edit: Mar 01, 2019, 10:04 am by zkhan
Thank you for the insight I will do that. Moreover I want to add a 3.5 m jack and leave the code alone .
I was able to find this however im not too certain was the values of the resistors and cap would be?

I connected my 3.5 jack which heres the link https://www.amazon.com/gp/product/B077XPSKQD/ref=ppx_yo_dt_b_asin_title_o09_s00?ie=UTF8&psc=1

straight to the A0 and gnd of audrino. However the speaker is really low even tho i have max volume on my phone.





Grumpy_Mike

#47
Mar 01, 2019, 10:40 am Last Edit: Mar 01, 2019, 10:47 am by Grumpy_Mike
Yes that circuit will show nothing until the audio input exceeds the forward voltage of the diode, which is 0.75V. As it only works in the positive peaks then it needs at least a 1.5V peak to peak audio signal before you get any readings.

That resistor is 100k.

The circuit is a peak detector, you won't get any audio through it only a reading of the peak amplitude, useful for volume measurements, and beat detection.

zkhan

Do you know how to go about a circuit for orientated for audio . Thank you

Grumpy_Mike

I think we are going round in circles, for a circuit for coupling audio into the Arduino see the link in reply #13.

zkhan

#50
Mar 01, 2019, 02:42 pm Last Edit: Mar 01, 2019, 02:45 pm by zkhan
"The audio input signal is connected via a 10uF capacitor to the the analog input 1 of the Arduino Board. Two resistors and a trimmpot are adding an DC offset to the audio signal . A potentiometer connected to analog input 0 will be used to control the audio effects."

Unfortunately, I am having a hard time making out the circuit.  Would it be like the png below?

zkhan

Moreover, i tried the circuit below but the noise has gotten worse than using a mic. Furthermore, I have to max the volume of my phone to hear very quiet noise from the speaker. Any suggestions?

Grumpy_Mike

#52
Mar 01, 2019, 04:32 pm Last Edit: Mar 01, 2019, 04:33 pm by Grumpy_Mike
Quote
Any suggestions?
What are the numbers you get from the analogue read?

With that circuit they should be centered about 512 and go up and down from that. If you are getting sound then the audio signal is not big enough.

Quote
, I have to max the volume of my phone to hear very quiet noise from the speaker.
Yes, not a surprise. Fit an operational amplifier with a gain of about 50, before the circuit you posted.

About op-amp circuits

zkhan

Thank you for all the help. I had a question however, if for example i increased my sampling rate to 40KHZ, does higher sampling rate cause inaccuracy it terms that its sampling so fast its missing specific signals?

zkhan

Also How can I make sure that Im getting the right results from the 10bit ADC. Lets say im sending a 200 HZ analog signal, what value do i expect the ADC to return? Can that be figured out?

Grumpy_Mike

You are missing the point. The sample rate has nothing to do with the sample itself. Going faster means you see finer detail of the waveform that might be missed going slower. If you go slower than twice the highest feature in a signal you get aliasing, which means generating false signals.
Also How can I make sure that Im getting the right results from the 10bit ADC. Lets say im sending a 200 HZ analog signal, what value do i expect the ADC to return? Can that be figured out?
The two are not related in any way. With a 10 bit D/A you can get voltages out from 0 to the voltage reference of the D/A, but only if you put numbers into the D/A of 0 to 1023.

zkhan

Thank you for the information. One more question then, is there any problems that can arise with the audrino if for example the sampling rate of the ADC was set to its highest?

DVDdoug

Section 21.1 of the ATmega datasheet says you loose resolution above a sample rate of 15kHz.   (That's the sample rate...  Your signal  is limited to half the sample rate.)

Quote
Up to 76.9 kSPS (Up to 15 kSPS at Maximum Resolution)
Your sample rate may also be limited by whatever "processing" you are doing and how fast your program can loop.

zkhan

Thank you for your feedback. I was reading section 21.1, however, i dont fully grasp why the audrino loses resolution if it goes above 15KHZ.

DVDdoug

Quote
Thank you for your feedback. I was reading section 21.1, however, i dont fully grasp why the audrino loses resolution if it goes above 15KHZ
Have you ever used a multimeter or voltmeter?   It might take about one second before the readings stabilizes.   The Arduino ADC is a lot faster but there is still a limit to how-fast it can read.

But again, I'm more worried about the amount of processing you can do in 1/15,000th of a second.     

Go Up