2 Reference
This is a reference of all features currently available in Tuplet. As a quick reminder, a "oneshot" is either a note, tuplet, pattern, or polyrhythm.
2.1 Definition Forms
2.1.1 Defining Oneshots
syntax
(let name-or-pattern let-binding-expr)
name-or-pattern = id | pattern let-binding-expr = oneshot | call-notefn oneshot = id | tuplet | pattern | polyrhythm tuplet = (beats oneshot ...) pattern = (oneshot ...+) polyrhythm = (: pattern ...+) call-notefn = (notefn args ...) notefn = load | pitch | stretch | reverse | resample | set-chop
beats : positive-rational?
If pattern binding, the chop? flag on the resulting notes will always be set to #t. To change a note’s chop? flag to #f, use set-chop.
2.1.2 Defining Tracks
syntax
(track name bpm measure ...+)
name = id measure = tuplet oneshot = id | tuplet | pattern | polyrhythm tuplet = (beats oneshot ...) pattern = (oneshot ...+) polyrhythm = (: pattern ...+)
bpm : positive-rational?
beats : positive-rational?
2.2 Note Functions
2.2.1 Loading Notes
procedure
(load filepath [ #:in in #:out out #:chop? chop?]) → note? filepath : path-string? in : (or/c nonnegative-integer? false?) = #f out : (or/c nonnegative-integer? false?) = #f chop? : boolean? = #t
The path is relative to the current file, which means "." and ".." can be used to represent the current folder and the parent folder, respectively.
If in/out points are provided, the audio is clipped from the beginning/end by that number of samples (yes, samples). Any in/out points set to #f default to the beginning/end of the clip, respectively.
The chop? argument defines whether to allow clips to play over each other, or extend into otherwise silent parts, such as during empty tuplets or once the track is over. Setting this to false is not recommended, and is very prone to audio peaking and clipping.
Note 1: Some programs (such as FL Studio) export a WAV file that rsound, the audio library used by Tuplet, has trouble reading.
Note 2: By default, rsound resamples and remixes audio to 2-channel stereo with a 44.1kHz sample rate. Be aware of this limitation when working with Tuplet.
2.2.2 Note Manipulation
All of these functions result in a copy of the input note that can be bound. The original note will remain unchanged.
procedure
(reverse note) → note?
note : note?
procedure
(pitch note semitones [cents]) → note?
note : note? semitones : rational? cents : rational? = 0
Note: ffmpeg must be installed, on PATH, and compiled with librubberband for use of this function. For more information, refer to the README.md file.
procedure
(stretch note factor) → note?
note : note? factor : positive-rational?
Note: ffmpeg must be installed, on PATH, and compiled with librubberband for use of this function. For more information, refer to the README.md file.
procedure
(resample note factor) → note?
note : note? factor : positive-rational?
2.3 Export Expressions
procedure
track : track-assembly? filepath : path-string? = "./"
This function will always try to overwrite the file at filepath, if one already exists.