Skip to content
This repository

Getting Started 

ccampbell edited this page · 6 revisions
Clone this wiki locally

This tutorial walks you through making your first chiptune.
First make sure that you have installed mmlx and that you have Nestopia installed.

  1. On your computer create a directory named mmlx and a directory named mml
  2. Make sure that Nestopia is set up as the default application to open .nsf files
  3. 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

  4. Create a new file at mmlx/myfirstchiptune.mmlx:

    #TITLE My First Chiptune
    #COMPOSER Your Name
    #PROGRAMER Your Name
    
  5. Save the file

  6. In your terminal window you should see something like this:
    Screen shot

  7. 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
    
  8. 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.

  9. 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.

  10. Save the file. The NSF should be generated and should open with Nestopia. At this point you should finally hear some music.

  11. 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
    
  12. 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:

    #X-TRANSPOSE -2
    
  13. 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:
https://github.com/ccampbell/mmlx/blob/master/files/mmlx/myfirstchiptune.mmlx

You can view the generated MML file here:
https://github.com/ccampbell/mmlx/blob/master/files/mml/myfirstchiptune.mml

You can listen to the final song here:
http://f.cl.ly/items/3A2N1U02463o0s3p2Z2c/myfirstchiptune.mp3

Something went wrong with that request. Please try again.