Skip to content

Latest commit

 

History

History
281 lines (192 loc) · 6.13 KB

File metadata and controls

281 lines (192 loc) · 6.13 KB

Tutorial: make your first beat

This tutorial teaches you Minim. You start with an empty file. You finish with a beat that plays and that you can change while it plays.

The tutorial takes about 20 minutes. Do the steps in order. Every step works.

This tutorial does not show every option. The reference shows every option. A first lesson teaches less than the full set on purpose.

Before you start

You need the minim program. If you built Minim yourself, the program is at target/release/minim.exe.

You need speakers or headphones. You do not need a MIDI controller.

Step 1: make a sound

Make a new file. Call it first.minim. Put one line in it:

kick = drums "bd*4"

Save the file. Now run this command:

minim first.minim

Minim prints a report and writes first.wav next to your file. Play that file. You hear four kick drums.

That one line does three things:

  • kick is the name of the part. You choose this name.
  • drums says that this part plays the drum kit.
  • "bd*4" is the pattern. bd is the bass drum. *4 plays it four times in the bar.

Step 2: add a second part

Add a second line to the file:

kick = drums "bd*4"
hats = drums "hh*16"

Run the command again. Now you hear a kick and 16 hi-hats.

Each part is one layer. Minim plays every part at the same time.

The hats are too loud. Step 3 fixes that.

Step 3: change how a part sounds

Put a block after the pattern. A block holds settings:

kick = drums "bd*4"
hats = drums "hh*16" { level 0.3 }

Run the command again. The hats are quieter now.

level is a setting. It takes a number from 0 to 2. The settings reference lists every setting.

A block can hold more than one setting. Put each setting on its own line when the block gets long:

hats = drums "hh*16" {
  level 0.3
  tune  4
  drop  0.15
}

tune moves the pitch up by 4 semitones. drop removes 15% of the hits, so the part does not sound mechanical.

Step 4: set the tempo

Add a tempo at the top of the file:

tempo 125

kick = drums "bd*4"
hats = drums "hh*16" {
  level 0.3
  tune  4
  drop  0.15
}

The tempo is in beats per minute. Minim uses 120 when you do not set one.

Put tempo at the top. Minim accepts it anywhere, but the top is where a reader looks.

Step 5: add a snare

A snare on beats 2 and 4 makes the bar feel like a song.

snare = drums "~ sd ~ sd"

The pattern has four steps. A space separates each step. ~ is a rest, which means silence. sd is the snare drum.

Add the line to your file and run the command again.

Step 6: play a bass line

Drums are not the only part. A notes part plays the synthesiser.

bass = notes "<a1 a2 d1 d2>" {
  wave   saw
  length 0.4
}

<a1 a2 d1 d2> plays one note in each bar, in turn. a1 is the note A in octave 1.

wave saw chooses the shape of the sound. length 0.4 makes each note short, so the notes do not run into each other.

Your file now looks like this:

tempo 125

kick  = drums "bd*4"
snare = drums "~ sd ~ sd"
hats  = drums "hh*16" {
  level 0.3
  tune  4
  drop  0.15
}
bass  = notes "<a1 a2 d1 d2>" {
  wave   saw
  length 0.4
}

Run the command. You have a beat.

Step 7: make a mistake on purpose

Change bd to bx:

kick = drums "bx*4"

Run the command. Minim does not write a file. It prints this:

error: `bx` is not a drum
 --> first.minim:3:16
  |
3 | kick  = drums "bx*4"
  |               ^^ did you mean `bd`?

Minim never plays a script that it does not understand. A mistake stops the whole script. You always know what went wrong and where.

Change bx back to bd.

Step 8: play while you edit

So far you made a file and listened to it. Now play the script live:

minim first.minim --live

The beat starts. Leave the program running.

Open the file in your editor. Change tempo 125 to tempo 132. Save the file.

The tempo changes on the next bar. You did not stop the music.

Now make a mistake. Change level to levl. Save the file.

Minim prints the error and keeps playing. A mistake never stops the sound.

Fix the mistake and save again. Minim reloads.

Press Enter to stop.

Step 9: name a sound

Your hats block has three numbers in it. If you want the same hats in another script, you must copy those numbers. A preset gives them a name instead.

Add a preset above your parts. The = drums says what it plays:

preset tight = drums {
  level 0.3
  tune  4
  drop  0.15
}

Now write the preset where drums used to go:

preset tight = drums { level 0.3  tune 4  drop 0.15 }

hats = tight "hh*16"

Run the command. Nothing changed in the sound. The file is shorter and the sound has a name.

A preset is an instrument that you made. drums and notes are the two that Minim gives you.

Step 10: add a dial

A preset can offer a dial. A dial changes several settings at the same time.

Change the preset:

preset tight = drums {
  level 0.3
  tune  4
  drop  0.15

  knob loose = 0.3 {
    drop  0.0 .. 0.4
    swing 0.0 .. 0.3
  }
}

Now turn the dial. A dial goes in the block, like any other setting:

preset tight = drums {
  level 0.3
  knob loose = 0.3 { drop 0.0 .. 0.4  swing 0.0 .. 0.3 }
}

hats = tight "hh*16" { loose 0.8 }

A knob runs from 0 to 1. At 0 the hats are straight and complete. At 1 the hats lose many hits and shuffle hard. One number moves both settings the correct way.

Run the command with loose 0.0 and then with loose 0.8. Listen to the difference.

What you learned

You can now:

  • make a part with drums or notes
  • write a pattern with *, ~ and < >
  • change a part with a settings block
  • set the tempo
  • read an error message
  • play a script and edit it at the same time
  • make your own instrument with preset
  • offer a dial with knob

What to do next