# Make your first song

This exercise makes an eight-bar song with drums, bass and piano, then writes a WAV, a MIDI file and a score preview. It uses the `dawn` command in Terminal.

## Install DAWN

On a Mac, [download DAWN](https://dawnav.com/install). The app needs macOS 13 or newer on a Mac with Apple Silicon, and the `dawn` command comes inside it:

1. Open the downloaded ZIP and move DAWN to your Applications folder.
2. Open DAWN and choose **Install dawn command**. It links `~/.local/bin/dawn` to the command inside the app.
3. In Terminal, check it:

```sh
dawn --version
```

The app keeps itself up to date. Composing, checking and rendering work offline and need no account; the demo songs download the first time you open them.

### Linux, or the command alone

A script installs `dawn` without the app, on Linux or macOS with Bun 1.3.14 or newer. It needs the GitHub CLI logged in to an account with read access to `hraness/dawn`, which is a private repository. Check that access:

```sh
gh repo view hraness/dawn --json name
```

The installer is attached to the repository’s releases. Read it before running it:

```sh
gh release download --repo hraness/dawn --pattern install.sh -O install-dawn.sh
less install-dawn.sh
sh install-dawn.sh
dawn --version
```

It verifies the release archive against its checksums and build attestation, then installs DAWN under your local application directory.

## Create a project

```sh
mkdir first-light
cd first-light
dawn init
```

Open the generated `song.ts` and replace its contents with this complete score:

```ts
import { pattern, progression, seq, song, track } from "dawn";

export default song({
  tempo: 120,
  meter: [4, 4],
  bars: 8,
  key: "A minor",
  sections: [
    { name: "Verse", startBar: 0, bars: 4 },
    { name: "Chorus", startBar: 4, bars: 4 },
  ],
  tracks: [
    track({ name: "Drums", instrument: "kit", rhythm: pattern("house") }),
    track({
      name: "Bass",
      instrument: "bass",
      notes: seq("A1 . A1 . F1 . G1 . A1 . A1 . F1 . G1 .", {
        step: 2,
        len: 0.7,
      }),
    }),
    track({
      name: "Keys",
      instrument: "piano",
      notes: progression("i VI III VII i VI III VII", { key: "A minor" }),
    }),
  ],
});
```

The score uses beats for note positions and zero-based bars for section starts. A period in `seq()` is a rest.

## Check and render

```sh
dawn check
dawn render first-light.wav --measure
dawn render first-light.mid
dawn render first-light.score.json --title "First light" --artist "DAWN"
```

A successful check reports the track and note counts. The WAV command prints the output file and measured loudness. Open `first-light.wav` in an audio player, import the MIDI file into another music tool, or read the score JSON to inspect the notes and sections in seconds.

If checking reports a file and line, fix that source location and run `dawn check` again. A failed check leaves the authored files in place.

Try changing the bass notes or tempo, then repeat the check and render. The [SDK reference](/docs/sdk) explains the builders; the [agent guide](/docs/agents) describes the same loop for a coding agent.
