Python Wave File Fun and Audio on Arduino

I had never touched the struct library before. I believe it is the main way to use python to interact with bit formats.

https://docs.python.org/2/library/struct.html

Strings are byty things, so I guess struct uses them as a bridge between pythons weirdo types and the bare metal of c types. I think something similar can be done using numpy.

16 bit wave is signed integers, 8bit is unsigned. That goofed me off. I never got the resaved file to sound not alike a demon though, so there is something wrong in the code. The outputted c file worked like a charm, so I guess who cares. That’s all I wanted anyhow, I was just rewriting the wave for debugging.

Tried using an R-2R ladder to make a ADC for the arduino. It worked, we buffered the output with a simple emitter follower circuit.

Way overkill though.

I was thinking of using the analog in in some kind of feedback loop with a capacitor as an ADC when I found this.

http://highlowtech.org/?p=1963

This does the same thing with no parts (well, still need a buffer to get full volume). Clev. Majorly clev.

A speaker can’t respond at ~60kHz (nor would you hear it) so the fact that there is a pwm and not a true ADC going does not matter. Noice.

 

Incidentally, installed crayon for wordpress. Code looks way freaking better.

Leave a Reply

Your email address will not be published. Required fields are marked *