Skip to content

Commit

Permalink
Merge pull request #237 from tidalcycles/tidal-drum-machines
Browse files Browse the repository at this point in the history
Tidal drum machines
  • Loading branch information
felixroos committed Oct 31, 2022
2 parents ae6da0d + caf5849 commit 3741ffb
Show file tree
Hide file tree
Showing 6 changed files with 4,889 additions and 2,297 deletions.
16 changes: 16 additions & 0 deletions packages/core/controls.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,22 @@ const generic_params = [
'attack',
'a pattern of numbers to specify the attack time (in seconds) of an envelope applied to each sample.',
],

/**
* Select the sound bank to use. To be used together with `s`. The bank name (+ "_") will be prepended to the value of `s`.
*
* @name bank
* @param {string | Pattern} bank the name of the bank
* @example
* s("bd sd").bank('RolandTR909') // = s("RolandTR909_bd RolandTR909_sd")
*
*/
[
'f',
'bank',
'selects sound bank to use',
],

// TODO: find out how this works?
/*
* Envelope decay time = the time it takes after the attack time to reach the sustain level.
Expand Down
4 changes: 4 additions & 0 deletions packages/webaudio/webaudio.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ export const webaudioOutput = async (hap, deadline, hapDuration) => {
let {
freq,
s,
bank,
sf,
clip = 0, // if 1, samples will be cut off when the hap ends
n = 0,
Expand Down Expand Up @@ -281,6 +282,9 @@ export const webaudioOutput = async (hap, deadline, hapDuration) => {
gain *= velocity; // legacy fix for velocity
// the chain will hold all audio nodes that connect to each other
const chain = [];
if (bank && s) {
s = `${bank}_${s}`;
}
if (typeof s === 'string') {
[s, n] = splitSN(s, n);
}
Expand Down
33 changes: 33 additions & 0 deletions repl/public/piano.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"piano": {
"A0": "A0v8.mp3",
"C1": "C1v8.mp3",
"Ds1": "Ds1v8.mp3",
"Fs1": "Fs1v8.mp3",
"A1": "A1v8.mp3",
"C2": "C2v8.mp3",
"Ds2": "Ds2v8.mp3",
"Fs2": "Fs2v8.mp3",
"A2": "A2v8.mp3",
"C3": "C3v8.mp3",
"Ds3": "Ds3v8.mp3",
"Fs3": "Fs3v8.mp3",
"A3": "A3v8.mp3",
"C4": "C4v8.mp3",
"Ds4": "Ds4v8.mp3",
"Fs4": "Fs4v8.mp3",
"A4": "A4v8.mp3",
"C5": "C5v8.mp3",
"Fs5": "Fs5v8.mp3",
"A5": "A5v8.mp3",
"C6": "C6v8.mp3",
"Ds6": "Ds6v8.mp3",
"Fs6": "Fs6v8.mp3",
"A6": "A6v8.mp3",
"C7": "C7v8.mp3",
"Ds7": "Ds7v8.mp3",
"Fs7": "Fs7v8.mp3",
"A7": "A7v8.mp3",
"C8": "C8v8.mp3"
}
}

0 comments on commit 3741ffb

Please sign in to comment.