This tutorial walks you through making your first chiptune.
First make sure that you have installed mmlx and that you have Nestopia installed.
From your terminal run the following command:
mmlx --watch path/to/mmlx:path/to/mml --open-nsf --create-mml 1
Make sure that you use relative paths here
Create a new file at mmlx/myfirstchiptune.mmlx:
#TITLE My First Chiptune #COMPOSER Your Name #PROGRAMER Your Name
Save the file
In your terminal window you should see something like this:
You will see the generated MML file and NSF file in the mml directory. Also the file should open automatically in Nestopia, but there is nothing to play. Let's go ahead and create a few instruments by adding the following to mmlx/myfirstchiptune.mmlx:
/** * Instruments */ square-wave-piano: adsr: 0 10 10 30 timbre: 2 guitar: max_volume: 12 adsr: 0 10 7 30 timbre: 0 bass: vibrato: 2 4 4 drum: volume: 10 8 6 4 2 0 q: 4
Save the file. If you look at mml/myfirstchiptune.mml you will notice that it hasn't changed. This is because instruments are only generated in the mml file when they are used in your song. This allows you to create a big list of instruments and include it with every mmlx file you make without having to worry about clogging up your generated mml files.
Let's set the tempo to 110 BPM and add our first voice on the pulse wave channel A:
ABCD t110 // pulse wave channel A o4 @square-wave-piano c d e f g a b > d c1
The @square-wave-piano declaration is telling this voice to use that instrument.
Save the file. The NSF should be generated and should open with Nestopia. At this point you should finally hear some music.
Let's go ahead and add the rest of the voices:
// pulse wave channel B o3 @guitar e f g a b > c d f e1 // triangle wave channel C o4 @bass c1 g1 c2 // noise channel D @drum e [f16]4 f8 e f8 f f f8 e8 [f32]8 f
Save the file and you are done! Now this song is in C major... what if you wanted it to be in Bb major instead? Easy. You can add the following line at the top of the file underneath the
#PROGRAMER Your Name line:
Save the file again. You will notice that it is now transposed down a step!
Congratulations on making your first chiptune.
You can view the final MMLX file here:
You can view the generated MML file here:
You can listen to the final song here: