musicpad tutorial

back to musicpad

OK, you heard about musicpad and you want to give it a try. But then you feel completely lost with the coding part. Here is your chance: a musicpad tutorial.

The musicpad idea was born when I stumbled on jens'polymath; I wanted to develop it further to fit my needs of a quick musical notepad that could reproduce your idea very quickly, and from any internet-connected computer. After the first basic version, many ideas came to me with additional commands, resulting in the musicpad you see now. But you don't need to know every command to use musicpad. I'll walk you through them one after the other, and everything will be clearer.

Notes

.

"I have a tune idea. Quick, I write down the notes names: ' C E G F eb c# c '". Well, that's exactly how you write notes down in musicpad:

Each note is separated with a whitespace (or a new line, or 50 whitespaces if you want, it doesn't matter). They can be written in uppercase or lowercase, as you which - musicpad is 99% not-case-sensitive.

Flat is indicated with 'b' or '-', sharp with '+' or '#'.

"Cool, but I want to add some timing to it". The first two notes should be quarter-notes (1/4), the G should be half-note (1/2) and the last notes 1/8th notes... In musicpad you add timing to a note by adding '/' and the timing. Easy ! (you note that the default duration is 1/4)

Another way to put in timing is using the '=' command, which means: play the previous note twice its initial duration. You can have multiple '=' for repeating the order. Note that you don't have to put whitespace around '='.

"OK. But the final 'C' should be one octave higher". You have two ways of doing it: adding the octave to the note just before the '/', like: 'C5/8' (read: C, octave 5, 1/8th note): (you note that the default octave is 4)

... or by putting in a '/' all alone before the note (meaning: ramp up one octave). The other command '\' (one octave down) also exists of course.

"OK, but it's a lot to write for a few notes..." Well, musicpad has an instant short-term memory, allowing you to be more elliptic in your writing. That means, if you don't indicate a paramater, musicpad uses the same as the previous note. So let's get rid of what musicpad doesn't need:

"How do I repeat exactly the same note ?" You can use the 'x' command :

"I need a pause somewhere" The pause command is 'P' , and you can optionnally indicate its length with '/..' like normal notes

you can use the '-' command for a pause of the same duration as the previous note:

Note that like the '=' command, you are not forced to use whitespaces around x and -

Be careful though with the '-' for flat and '-' for pause... 'C---' is interpreted as 'C flat then 2 pauses'.

Another shortcut: if you just specify a number alone, by default it's a duration (except in guitar or toms mode, but we'll see that later). For example, '12' alone means 'play the same note as before, but as 1/12'

Oh, and let's learn right now the tempo command to speed it all up... Tempo is 60 quarter notes per minutes by default, but you can change that easily (usually at song beginning):

OK, you're happy, you can write one-finger songs on the piano. Er, well, that's a start, right ?

Tracks and Instruments

Good news: with Musicpad you can have... more than one note playing at the same time ! And even on different instruments ! All that thanks to TRACKS.

Tracks are a way to say to Musicpad: "OK, now that you've played this, start over and play another instrument on top of it !".

Musicpad skip to the next track each time it encouters the | sign. Let's try it right away

What happened ? Well, we played C E G with one finger, and E G B with another finger. Kewl... but the sound is choppy, you can't hear all notes ? Let's try this:

Sounds better ? Well, that's because previously we used two tracks to play on the same midi channel... not advisable, sometimes midi doesn't handle it well. With the ch command, we indicate that the first track should be played on channel 1 (default channel), and second track should be played on channel 2. Think of it as indicating that we should have do different pianos & piano players to make sure all notes are played.

Wanna change instruments ? Sure, let's use the i command followed by the instrument number (check the help file to have a list of midi instruments codes). Let's use... an drawbar organ (17) and a nylon guitar (25):

There, the channel indication is really mandatory... If we had not indicated this, musicpad would have sent two "change to instrument x" orders on the same midi channel, resulting in midi only taking the latest order into account - we would have heard only one intrument playing two notes, probably the guitar.

Another cool feature of tracks is that you can indicate the track number you want to jump too by specifying a number right after the | - knowing that the first track is always number 1 (but you can use track 0 also if you want). Let's try this:

See the |1 in the middle ? Note that you could have obtained exactly the same result with: ch1 i17 C E G F E C | ch2 i25 E G B A G E... So what is it used for ? Well, for long songs, you might want to write the intro as a whole, then the first verse, then the chorus, etc... With "track jumping" you can do this easily. It is also useful when using macros.

However you have to remember the golden rule of tracks:

Each Track Is Independant From All Other Tracks

OK, what does that really mean ? Simply that you must not base your track timing on other tracks... and if you want synchronized tracks you have to adjust timing and duration yourself. Let's take an example:

What happened ? We added a fourth note to the first part of the second track, but not to the first part of the first track. Musicpad played each track independantly, so the second part of the second track is played one note later than the second part of the first track. It's perfectly OK with Musicpad... If this is really the result you want to get !

