Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add documentation for metatune #267

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/).
Loading