MusicalBoxMasquerade from Phantom

I’ve been meaning to code this catchy tune played on the automaton in Phantom for some time, and finally got around to doing it today.
I used 14 samples from musical boxes and arranged access to give continuous note from midi notes 50 to 103. I also added a sample of tehemusical box being wound up before it starts to play, and adjust it to slow down as the spring unwound and fade out. The tune is quite short and here repeats 6 times but you can adjust that as you like.

So that you can download the samples I have put it on github.

You can also listen to the end result below


Listening to this makes me happy.

I think the fade out makes it sound less realistic. The slight slowdown is very good but real music boxes don’t play the notes softer as they slow down.

Thanks for your comments. There is an option in the program to disable the fade if you wish. EDIT Oops, sorry hadn’t added it in the repos. I’ve now added it to the repository and disabled the fadeout by default as I agree with you it is more normal behaviour. In fact when I developed the program I started with just the fade out, and then added the windup and the slowing down later.
I think I’ll update the recording on soundcloud shortly to reflect this as well.

Now added new version with no fade (user adjustable) to the github repository

Here’s what it sounds like:


Nice sampling work, Robin. The recording sounds beautiful. I agree that the second version emulates the behavior of a musical box more realistically.

This is lovely. Did you record the samples yourself?

Recorded individual notes from a muscial box I had, tidied them up, identified the notes and the saved them. Interpolated to allow range of notes to be selected and played as per the code in the piece. Did the samples some years ago so cant remember the full details.

Oh nice - if you were to consider releasing the samples under a CC0 licence we could think about including them within Sonic Pi and building a helper function to allow the full range of notes to be easily played…

1 Like