Version: March 20, 2004
Contents:
Description
The nesmus language allows a musician to compose or transcribe music for the NES in a programming language that resembles sheet music in form. It accomodates the 4 NES sound channels, over a 6 octave range. It also allows definition of tempo in beats per minute, and note lengths in terms of the current tempo. Additionally, it has support for musical loops.
Your game is expected to run at 30 frames per second and update the music loop once per frame. The nesmus language internally uses fractional time values and will play your notes on the closest frame to their actual time, so that your music, when played back, is timed as accurately as possible.
NES Music Channels: The nesmus application is command-line only. Learn how to use the command line on your operating system. Windows users will have to download
Using nesmus Data in Your Game (for programmers):
Include the file
0: square wave 1
1: square wave 2
2: triangle wave
3: noise channel
cygwin1.dll
in order to use nesmus. The dll can be downloaded from Bob Rost's NES development webpage.
nesmus.bas
in your nbasic game. This top of this file contains comments that describe important usage notes. Look at the source of the example provided with nesmus. You can change the build script to use main2.bas
for a demo of detecting the ends of songs and swapping between two of them.
txxx
| Tempo change. xxx (1-3 digits) is the beats per minute of a quarter note. |
vxx
| Volume change. xx is the volume level (0-15)
Note that on the square wave channels, a volume in the range 16-31 will actually alter the degree of "pong" in the sound, rather than the volume. |
ox
| Absolute octave change. x is the octave number (0-6) |
>
| Relative octave change. Raise the current octave by 1 |
<
| Relative octave change. Lower the current octave by 1 |
lx
| Current note length change, which affects the following notes until the next note length change. Valid x values are 1,2,4,8, and 16, to specify whole note, half note, quarter note, 1/8 note, and 1/16 note. |
px
| Rest (pause). The value of x (1,2,4,8, or 16) specifies how long to rest, the same as for the note length change. |
cdefgab
| Play the specified note in the current octave, with the current length. |
#
| Placed directly after a note, makes it sharp. |
-
| Placed directly after a note, makes it flat. |
.
| Dot a note. When placed after a note (including after the sharp or flat), it extends the note's length by 50%. |
channel x
| Signal that the following music commands apply to channel x, which must be 0, 1, 2, or 3. It is not necessary to use all 4 channels in a song. |
loop x
| Start a music loop. The value x must be in the range 1 to 255. The loop command must be on a line by itself. You may not nest loops within each other, but you may have parts for all four channels defined inside the loop. |
end
| End the current music loop. |
;
| Starting a line with a semicolon turns that line into a comment. You can write notes for yourself or anyone else reading the music source, and the language will not try to interpret it. |
Start Music Loop
End Music Loop
Note Data
|