Want to add some drums ? Easy. The i command can also change to drum instruments (SD for Snare, BD for Kick, HH for HiHat, etc... check the help file to have a list of midi drums codes). What the iSD command really does is change midi channel to 10 (because for midi, Drums are played on channel 10) and select the correct default note for Snare Drum. Don't try to change that by indicating your own channel, you'd be surprised of the result. Don't specify the note either - a x is enough. Also, each drum instrument (Bass Drum, Snare Drum, HiHat) must have its own track. Let's take an example:

Cool, but slow. How to speed it up ? Well, indicate duration using the "number alone" shortcut is one way to do it... Another way is to use the o command; If you add an o to a note, that note will NOT be played, but its parameters will be remembered for the next notes. Let's turn our rythm to 1/16th notes:

OK, but how to repeat this rythm without copy/pasting code ? Well, that's the subject of the next part:

Structure

All music - especially modern music - use repetition of patterns, for rythm as well as for melody. With Musicpad you can deal with this using two commands:

The first is the * (star = multiply) command. For example, *4 means: repeat 4 times. Its use is twofold:

So... Let's take our rythm above and loop it !

One interesting feature of * is illustrated here: I don't need whitespaces for x- commands, so the *4 command repeats the whole -x-x-x-x string... I didn't have to use ( )...

Another very useful tool are MACROS with the m$ and $ commands. Macros are a set of commands that you ask musicpad to store in its memory, and that you can call very easily

To set a macro, use the m$name( ... ) syntax. You can specify whatever name you want for the macro - can be a letter, a digit, or a combination thereof.

To call a macro, use the $name command. A simple example:

Note that you can combine macros and repeats. Note also that macro names are case-sensitive.

A warning though: macros are neat, but tend to require more computation time. If your song relies very heavily on macros, you might end up with a "time-out error" - your browser telling you he thinks he's lost contact with the server which was too slow to answer...

Another usefull command... You can add comments to your song by using #. Everything after a # will be ignored until line end.

Now you have all elements in hand to begin to write your own tunes. But... where to begin ?

The structure of a song depend of the song itself. I'll illustrate below a musicpad code structure for a typical modern song.

Musicpad CodeComments
# My cool song
  • Name your song - in comment !
tempo70
  • First the general declarations - like tempo
#Instruments
  • Comment to structure the code
|0 iHH o/16 | iSD o/16 | iBD o/16
|5 ch1 i01 o4/16 | ch2 i34 o2/16

  • Instruments definitions. This is where I define what the tracks will be made of, starting with track 0. I have the habit of putting drums first, in drum tab reading order, then leave some space in case I want to add another drum instrument, then the other instruments starting on track 5, with specification of the midi channel to use.
    Note also the definition of default duration and octave.
# Macros

m$rythm(
|0 xxxxxxxxxxxxxxxx
|  --x---x---x---x-
|  x---x---x---x--- )

m$bass1( |6 E*16 )
m$bass2( |6 A*16 )

m$piano1( |5 (P G# G# G# A G# F# G#)*2 )
m$piano2( |5 (P G# G# G# A B / C# E \ )*2 )

  • Then the macros. Don't forget the closing )...
    To be useful each macro usually includes track information, to indicate where this is to be played.
    Drum patterns are a lot more readable when put on multiple lines with whitespaces to align everything.
    Note the repeat inside the 'piano' macros...
# Song Structure

$rythm*4 ($bass1 $bass2 $piano1 $piano2)*2

  • Then the song in itself. Repeats can of course be used.
    Macros can be specified in whatever order we want, it doesn't matter as each macro specifies the track to be used. The only thing is not to get lost in measure count.

Chords

How can you play chords in Musicpad ?

If you read carefully this tutorial, you already figured out that you can do it by adding tracks on top of tracks. If you want to be very precise in your complex chord playing, it's the only way to do it. However, if you're only looking for plain simple chords playing, Musicpad can do it for you.

Chords in Musicpad are indicated by brackets [...] with no whitespace inside the brackets. There are 4 different chord syntax available:

Want to change guitar tuning ? tuning[E3,A3,D4,G4,B4,E5] defines guitar tuning to be used for all guitar chords. Watch out though, if you change the tuning and play a standard guitar chord on top of it, you might end up with surprises...

You noted that the guitar chords example above are... not sounding like a guitar. That's because when you play a real guitar chord, notes are not played each at the same time - you strum the strings one after the others. Well, Musicpad can do that too, using the strum command ! The idea is to have a delay between chord notes, and also the possibility to define a minimum time delay that can trigger an "upstrike" strumming, where notes are played in reverse order and possibly at another level. struma,b,c uses up to 3 parameters:

For a rythm guitar try strum10,300,80 : i25 o/16 strum10,300,80 [g:Amin]*16

You can also use this for any other instrument: i25 o/2 strum100 [Amin]*4

Advanced Commands

There are some other commands we haven't talked about yet.

First the "figure only" command... Remember, I told you if your command is only one figure (like: 8), musicpad uses it as a new duration (1/8) to play the same as previous note. Well, there are two other modes that you can activate track by track to change that: