# `TuningFork.Gm`
[🔗](https://github.com/jaman/tuning_fork/blob/v0.1.11/tuning_fork/lib/tuning_fork/gm.ex#L1)

Voices for General MIDI's instrument and drum numbers.

    Gm.for_program(33, base)

# `family`

```elixir
@type family() ::
  :struck
  | :organ
  | :guitar
  | :bass
  | :strings
  | :brass
  | :reed
  | :pipe
  | :lead
  | :pad
  | :other
```

# `drum_notes`

```elixir
@spec drum_notes() :: [0..127]
```

The percussion note numbers `drums/1` answers to, ascending.

# `drums`

```elixir
@spec drums(number()) :: %{required(0..127) =&gt; TuningFork.Voice.t()}
```

A drum kit, as a map from General MIDI note number to voice.

`gain` scales the whole kit; no voice exceeds a gain of 1.0. `drum_notes/0` lists the
numbers covered.

# `family`

```elixir
@spec family(0..127) :: family()
```

Which family a program number belongs to. Programs 96 to 127 are `:other`.

# `for_program`

```elixir
@spec for_program(0..127, TuningFork.Voice.t()) :: TuningFork.Voice.t()
```

A voice for a General MIDI program number, derived from `base`.

The shape, cutoff and envelope are set from the program's `family/1`; every other field of
`base` is kept. A program in the `:other` family returns `base` unchanged.

# `score`

```elixir
@spec score(TuningFork.Midi.t(), keyword()) :: TuningFork.Score.t()
```

A whole MIDI file as a score, with an instrument chosen for every channel.

A channel is played with the voice for the last program it selected. Channels named as
percussion by `:drum_channels` are played from `drums/1` by note number, and are guessed
unless stated.

    "song.mid" |> TuningFork.Midi.read!() |> Gm.score() |> Score.render(44_100)

## Options

  * `:base` — the voice every instrument is derived from, and what an unnamed channel
    plays. Default a filtered saw
  * `:gain` — level per note, default 0.2. Used only when `:base` is not given
  * `:drum_gain` — the kit's level against everything else, default 1.0
  * `:plain` — one voice for everything, ignoring the program changes, default false
  * anything `TuningFork.Midi.to_score/2` takes — `:bpm`, `:drum_channels`, `:quantize`,
    `:bend_range`, `:bend_points`, `:beats`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
