Parametric Music Box

by wizard23, published

Parametric Music Box by wizard23 Mar 8, 2013

Challenge Winner



This is a 100% printed customizable music box!

Only 3D printed parts are used in the design and it can be assembled and disassembled via printed snapping mechanisms.

The project originated when a friend of mine said that he'd only be interested in 3D printing once he can print a music box ;)

youtu.be/K_c3p24RRtQ (made by banthafodder7400)

I'll try to keep the .scad file on this page updated but to help me to manage the design and to make it easier for others to contribute: github.com/wizard23/ParametrizedMusicBox

Recent Comments

view all

I'd love to see you go on to put up a website of the 'enter a youtube url to download the mp3' kind, but instead it gives you an STL file that you can print, giving you the music on a cylinder. Old school piracy.

I would love to make the xylophone notes to Gotye "Somebody I Used to Know" but am musically inclined :(

Great, thanks i really appreciate it! :)

More from Mechanical Toys

view more

Liked By

view all


Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag. Print Thing Tag


2013-11-24 Updated link to generator page (old webserver is offline)
2013-03-10 (V3) Added optional Name of Song on top/bottom of MusicCylinder; fixed build plate positioning of pulley that messed up smaller customized versions; cleanup and clarification of descriptions; implemented work around for customizer hickup when strings start with a '.'
2013-03-08 (V2) removed "work in progress status", fully test printed

It's very important to put the music box on a sounding box to get good sound quality. I found that large cardboard boxes and some tables make good sounding boxes. A guitar or a piano should work even better!

A complete music box consists of 6 parts:
Case: the large thin walled part that holds the vibrating teeth and holds everything together
Music Cylinder: the large cylinder with the pins (that encode the music) sticking out
Transmission gear: sits between the crank gear and the music cylinder
Crank gear: drives everything, connects to crank (insert it through the round hole in the case)
Crank: for manually driving the box, connects to crank gear and crank pulley
Pulley: for holding the crank while turning it

With the default parameters you get a complete building plate that can play one full octave range (13 half notes from C to C) in a medium footprint that should fit in most printers. You can enable each part individually to make smaller print plates.
I customized a "Frère Jacques" music cylinder that is compatible with the default parameters: thingiverse.com/thing:59242

How to adapt the snapping mechanisms
I printed this in PLA. So if you print it in ABS (or if your printer is differently calibrated than mine) you might have to adapt the snap fit:

If one of the gears are too hard to snap in you have to lower "crankAxisHolderH", "midAxisHolderH" or "musicAxisHolderH" depending on which gear causes the problem.

If one of the gears seem to sit too loose once they are snapped in you have to lower "snapAxisSlack"

Ways to get notes that you can then use in Customizer

1. Manual (read this anyway to understand how the music is encoded)
The "pins" variable contains characters that encode the pins on the music cylinder. These pins pluck long teeth that then vibrate and emit a certain note. The number of available different notes/vibrating teeth is given in "pinNrX". The number of time slots/length of the song is given by "pinNrY". For each time slot the "pins" string contains "pinNrX" many characters that determine if a pin should be generated for this specific note at this specific time slot. If the character is an 'X' there will be a pin (and the note will be played) any other character means: no pin. The actual frequency of the vibrating teeth are described in "teethNotes".

Be careful with long songs: If the pins are spaced too close together, i.e. if you try to fit a long song on a cylinder with small radius (derived from the number of teeth of the gear on the bottom of the music cylinder) then the closely spaced pins collide with the teeth and you hear a snare sound. While it's an interesting sound effect you generally want to avoid it by adapting the size of the music cylinder to the length of the song ("pinNrY"). For the default parameters I recommend at least 5mm distance from pin to pin. Tune this distance by adapting "musicCylinderTeeth".

A tip if you want to make a new Music Cylinder for an already printed music box: Don't change any other parameter except the "pins" and "pinNrY"! Well some other parameters can be changed but it's tricky...

2. JavaScript to generate the Pins-String
Stefan (the mentioned friend of mine) wrote this nice little JavaScript application for converting Tabs to the format described above. Here is an example of what I mean with tabs:

C4 E4 G4

try it out (sound output quality might vary from browser to browser) at:

For tuning the instrument you simply cut away material from the side of the vibrating tooth. Don't cut away material from the tip since that would change the way it interaction with the pin. If you want it to get a higher frequency remove material from the side of the tip (therefore making it lighter). If you want it lower the frequency remove material from the bottom (making it more flexible).

The gears I use are adapted versions of the ones made by emmett for his Automatic Transmission Gear Model so I added this as an ancestor. I really love this sharing of ideas on thingiverse :)

