Skip to content

Commit

Permalink
add documentation for metatune
Browse files Browse the repository at this point in the history
  • Loading branch information
ahihi committed Mar 27, 2024
1 parent 5c67db3 commit 9000664
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/reference/harmony_melody.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,22 @@ A chord is inverted by taking the lowest N notes in a chord, and raising them by
```haskell
d1 $ n "c'min9'i2" # sound "superpiano"
```

## Pitched sample playback

By default, SuperDirt treats all samples as having a pitch of C4 (MIDI note 60). Playing a sample tonally is simple as long the sound is indeed a C. But what if not?

### metatune

It is possible to embed pitch metadata in WAV files in the form of a [smpl chunk](https://www.recordingblogs.com/wiki/sample-chunk-of-a-wave-file). This is used by some samplers to automatically map samples to MIDI notes. SuperDirt also reads the pitch metadata for all loaded samples, allowing them to be pitched correctly (assuming the metadata is correct) by setting the `metatune` parameter to 1.

For example, the sample `bass1:18` from Dirt-Samples is an F2 (MIDI note 41) and is tagged with the appropriate pitch metadata. With `metatune`, we can easily play it in tune with a superpiano chord:

```haskell
d1 $ stack
[ note "<d4 c4 a3 bf3>" # s "bass1:18" # legato 1 # metatune 1
, note "[~ d5'min'o]*4" # s "superpiano" # release 0.4
] # cps 0.35
```

Smpl chunk metadata can be edited with various tools such as [pitcheon](https://github.com/ahihi/pitcheon) or [LoopAuditioneer](https://loopauditioneer.sourceforge.io/).

0 comments on commit 9000664

Please sign in to comment.