NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Project Help and Ideas » Jukebox

January 02, 2012
by Drwish
Drwish's Avatar

What I'm going for is a simplified jukebox using squarewaves with menu selection via 2 momentary push buttons. I was wondering how I could improve my musical timing as what I have set up as of now is timing at random guesses in miliseconds of how long a note should last. Is there a better way? Is there a defined duration per note for, lets say, a 3/4, or 4/4 measure?

Here's a video of what I have so far =P

January 03, 2012
by hevans
(NerdKits Staff)

hevans's Avatar

Hi Drwish,

I'm reaching way back to my high school orchestra days here, so some of the details may be fuzzy. The duration of a musical note in seconds changes depending on the tempo of the piece you are playing. A musical score will often designate a tempo in beats per minute. A 4/4 time signature means there are 4 quarter note beats in every second. So for example if a score called for 120bpm in 4/4 time, it means every quarter note lasts for half a second.

If you wanted to get fancy, you could have a variable beats per minute that the user can set.

Humberto

January 04, 2012
by Vi3GameHkr
Vi3GameHkr's Avatar

That is a neat little thing. I have an Arduino I also play with, and I did the same thing, except I programmed the Legend of Zelda Overworld song (because the piezo speaker sounds just like the 8-bit sounds you find in there)

In my experience, Humberto's advice is right, but as I started playing with more complicated tunes, I ran into eighth notes, sixteenth notes, triplets and dotted sixteenth notes. To accommodate for the variety of different note lengths, I calculated the duration of 96th notes based on a set BPM value, then had a constant multiplier for each note, for example a quarter note was 24 96th notes, and an eighth note was 12.

January 04, 2012
by Drwish
Drwish's Avatar

I'm curious as to how you transcribed triplets? (I'm asuming these are the notes that are three notes played at the exact same time) They way I approached it was to simply play the middle of the three notes. Any suggestions? =P

January 05, 2012
by Vi3GameHkr
Vi3GameHkr's Avatar

By triplets, I actually meant a set of 3 notes played in the duration of a quarter note (so twelfth notes basically) but I also ran into the problem of having multiple notes play at the same time. In that case, just try it out on a piano or something, and figure what sounds best. Another solution would be to get two piezo speakers (although I wonder if you could play multiple sounds on a single piezo)

January 05, 2012
by treymd
treymd's Avatar

I would think you cannot play multiple tones on a single piezo, unless of course the duty cycle trick we play with LEDs works. Interesting thing to ponder anyway.

January 05, 2012
by Rick_S
Rick_S's Avatar

It always amazes me at how people underestimate the power of these micro-controllers. HERE is a link to a youtube video of a project (award winning project) that pertains to this thread.

He uses an ATMega88 (the little brother of the Atemga168's and 328p's we use here). In this video, he not only is generating polyphonic sound, he also is generating 8 bit color video on a VGA monitor. All done with software inside the micro-controller. The only external hardware he uses other than the physical connectors, are some resistors for the D/A conversion and some other basic components. NO other IC's though (unless you want to count the voltage regulator BigGrin )

I think you may find this interesting.

Rick

January 05, 2012
by Drwish
Drwish's Avatar

That is absolutely amazing Rick! That guy must be highly valuable to his company xD

January 05, 2012
by Drwish
Drwish's Avatar

Does anyone know a good source for simplified sheet music? By that I mean something easy to transcribe to a piezo =P

January 06, 2012
by pcbolt
pcbolt's Avatar

@Rick_S

That video is downright inspiring. Thanks for the link.

Post a Reply

Please log in to post a reply.

Did you know that first-order systems have a exponentially decaying response to step inputs? Learn more...