Build your first
beat
From empty file to full arrangement — drums, 808, melody, and structure — in about 30 lines of MusicScript.
Save your work as a .gms file and run it in the studio or from the CLI.
Set up the project
Every .gms file starts with a project block. This sets the global BPM, key, and time signature for everything that follows.
project "First Beat" {
bpm: 140
key: Dm
time: 4/4
}140 BPM and D minor is a good starting point for hip-hop and trap. You can change these at any time — the rest of your file inherits them automatically.
Program the drums
The beat block defines a one-bar pattern. This example uses a 16-step grid in 4/4. Each row is one instrument. X = hit, . = rest, digits 1–9 = velocity (softer hits).
beat main {
kick: [X . . . . . . . X . . . . . . .]
snare: [. . . . X . . . . . . . X . . .]
hihat: [X 7 X 7 X 7 X 7 X 7 X 7 X 7 X 7]
}Reading left to right, each of the 16 slots is a 16th note. The kick lands on beats 1 and 3, the snare on 2 and 4 — classic boom-bap. The hi-hat alternates full and softer hits (velocity 7). Velocity changes loudness; swing changes timing.
Add the 808
Add an 808 row inside the same beat block using pitched hits. The format is Note+Octave:Length, where length is in 16th notes.
beat main {
kick: [X . . . . . . . X . . . . . . .]
snare: [. . . . X . . . . . . . X . . .]
hihat: [X 7 X 7 X 7 X 7 X 7 X 7 X 7 X 7]
808: [D1:4 F1:4 A1:4 Bb1:4]
}D1:4 is a D in octave 1 held for 4 16th notes (one beat). D → F → A → Bb follows notes from D minor. Each pitched hit expands to four grid slots, so these four hits fill one 16-step bar.
Write a melody
The melody block sequences notes on a synthesizer. Pick an instrument and list notes in order.
melody hook {
instrument: juno106
notes: [D4:2 .:2 F4:2 A4:4 G4:2 F4:2 D4:2]
velocity: 0.75
fx: [reverb(0.35) delay(0.214, 0.4)]
}A bare dot is a one-sixteenth rest; .:2 explicitly rests for two sixteenths. This melody totals one 4/4 bar. Reverb and delay (about an eighth-note echo at 140 BPM, 40% wet) give the hook space without crowding the drums.
Build the structure
Use section to define named parts (intro, verse, chorus) and structure to arrange them in order.
section intro {
bars: 4
play: [main]
}
section verse {
bars: 8
play: [main hook]
}
section drop {
bars: 8
play: [main hook]
}
structure [intro verse x2 drop verse drop]verse x2 repeats the verse twice. This example keeps one tempo so it can also be prepared for Desktop’s network MusicScript adapter. Native CLI playback supports checked section tempo changes; network following does not.
The complete file
Put it all together. Save this as first-beat.gms and open it in the studio to hear it play.
project "First Beat" {
bpm: 140
key: Dm
time: 4/4
}
beat main {
kick: [X . . . . . . . X . . . . . . .]
snare: [. . . . X . . . . . . . X . . .]
hihat: [X 7 X 7 X 7 X 7 X 7 X 7 X 7 X 7]
808: [D1:4 F1:4 A1:4 Bb1:4]
}
melody hook {
instrument: juno106
notes: [D4:2 .:2 F4:2 A4:4 G4:2 F4:2 D4:2]
velocity: 0.75
fx: [reverb(0.35) delay(0.214, 0.4)]
}
section intro {
bars: 4
play: [main]
}
section verse {
bars: 8
play: [main hook]
}
section drop {
bars: 8
play: [main hook]
}
structure [intro verse x2 drop verse drop]Check it, play it, then join a session
gms check first-beat.gms --engine native --target export
gms play first-beat.gms --engine native
gms export first-beat.gms --engine native -o first-beat.wavFor shared playback, open the score in Desktop, join Go Meow Server, and select MusicScript under Follow with engine. Each participant needs a local copy. The host starts the transport; re-arm after editing. CLI playback remains local.
Live-session setup →