For calculating the lengths of the vibrating teeth I used the formulas from this Wikipedia article: de.wikipedia.org/wiki/Durchschlagende_Zunge#Berechnung_der_Tonh.C3.B6he (sorry it's in German). I don't think I chose the right material properties for PLA. But it sounds right to me at least relatively. To get exactly the right frequencies one would have to measure the real frequencies by somehow running a fourier transformation over an recording of the picked teeth. Then one could adapt the density and modulus parameter up or down and try again. A simple test cylinder would be one that just plays some notes sequentially so that we can make a recording for comparing the modeled to the measured frequencies. So I included such a test music cylinder (defined in the "Pins" and the "TeethNotes" default parameters) which just plays each note available and some accords.


You must be logged in to post a comment.

ShipwreckedMonkey on Mar 23, 2014 said:

I'd love to see you go on to put up a website of the 'enter a youtube url to download the mp3' kind, but instead it gives you an STL file that you can print, giving you the music on a cylinder. Old school piracy.

Mysterion on Jan 28, 2014 said:

I would love to make the xylophone notes to Gotye "Somebody I Used to Know" but am musically inclined :(

brandtemoller on Dec 1, 2013 said:

Really great design! :) I would like to print one myself with a custom tune, but it seems like the link to your website is down :(

wizard23 on Dec 1, 2013 said:

It was down I uploaded it to another website: http://magicshifter.net/musicb...

ThePelton on Nov 8, 2013 said:

Can you make it play a custom configured tune?

Aguamarina on Nov 6, 2013 said:

Hi!! It's an amazing idea and i really want to print one, with a special melody as a present for a good friend. The problem is that the links for customizing the melody are not working!! please help me! can you repare the links? or can anybody tell me any other way to find the parameters for a particular song??
Thanks a lot!!!

wizard23 on Nov 24, 2013 said:

My old server died :( But now I updated the first link and you can use it again :)

doghound678 on Oct 11, 2013 said:

can you put up a download for each individual part? i really want to print this, but my machine has problems with larger prints

frozensoda on Sep 7, 2013 said:

I don't understand how to make the songs with this. Can someone please link me to somewhere I can learn enough to make some zelda songs please?

n2ri on Aug 5, 2013 said:

did the music generator sites get shut down by the song police or what?

SwimmingNaked on May 13, 2013 said:

Every time I print this, the main chassis messes up...it works on printing the gears, then comes back at a higher Z-axis to print the rest of the chassis, which is too far away to adhere to where it last drew. this appears to be a problem in the gear area of the chassis.

cymon on May 12, 2013 said:

So the fit works just fine if you print in ABS because it all shrinks together, but the sound is crap and the pins don't last a day. Gonna try a PLA case in a bit. I suspect PLAs rigidity will work in it's favor with this one. Expect a writeup when I have more.

cymon on May 18, 2013 said:

PLA sounds much better and doesn't seem to crack as bad, tho that might be because I was turning the crank the wrong way at first over stressing the ABS tines.

r1one82 on May 2, 2013 said:

no its just bad!

Ktronik on Apr 11, 2013 said:

WOW bad arse!! One of the video above have it playing happy birthday...would you have a link for a printable version of that please sir??

wizard23 on Apr 11, 2013 said:

It's linked in the youtube video btw ;)

rahotep on Apr 6, 2013 said:

Can anyone do a 'Game of Thrones" theme sone in the customizer? I would,but I have several disadvantages:

1) don't have the sheet music.

2) couldn't read it if I did.

3) tin ear

It doens't have to be perfect, see #3, above.

I'm currently printing Winterfell (http://www.thingiverse.com/thi... and A little music to go with it would be perfect...

Ansarum on Apr 6, 2013 said:

Its Done! http://www.thingiverse.com/thi...

if you can please post a video of how it turned out still waiting for my printer to come in.

Ansarum on Apr 6, 2013 said:

actually yea! I will start the hunt and get one made... cus i want one too now lol

materialination on Mar 17, 2013 said:

We have planed to print it as soon as possible, props

GyroVolve on Mar 16, 2013 said:

Nice design! I've really wanted to print it out and I've tried twice, but for some reason it won't stop curling =\ anyway to fix?

wizard23 on Mar 16, 2013 said:

Are you printing PLA or ABS. I use PLA and it does not curl at all. With ABS you'll probably neet a heated build plate becaue it's quite big but I have not tried it out in ABS yet.

donb on Mar 16, 2013 said:

ha ha this is top shelf!

tbuser on Mar 13, 2013 said:

Feature request: for the web app that helps you generate the notes, add support for having multiple pins of the same note when there are multiple notes right after eachother and alternate the teeth between them. That would help prevent teeth that are too close together! For the mary had a little lamb box I made, I need to significantly increase the size of the cylinder to get the teeth spread out properly. (or manually go back and figure out the multiple pin notes idea)

wizard23 on Mar 17, 2013 said:

very good idea! that should allow for much longer songs, and it's rather easy to implement! It's on my list now :)

