[Mark] had seen a few examples of algorithmic music generation that takes some simple code and produces complex-sounding results. Apparently it’s possible to pipe the output of code like this directly to audio devices on a Linux box, but [Mark] decided to go a different direction. His project lets you play simple algorithms as audio using AVR microcontrollers.
Now the code work for this is very simple, but he hardware implementation is where things get interesting. Ostensibly, [Mark] didn’t have the components available to build a filter to use PWM as an audio signal. Being that he’s a ham operator, he grabbed some radio equipment he had on hand and whipped up an alternative. He’s feeding the PWM from an Arduino into the voltage controlled oscillator on a board meant for high-altitude balloon telemetry. The signal broadcast by this board is then picked up by his radio receiver, and played on some speakers.
Rube-Goldberg contraptions aside, the effect is pretty interesting, as you can hear in the latter half of the video clip which we’ve embedded after the jump.
[youtube=http://www.youtube.com/watch?v=jaTzSXN8uJU&w=470]
Nicely done, but transmitting music on 144.300 is technically a Part 97 violation.
How about, “it’s not music, it’s data?”
It isn’t a Part 97 problem in Australia. It might be legal there. It isn’t in America.
There’s a reason I was using a dummy load.
I checked, and the transmissions didn’t go any further than about 2 metres.
MY EARS, DAMN YOU HAD!
I really like the final sound.
I am wondering what kind of filter could create a similar effect in an audio synthesis enviorment…
Some hints?
Last round bracket needs to be a curly bracket :-)
The first ever thing I did on an AVR was to increment PORTD by one every few thousand cycles. Each pin had a LED and a resistor, so I could watch the binary number increment.
Then I realized I could put a small speaker between the LEDs and ground, and drive the pins at different rates, and all the waveforms would sum up and play out. So I created a small polyphonic light organ that worked by touching the LED leads to a bare wire.
I don’t understand why you’d have to go this complicated to do it when you could essentially just wire a speaker to a pin and change the algorithm to produce something that is directly audible.
Let’s see why you shouldn’t do this:
Speaker impedance: around 8 ohms.
Voltage at the pin: 5v
Using ohm’s law, the current would be: 625mA
An AVR pin can put out 40mA max. More than that and you can destroy the pin or the chip.
The speaker isn’t going to be 8 ohms at all frequencies. Even at 10 times more than the rated impedance, you would still be drawing too much current.
There’s a good reason why you shouldn’t connect a speaker. You need to limit the current drawn first. Then most likely you’ll need an amplifier.
If you limit the current drawn with a 20% 150Ω resistor, then worst-case, you have 188Ω resistance, so 27mA, so 5.7mW out of the speaker, which is still gonna be plenty loud.
last “)” should be “}”
These algorithms are very interesting. Better than using a microcontroller it seems that implementing them with a CD4040 and a few logic chips or diodes would be easy. A challenge could be to use as few components as possible.
Hi,
apart from the last bracket,
isn’t (t&t>>8) equivalent to (t>>8), because the bitwise AND operator has a higher priority than the right shift operator?
Also, AFAIK, you can only use “void” or “int argc, char *argv[]” as arguments for the C main function.
How is it supposed to be?
bitwise & has a lower priority then ==, so it works as intended.
See: http://www.difranco.net/cop2220/op-prec.htm
It’s a common bug to have something like:
if (a & 0x03 == 0x01)
Which is evaluated as:
if (a & (0x03 == 0x01))
main(){
for (t=0;;t++)
putchar(t&t>>8);
}
lets add unnecessary parentheses, and lay the code out in some obscure fashion…
That code is horrible. what is up with you kids and not knowing how code blocks work. THEY DON’T GO IN THE HEADER!!!
this one by: Rez/Razor1911. http://j.mp/pljQog
On Linux, the code is “cat foo.wav > /dev/dsp”. Anything else requires an on-the-fly convert to WAV, so it’s not the greatest way to play music.
There’s a topic on Pouet on this subject: http://pouet.net/topic.php?which=8357&page=1&x=17&y=10
Not exactly data either. How ever Part 97, which I have to observe, really doesn’t define what data is or isn’t. I’m not sure why the RF was used here, because the audio could have been plugged ind the sound card to get the same display Call this testing the micronut with random signals, if anyone asks.[shrug]
The next step would to see what kind of random text this would generate. Takes one back in time. To when you could here similar music by playing a data cassette in an audio cassette player. Also back to the time of using the telephone handset to send data.
For some more algos:
http://www.youtube.com/user/viznut