[sdiy] (OT)help processing realtime audio on Arduino?
Dan Snazelle
subjectivity at hotmail.com
Tue Feb 1 21:05:56 CET 2011
Thanksguys!!!
I will spend more time with the lab 3
I had run it before but just couldnt get much out of the code as much of it is at a very low level speaking directly to hardware and the arduino reference doesnt explain most of that stuff!!
Maybe i need a book not on arduino but on the AVR!
Much appreciated
Sent from my iPhone
On Feb 1, 2011, at 2:52 PM, Tom Wiltshire <tom at electricdruid.net> wrote:
> Hi Dan,
>
> I had a read-through of that LAB3 article, and it's not *too* bad. Although I didn't understand why the set a timer up at 62.5KHz and then only used every other interrupt to read an audio sample. Perhaps the ADC is slow.
>
> http://interface.khm.de/index.php/lab/experiments/arduino-realtime-audio-processing/
>
> The reason I bring it up is that there's a "audio loopback" arduino sketch mentioned at the end. Have you tried this? This would act as a basic test of the hardware and would give you a solid foundation to build on. It will just read samples from the ADC (at 31.25KHz presumably) and output them again via the PWM module. If you get the same sound out as you put in (roughly! - 8-bit and limited bandwidth) then the hardware is working and you can start mucking around with the code.
>
> Beyond this, I'm not much help 'cos I've never played with Arduino or AVRs in general.
>
> Regards,
> Tom
>
> PS: I don't think this is nearly as far OT as my recent C programming queries. Audio processing has to be synthy, doesn't it?! I reckon you're on safe ground.
>
> On 1 Feb 2011, at 19:07, dan snazelle wrote:
>
>> ok, I am trying to figure out how to write a tiny but of code that will hear sound on arduino input 0 and allow that integer to be stored in a variable
>> which can then be divided by 4 and output from pin 11.
>>
>>
>> anyway, so far my code looks like this but it doesnt work:
>>
>>
>>
>> CODE
>>
>>
>> const int INPUT_PIN = 0; // INPUT
>> const int speakerPin=11 // output to opamp or speaker, etc
>> void setup() {
>>
>> }
>>
>> void loop() {
>> int INPUTresult = analogRead(INPUT_PIN)/4; //read the value of input and divide by 4....i dont think this is how you would divide it by 4....
>>
>> analogWrite(PWM_PIN, INPUTresult); //PWM_PIN has to be a pin labeled PWM on the arduino, and the value [0,255]
>>
>> }
>>
>>
>> end code
>>
>>
>> sorry if this is a big mess. I have gotten a couple books on arduino but they all seem to completely skip over reading sound into the arduino and outputting that same sound
>>
>> what i would like to try and do is just real simple experiments with the audio.
>>
>> i am not even trying to save it in RAM. eventually i would like to try an R2R ladder out of the chip. would i use the non-pwm pins for that?
>>
>>
>>
>> there was an interesting article by LAB 3 on realtime audio processing on the arduino but it went WAY over my head
>>
>>
>> and the arduino forum seems populated with a lot of people who dont have any real connection to synths
>>
>>
>> so that is why i am asking here.
>>
>>
>> thanks for any help advice or links
>>
>> _______________________________________________
>> Synth-diy mailing list
>> Synth-diy at dropmix.xs4all.nl
>> http://dropmix.xs4all.nl/mailman/listinfo/synth-diy
>
>
More information about the Synth-diy
mailing list