overflo on Mar 12, 2013 said:

I just saw this thing live, and it sounds really good when you put a resonator chamber like a shoebox underneath.
*awesome* ^-^

JMP on Mar 12, 2013 said:

I printed this out and it is even better than I had anticipated.
One suggestion for future development would be a bottom flat piece to set into. The walls by necessity are thin but they flex a lot when you turn the crank. A bottom piece could both give it some rigidity and make a sound board.

frankcarey on Mar 15, 2013 said:

I also had my one corner (across from the smallest "key") keep separating from the build platform (2/2 prints on makerbot replicator 2), so that would probably help there as well.

Christozer on Mar 12, 2013 said:

Suggestion...Hollow the cylinder out, that is so much plastic even at 10% infill. And it would take so much less time to print out and do the same freaking thing. "Optimize that plastic usage fool!" -Mr.T voice

wizard23 on Mar 12, 2013 said:

I should have noted that I use very sparse infill (10%) on the whole object on of course especially when you only print a cylinder. But this is a very good suggestion, I'll add it tonight :)

Greasetattoo on Mar 11, 2013 said:

Congrats on the WIN!

wizard23 on Mar 10, 2013 said:

I just added support for writing a name on the music cylinder :)

wizard23 on Mar 9, 2013 said:

I uploaded a video of it actually playing the first measures of the song "Frère Jacques": http://www.youtube.com/watch?v...
the Music Cylider was made with Customizer and can be found here: http://www.thingiverse.com/thi...

wizard23 on Mar 9, 2013 said:

Here is a video of it playing the song "Frère Jacques"

The music cylider I used in the video is here: http://www.thingiverse.com/thi...

yzorg on Mar 8, 2013 said:

awesome thing!
only thing i would change or add is a resonant chamber around the pins and maybe a amp Horn like the ones for iphones.

wizard23 on Mar 9, 2013 said:

for resonance I now put them on a big cardboard box. The seem to resonate much better than any table or other surface I found in my home. I have to confess I don't know to much about music so I don't really know how to construct a resonant chamber. Using an external chamber seems like the best way to me though because I could never print something as big as a cardboard box.

tbuser on Mar 8, 2013 said:

Hi, we just fixed the bug that was causing this script to fail to show a preview! Problem is, now that the preview is working, it's showing the music box really small. This is due to the way the preview image is generated and unfortunately we don't have a quick fix. It is caused by hidden geometry (often part of a difference operation) that is a shape that is really large. Although the shape can't be seen, it contributes to the zoom factor. So if you could adjust your design now that you can see it (!) to reduce that unseen geometry, that would rock. Also, you might want to use the multi stl output features of Customizer, see: http://customizer.makerbot.com...

Also, this is a really awesome script! I can't wait to print one myself.

wizard23 on Mar 8, 2013 said:

Wow! kthnx for this extremely quick customizer update! I totally understand what you say about the tiny build plate and I HAVE such huge difference blocks in there. so I will just clean up the code to make the perspective better ;)

drayde on Mar 8, 2013 said:

Awesome! Made my own little version now, now I just have to print it.
Note: in the version for printing, the crank touched another part, I had to move it a bit

wizard23 on Mar 8, 2013 said:

Guess you are the first one to try it out apart from me yet :)

Looks like you customized yours while I was changing the case design (and therefore had to move parts on the plate). Does your version's case have a gap where the music cylinder is? How easy or hard is it to exchange the cylinder or assemble the gear? Or did you change values like the wall or number of teeth and it overlapped?

Very curious to find out how it works for others :)

sahar88888 on Mar 8, 2013 said:

First of all, this is awesome. But I tries to customize it, and it says "error in line 824" EVERY TIME I TRY. How can i solve this? It doesn't let me generate an STL file!

wizard23 on Mar 8, 2013 said:

I would be interested: Does the generating of an STL file really not work for you or did you not ty this because of the error message? For me STL generation works...I'm working on getting the preview fixed...

wizard23 on Mar 8, 2013 said:

I know! that's what I wrote in the text above: customizer gives you this error message and no preview :( BUT it will still generate the STL correctly: I just "customized" the music box (with the default parameters) and it made the STL. Here it is: http://www.thingiverse.com/thi...

laszlo on Mar 8, 2013 said:

Whis is just mindblowing!

Schorhr on Mar 8, 2013 said:

Wow. Amazing!

bitflusher on Mar 8, 2013 said:

could you please upload a video?

wizard23 on Mar 8, 2013 said:

moar with the newer, more stable frame:

wizard23 on Mar 8, 2013 said:


this was the last iteration. currently working on the next with a much more stable case...

wizard23 on Mar 8, 2013 said:

working on it :)

Framingr on Mar 8, 2013 said:

Amazing stuff but looks like you may have an issue somewhere in the SCAD as customizer reports an error on line 367.