There’s an episode of Rick and Morty where the characters are in a simulation. The simulation is within another simulation, without making this explanation too complicated it’s running on much less power than it should be.
There’s a scene where Jerry listens to music in his car. “Human Music” is playing on the radio.
I wondered if it is possible to play “Human Music” on an Arduino. The answer is yes.
The electronics side of this project is simple. Just connect one wire from the piezo to ground and the other to pin 2. It could be a good idea to put a 100 ohm resistor in series with the piezo.
Here’s the code:
In the setup we’re setting Pin 2 as an output.
I could tell that it is just three notes repeating over and over again. I’m not musical enough to hear what they are. After some brief internet searching, I found out that they are C, D, C. Arduino has a convenient command called Tone. This makes it very simple to output almost any frequency.
Tone(Pin number, frequency, duration);
The first number is 2 because that’s the pin we’ve chosen. 262Hz is the frequency for the note C. And we want it to play for 100 milliseconds.
I found out what the frequencies of the notes are by referring to this webpage: https://www.seventhstring.com/resources/notefrequencies.html
As for the duration of the notes and the delays, I recorded the sound from the original Human Music clip. I used the free audio recorder; Audacity.
You can see that each note is 0.1 seconds in duration, the delay before the next note is 0.4 seconds. Once the sequence ends, it’s 0.8 seconds before it starts again. Multiply these numbers by 1,000 to get them in milliseconds, and there you have your very own Human Music generator.
Leave a Reply