Mozart's dice game: made with Codea on iPad, now available on the app store!

In 1792, Wolfgang Amadeus Mozart published a musical dice game (in German, ‘Musikalisches Wurfelspiel’) (K. 516f), which is a game by which one composes music via rolling dice. Mozart’s Dice Game uses 176 total measures written by Mozart specifically for his game, and 2 dice to determine which of those 176 measures to use in the final composition. Each finished composition consists of 16 measures, resulting in more than one trillion possible combinations.

The game can be played in 1 of 3 different ways:

A separate dice roll for each measure
Selecting all measures automatically
Selecting each measure individually
When complete, a composition can be saved or shared via a variety of social media.

Here’s the link:

If anyone wants, I can give out promo codes.

I bought it, I really like it!

very nice idea. i bought it too. Very polished little app.

@Eccfcco15, I loved the idea you had! I downloaded it and appreciated the way the game was presented.
I dare a couple of suggestions thou :

  • add some sound when you roll the dices and in general to all touch events
  • since it’s a music game, I believe you should play some music when in the menu screen
  • don’t really know how hard this can be, but it would be very cool if you could export the sequence to playback in third party players/programs with different sound sets ( sound sets would belong to third party apps such as garageband or similar, does this make any sense? ).

Interesting idea - I’ve brought it and I’ll have a play later.
Just a quick question, are you able to export your music into dropbox, especially if it could be exported into a format that is then playable back via Codea - sort of like a treat for other codea developers?

@Eccfcco15 - Had a play with the app, you might want to include a speed setting on the auto play - the animation of the sections sliding into place is a bit slow. Also I was wondering how you did the share button - any chance you can “share” :slight_smile: how it works.


Everyone, thanks for downloading it! I appreciate it. :slight_smile:

@deactive, thanks for the suggestions. I will do the music on the menu screen and click on the touch events. Exporting to a third party app may be a little harder. Do you want to export as an .mp3 or a .midi that can be imported to GarageBand?

@TechDojo, currently, the music is played with Codea’s sound(), and I specify pitch, etc. Would you like me to make it export as a .mp3, or .midi, or something else? Since it already plays with sound(), maybe I could make it export a .lua, with a function play() that plays the song?

For the SharingAddon, here is the source:

In SharingAddon.m, in shareWithMessage:andImage:, I have hardcoded the rect for the popover that shows the sharing options, so you might want to change that. I also have the code for sending the feedback email (main menu → settings → feedback) with the fullscreen popup, without having to leave the app. In addition, I have a print() function exposed to the lua runtime, that is just a wrapper for NSLog(). (I find it handy to use, when debugging with Xcode.) Don’t forget to register it in the AppDelegate viewDidLoad.

@Eccfcco15 - that’s fantastic thanks, as for the audio export - I was thinking of using any “good” tunes as backing music for future codea projects (in keeping with the whole - start to finish dev on an ipad thing) so either .mp3 export and or as a text file containing “notes” which could be then be included as a text asset with a codea library / function.

This a lot of fun! I sometimes had it miss the last couple of notes when playing the music.

I’d like to have the play button always there in manual mode, and could you make that mode unlimited in length?

One last comment: Mozart died in 1791, so I wonder if it was published by his wife. Easy to look up, I suppose…