diff --git a/docs/reference/harmony_melody.md b/docs/reference/harmony_melody.md index 7751c66d9..c41e05286 100644 --- a/docs/reference/harmony_melody.md +++ b/docs/reference/harmony_melody.md @@ -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 "" # 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/).