Find all your DIY electronics in the MakerShed. 3D Printing, Kits, Arduino, Raspberry Pi, Books & more!

Powered by Nerd points out this project from Kevin Weekly, the Random Music Box uses a relatively low part count to generate a pleasant pseudo-random song. The cardboard ‘kick drum’ is a nice touch!

Collin Cunningham

Born, drew a lot, made video, made music on 4-track, then computer, more songwriting, met future wife, went to art school for video major, made websites, toured in a band, worked as web media tech, discovered electronics, taught myself electronics, blogged about DIY electronics, made web videos about electronics and made music for them … and I still do!


Related

Comments

  1. daniel says:

    Impressive! Double points for coding in assembly. Or maybe half credit. I’m not sure, but I don’t want to look at the source code anymore, haha.

    1. justDIY says:

      I didn’t watch the entire video, but does it explain why the poster bothered to obscure the labeling on the top of his “pic” chip? AFAIK there’s no way to identify someone from the numbers on a chip like that, short of a brute-force police style process of elimination (lot code sold to vendor x, vendor x sold to reseller y, reseller y sold to customer z)

      Either that, or it is not the same chip that it is claimed to be?

  2. Jason says:

    Does this play notes at random or choose at random from a few stored songs? The docs aren’t clear and I haven’t done pic asm since I discovered JAL about 6 years ago :).

    I’m interested espeically since I have an almost full rail for 16F648′s from before I switched to Arduino. I wouldn’t mind something nice and simple to do with those since for new coding I’m going to use the Arduino environment.

    1. Collin Cunningham says:

      a little confused on that point myself

    2. vivi says:

      The source code is not easy to understand, being messy ASM, but he seems to use standard chord progressions : major, minor, blues, etc, either 4 or 8 notes long. He picks a random one every 64 beats. Every 4 beats he gets the next note from the current chord progression (root). Every beat, he picks a random note (melody), and plays simultaneously root, root+4, root+7, melody. For minor chords he plays instead root, root+3, root+7, melody.

      A fifth voice is used for the bass.

      I lack musical knowledge to understand how all of this fits together, but it does sound melodious.

      He uses TMR1 as his RNG so it’s not actually random.

      1. Kevin says:

        (author here) Yeah, I “code for the moment” and have trouble understanding the asm later myself.

        Something to add to what vivi said: The five square waves are mixed outside of software to make things easy. The basic idea for generating the notes is that the TMR1 counter counts up at a consistent rate and I just toggle after so many timer ticks (pre-calculated into per_table). Of course there’s a lot of junk to do with rollover and whatnot- here MPLAB’s simulator with logic trace was super helpful.

  3. explorer says:

    could someone post the asm code here please? cheers

In the Maker Shed