Merge remote-tracking branch 'origin/main' into codemirror-6

This commit is contained in:
Felix Roos
2022-04-25 22:32:49 +02:00
18 changed files with 280 additions and 245 deletions
+2 -2
View File
@@ -44,8 +44,8 @@ export const markEvent = (editor) => (time, event) => {
//Tone.Transport.schedule(() => { // problem: this can be cleared by scheduler...
setTimeout(() => {
marks.forEach((mark) => mark.clear());
// }, '+' + event.duration * 0.5);
}, event.duration /* * 0.9 */ * 1000);
// }, '+' + event.duration.valueOf() * 0.5);
}, event.duration.valueOf() /* * 0.9 */ * 1000);
};
let parenMark;
+1 -1
View File
@@ -45,7 +45,7 @@ async function playStatic(code) {
if (!onTrigger) {
if (defaultSynth) {
const note = getPlayableNoteValue(event);
defaultSynth.triggerAttackRelease(note, event.duration, time, velocity);
defaultSynth.triggerAttackRelease(note, event.duration.valueOf(), time, velocity);
} else {
throw new Error('no defaultSynth passed to useRepl.');
}
+57 -55
View File
@@ -5,16 +5,16 @@ export const timeCatMini = `stack(
)`;
export const timeCat = `stack(
timeCat([3, c3], [1, stack(eb3, g3, cat(c4, d4).slow(2))]),
cat(c2, g2),
sequence(
timeCat([5, eb4], [3, cat(f4, eb4, d4)]),
cat(eb4, c4).slow(2)
timeCat([3, c3], [1, stack(eb3, g3, seq(c4, d4).slow(2))]),
seq(c2, g2),
seq(
timeCat([5, eb4], [3, seq(f4, eb4, d4)]),
seq(eb4, c4).slow(2)
).slow(4)
)`;
export const shapeShifted = `stack(
sequence(
seq(
e5, [b4, c5], d5, [c5, b4],
a4, [a4, c5], e5, [d5, c5],
b4, [r, c5], d5, e5,
@@ -24,7 +24,7 @@ export const shapeShifted = `stack(
b4, [b4, c5], d5, e5,
c5, a4, a4, r,
).rev(),
sequence(
seq(
e2, e3, e2, e3, e2, e3, e2, e3,
a2, a3, a2, a3, a2, a3, a2, a3,
gs2, gs3, gs2, gs3, e2, e3, e2, e3,
@@ -36,16 +36,16 @@ export const shapeShifted = `stack(
).rev()
).slow(16)`;
export const tetrisWithFunctions = `stack(sequence(
'e5', sequence('b4', 'c5'), 'd5', sequence('c5', 'b4'),
'a4', sequence('a4', 'c5'), 'e5', sequence('d5', 'c5'),
'b4', sequence(silence, 'c5'), 'd5', 'e5',
'c5', 'a4', 'a4', silence,
sequence(silence, 'd5'), sequence(silence, 'f5'), 'a5', sequence('g5', 'f5'),
'e5', sequence(silence, 'c5'), 'e5', sequence('d5', 'c5'),
'b4', sequence('b4', 'c5'), 'd5', 'e5',
'c5', 'a4', 'a4', silence),
sequence(
/* export const tetrisWithFunctions = `stack(seq(
'e5', seq('b4', 'c5'), 'd5', seq('c5', 'b4'),
'a4', seq('a4', 'c5'), 'e5', seq('d5', 'c5'),
'b4', seq(r, 'c5'), 'd5', 'e5',
'c5', 'a4', 'a4', r,
seq(r, 'd5'), seq(r, 'f5'), 'a5', seq('g5', 'f5'),
'e5', seq(r, 'c5'), 'e5', seq('d5', 'c5'),
'b4', seq('b4', 'c5'), 'd5', 'e5',
'c5', 'a4', 'a4', r),
seq(
'e2', 'e3', 'e2', 'e3', 'e2', 'e3', 'e2', 'e3',
'a2', 'a3', 'a2', 'a3', 'a2', 'a3', 'a2', 'a3',
'g#2', 'g#3', 'g#2', 'g#3', 'e2', 'e3', 'e2', 'e3',
@@ -55,10 +55,10 @@ export const tetrisWithFunctions = `stack(sequence(
'b1', 'b2', 'b1', 'b2', 'e2', 'e3', 'e2', 'e3',
'a1', 'a2', 'a1', 'a2', 'a1', 'a2', 'a1', 'a2',
)
).slow(16)`;
).slow(16)`; */
export const tetris = `stack(
cat(
seq(
"e5 [b4 c5] d5 [c5 b4]",
"a4 [a4 c5] e5 [d5 c5]",
"b4 [~ c5] d5 e5",
@@ -68,7 +68,7 @@ export const tetris = `stack(
"b4 [b4 c5] d5 e5",
"c5 a4 a4 ~"
),
cat(
seq(
"e2 e3 e2 e3 e2 e3 e2 e3",
"a2 a3 a2 a3 a2 a3 a2 a3",
"g#2 g#3 g#2 g#3 e2 e3 e2 e3",
@@ -98,14 +98,14 @@ export const tetrisMini = `\`[[e5 [b4 c5] d5 [c5 b4]]
[[a1 a2]*4]\`.slow(16)
`;
export const whirlyStrudel = `sequence(e4, [b2, b3], c4)
export const whirlyStrudel = `seq(e4, [b2, b3], c4)
.every(4, fast(2))
.every(3, slow(1.5))
.fast(slowcat(1.25, 1, 1.5))
.every(2, _ => sequence(e4, r, e3, d4, r))`;
.fast(cat(1.25, 1, 1.5))
.every(2, _ => seq(e4, r, e3, d4, r))`;
export const swimming = `stack(
cat(
seq(
"~",
"~",
"~",
@@ -124,7 +124,7 @@ export const swimming = `stack(
"A5 [F5@2 C5] [D5@2 F5] F5",
"[C5@2 F5] [Bb5 A5 G5] F5@2"
),
cat(
seq(
"[F4,Bb4,D5] [[D4,G4,Bb4]@2 [Bb3,D4,F4]] [[G3,C4,E4]@2 [[Ab3,F4] [A3,Gb4]]] [Bb3,E4,G4]",
"[~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, Bb3, D3] [F3, Bb3, D3]] [~ [F3, Bb3, Db3] [F3, Bb3, Db3]]",
"[~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, Bb3, D3] [F3, Bb3, D3]] [~ [F3, B3, D3] [F3, B3, D3]]",
@@ -143,7 +143,7 @@ export const swimming = `stack(
"[~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, Bb3, D3] [F3, Bb3, D3]] [~ [F3, B3, D3] [F3, B3, D3]]",
"[~ [F3, Bb3, D4] [F3, Bb3, D4]] [~ [F3, Bb3, C4] [F3, Bb3, C4]] [~ [F3, A3, C4] [F3, A3, C4]] [~ [F3, A3, C4] [F3, A3, C4]]"
),
cat(
seq(
"[G3 G3 C3 E3]",
"[F2 D2 G2 C2]",
"[F2 D2 G2 C2]",
@@ -167,38 +167,38 @@ export const swimming = `stack(
export const giantSteps = `stack(
// melody
cat(
seq(
"[F#5 D5] [B4 G4] Bb4 [B4 A4]",
"[D5 Bb4] [G4 Eb4] F#4 [G4 F4]",
"Bb4 [B4 A4] D5 [D#5 C#5]",
"F#5 [G5 F5] Bb5 [F#5 F#5]",
),
// chords
cat(
seq(
"[B^7 D7] [G^7 Bb7] Eb^7 [Am7 D7]",
"[G^7 Bb7] [Eb^7 F#7] B^7 [Fm7 Bb7]",
"Eb^7 [Am7 D7] G^7 [C#m7 F#7]",
"B^7 [Fm7 Bb7] Eb^7 [C#m7 F#7]"
).voicings(['E3', 'G4']),
// bass
cat(
seq(
"[B2 D2] [G2 Bb2] [Eb2 Bb3] [A2 D2]",
"[G2 Bb2] [Eb2 F#2] [B2 F#2] [F2 Bb2]",
"[Eb2 Bb2] [A2 D2] [G2 D2] [C#2 F#2]",
"[B2 F#2] [F2 Bb2] [Eb2 Bb3] [C#2 F#2]"
)
).slow(20);`;
).slow(20)`;
export const giantStepsReggae = `stack(
// melody
cat(
seq(
"[F#5 D5] [B4 G4] Bb4 [B4 A4]",
"[D5 Bb4] [G4 Eb4] F#4 [G4 F4]",
"Bb4 [B4 A4] D5 [D#5 C#5]",
"F#5 [G5 F5] Bb5 [F#5 [F#5 ~@3]]",
),
// chords
cat(
seq(
"[B^7 D7] [G^7 Bb7] Eb^7 [Am7 D7]",
"[G^7 Bb7] [Eb^7 F#7] B^7 [Fm7 Bb7]",
"Eb^7 [Am7 D7] G^7 [C#m7 F#7]",
@@ -207,7 +207,7 @@ export const giantStepsReggae = `stack(
.struct("~ [x ~]".fast(4*8))
.voicings(['E3', 'G4']),
// bass
cat(
seq(
"[B2 D2] [G2 D2] [Eb2 Bb2] [A2 D2]",
"[G2 Bb2] [Eb2 F#2] [B2 F#2] [F2 Bb2]",
"[Eb2 Bb2] [A2 D2] [G2 D2] [C#2 F#2]",
@@ -220,13 +220,13 @@ export const transposedChordsHacked = `stack(
"c2 eb2 g2",
"Cm7".voicings(['g2','c4']).slow(2)
).transpose(
slowcat(1, 2, 3, 2).slow(2)
cat(1, 2, 3, 2).slow(2)
).transpose(5)`;
export const scaleTranspose = `stack(f2, f3, c4, ab4)
.scale(sequence('F minor', 'F harmonic minor').slow(4))
.scaleTranspose(sequence(0, -1, -2, -3).slow(4))
.transpose(sequence(0, 1).slow(16))`;
.scale(seq('F minor', 'F harmonic minor').slow(4))
.scaleTranspose(seq(0, -1, -2, -3).slow(4))
.transpose(seq(0, 1).slow(16))`;
export const struct = `stack(
"c2 g2 a2 [e2@2 eb2] d2 a2 g2 [d2 ~ db2]",
@@ -239,9 +239,9 @@ export const magicSofa = `stack(
.every(2, fast(2))
.voicings(),
"<c2 f2 g2> <d2 g2 a2 e2>"
).slow(1).transpose(slowcat(0, 2, 3, 4))`;
).slow(1).transpose(cat(0, 2, 3, 4))`;
// below doesn't work anymore due to constructor cleanup
// ).slow(1).transpose.slowcat(0, 2, 3, 4)`;
// ).slow(1).transpose.cat(0, 2, 3, 4)`;
export const confusedPhone = `"[g2 ~@1.3] [c3 ~@1.3]"
.superimpose(
@@ -251,8 +251,8 @@ export const confusedPhone = `"[g2 ~@1.3] [c3 ~@1.3]"
transpose(12).late(0.3),
transpose(24).late(0.4)
)
.scale(slowcat('C dorian', 'C mixolydian'))
.scaleTranspose(slowcat(0,1,2,1))
.scale(cat('C dorian', 'C mixolydian'))
.scaleTranspose(cat(0,1,2,1))
.slow(2)`;
export const zeldasRescue = `stack(
@@ -340,7 +340,7 @@ stack(
export const callcenterhero = `const bpm = 90;
const lead = polysynth().set({...osc('sine4'),...adsr(.004)}).chain(vol(0.15),out())
const bass = fmsynth({...osc('sawtooth6'),...adsr(0.05,.6,0.8,0.1)}).chain(vol(0.6), out());
const s = scale(slowcat('F3 minor', 'Ab3 major', 'Bb3 dorian', 'C4 phrygian dominant').slow(4));
const s = scale(cat('F3 minor', 'Ab3 major', 'Bb3 dorian', 'C4 phrygian dominant').slow(4));
stack(
"0 2".struct("<x ~> [x ~]").apply(s).scaleTranspose(stack(0,2)).tone(lead),
"<6 7 9 7>".struct("[~ [x ~]*2]*2").apply(s).scaleTranspose("[0,2] [2,4]".fast(2).every(4,rev)).tone(lead),
@@ -379,7 +379,7 @@ stack(
`;
export const xylophoneCalling = `const t = x => x.scaleTranspose("<0 2 4 3>/4").transpose(-2)
const s = x => x.scale(slowcat('C3 minor pentatonic','G3 minor pentatonic').slow(4))
const s = x => x.scale(cat('C3 minor pentatonic','G3 minor pentatonic').slow(4))
const delay = new FeedbackDelay(1/8, .6).chain(vol(0.1), out());
const chorus = new Chorus(1,2.5,0.5).start();
stack(
@@ -412,7 +412,8 @@ stack(
"~ <c3!7 [c3 c3*2]>".tone(noise().chain(vol(0.8),out())),
// hihat
"c3*4".transpose("[-24 0]*2").tone(metal(adsr(0,.02)).chain(vol(0.5).connect(delay),out()))
).slow(1)`;
).slow(1)
// strudel disable-highlighting`;
export const sowhatelse = `// mixer
const mix = (key) => vol({
@@ -448,7 +449,8 @@ stack(
"~ c3".tone(instr('snare')),
"<[c1@5 c1] <c1 [[c1@2 c1] ~] [c1 ~ c1] [c1!2 ~ c1!3]>>".tone(instr('kick')),
"[2,4]/4".scale('D dorian').apply(t).tone(instr('pad')).mask("<x x x ~>/8")
).fast(6/8)`;
).fast(6/8)
// strudel disable-highlighting`;
export const barryHarris = `backgroundImage(
'https://media.npr.org/assets/img/2017/02/03/barryharris_600dpi_wide-7eb49998aa1af377d62bb098041624c0a0d1a454.jpg',
@@ -481,7 +483,7 @@ const rhodes = await sampler({
}, 'https://loophole-letters.vercel.app/')
const bass = synth(osc('sawtooth8')).chain(vol(.5),out())
const scales = sequence('C major', 'C mixolydian', 'F lydian', ['F minor', slowcat('Db major','Db mixolydian')]).slow(4)
const scales = cat('C major', 'C mixolydian', 'F lydian', ['F minor', cat('Db major','Db mixolydian')])
stack(
"<bd sn> <hh hh*2 hh*3>"
@@ -500,12 +502,12 @@ stack(
.tone(bass),
).fast(3/2)`;
export const wavyKalimba = `const delay = new FeedbackDelay(1/3, .5).chain(vol(.2), out());
export const wavyKalimba = `const delay = new FeedbackDelay(1/3, .5).chain(vol(.2), out())
let kalimba = await sampler({
C5: 'https://freesound.org/data/previews/536/536549_11935698-lq.mp3'
})
kalimba = kalimba.chain(vol(0.6).connect(delay),out());
const scales = sequence('C major', 'C mixolydian', 'F lydian', ['F minor', 'Db major']).slow(4);
const scales = cat('C major', 'C mixolydian', 'F lydian', ['F minor', 'Db major'])
stack(
"[0 2 4 6 9 2 0 -2]*3"
@@ -573,7 +575,7 @@ stack(
chords.voicings().struct("x(3,8,-1)").velocity(.5).off(1/7,x=>x.transpose(12).velocity(.2)),
chords.rootNotes(2).struct("x(4,8,-2)"),
chords.rootNotes(4)
.scale(slowcat('C minor','F dorian','G dorian','F# mixolydian'))
.scale(cat('C minor','F dorian','G dorian','F# mixolydian'))
.struct("x(3,8,-2)".fast(2))
.scaleTranspose("0 4 0 6".early(".125 .5")).layer(scaleTranspose("0,<2 [4,6] [5,7]>/4"))
).slow(2)
@@ -581,7 +583,7 @@ stack(
.tone((await piano()).chain(out()))`;
export const festivalOfFingers2 = `const chords = "<Cm7 Fm7 G7 F#7 >";
const scales = slowcat('C minor','F dorian','G dorian','F# mixolydian')
const scales = cat('C minor','F dorian','G dorian','F# mixolydian')
stack(
chords.voicings().struct("x(3,8,-1)").velocity(.5).off(1/7,x=>x.transpose(12).velocity(.2)),
chords.rootNotes(2).struct("x(4,8)"),
@@ -638,7 +640,7 @@ stack(
).cpm(78).slow(4).pianoroll()
`;
export const goodTimes = `const scale = slowcat('C3 dorian','Bb2 major').slow(4);
export const goodTimes = `const scale = cat('C3 dorian','Bb2 major').slow(4);
stack(
"2*4".add(12).scale(scale)
.off(1/8,x=>x.scaleTranspose("2")).fast(2)
@@ -708,7 +710,7 @@ export const speakerman = `backgroundImage('https://external-content.duckduckgo.
{ className:'darken', style:'background-size:cover'})
stack(
"[g3,bb3,d4] [f3,a3,c4] [c3,e3,g3]@2".slow(2).late(.1),
slowcat(
cat(
'Baker man',
'is baking bread',
'Baker man',
@@ -738,7 +740,7 @@ bell = bell.chain(vol(0.6).connect(delay),out());
.add(rand.range(0,12))
.velocity(rand.range(.5,1))
.legato(rand.range(.4,3))
.scale(slowcat('D minor pentatonic')).tone(bell)
.scale(cat('D minor pentatonic')).tone(bell)
.stack("<D2 A2 G2 F2>".euclidLegato(6,8,1).tone(bass.toDestination()))
.slow(6)
.pianoroll({minMidi:20,maxMidi:120,background:'transparent'})`;
@@ -768,7 +770,7 @@ export const hyperpop = `const lfo = cosine.slow(15);
const lfo2 = sine.slow(16);
const filter1 = x=>x.filter('lowpass', lfo2.range(300,3000));
const filter2 = x=>x.filter('highpass', lfo.range(1000,6000)).filter('lowpass',4000)
const scales = slowcat('D3 major', 'G3 major').slow(8)
const scales = cat('D3 major', 'G3 major').slow(8)
const drums = await players({
bd: '344/344757_1676145-lq.mp3',
@@ -819,7 +821,7 @@ export const festivalOfFingers3 = `"[-7*3],0,2,6,[8 7]"
.legato(sine.range(.5,2).slow(8))
.velocity(sine.range(.4,.8).slow(5))
.echo(4,1/12,.5))
.scale(slowcat('D dorian','G mixolydian','C dorian','F mixolydian'))
.scale(cat('D dorian','G mixolydian','C dorian','F mixolydian'))
.legato(1)
.slow(2)
.tone((await piano()).toDestination())
+25 -27
View File
@@ -15,7 +15,8 @@ The best place to actually make music with Strudel is the [Strudel REPL](https:/
To get a taste of what Strudel can do, check out this track:
<MiniRepl tune={`const delay = new FeedbackDelay(1/8, .4).chain(vol(0.5), out());
<MiniRepl
tune={`const delay = new FeedbackDelay(1/8, .4).chain(vol(0.5), out());
const kick = new MembraneSynth().chain(vol(.8), out());
const snare = new NoiseSynth().chain(vol(.8), out());
const hihat = new MetalSynth().set(adsr(0, .08, 0, .1)).chain(vol(.3).connect(delay),out());
@@ -195,14 +196,14 @@ Internally, the mini notation will expand to use the actual functional JavaScrip
Notes are automatically available as variables:
<MiniRepl tune={`sequence(d4, fs4, a4)`} />
<MiniRepl tune={`seq(d4, fs4, a4)`} />
An important difference to the mini notation:
For sharp notes, the letter "s" is used instead of "#", because JavaScript does not support "#" in a variable name.
The above is the same as:
<MiniRepl tune={`sequence('d4', 'f#4', 'a4')`} />
<MiniRepl tune={`seq('d4', 'f#4', 'a4')`} />
Using strings, you can also use "#".
@@ -220,38 +221,35 @@ Most of the time, you won't need that function as input values of pattern creati
### cat(...values)
The given items are con**cat**enated spread evenly over one cycle:
The given items are con**cat**enated, where each one takes one cycle:
<MiniRepl tune={`cat(e5, b4, d5, c5)`} />
<MiniRepl tune={`cat(e5, b4, [d5, c5])`} />
The function **fastcat** does the same as **cat**.
- Square brackets will create a subsequence
- The function **slowcat** does the same as **cat**.
### sequence(...values)
### seq(...values)
Like **cat**, but allows nesting with arrays:
Like **cat**, but the items are crammed into one cycle:
<MiniRepl tune={`sequence(e5, [b4, c5], d5, [c5, b4])`} />
<MiniRepl tune={`seq(e5, b4, [d5, c5])`} />
- Synonyms: **fastcat**, **sequence**
### stack(...values)
The given items are played at the same time at the same length:
<MiniRepl tune={`stack(g3,b3,e4)`} />
<MiniRepl tune={`stack(g3, b3, [e4, d4])`} />
### slowcat(...values)
Like cat, but each item has the length of one cycle:
<MiniRepl tune={`slowcat(e5, b4, d5, c5)`} />
<!-- ## slowcatPrime ? -->
- Square Brackets will create a subsequence
### Nesting functions
You can nest functions inside one another:
<MiniRepl
tune={`slowcat(
tune={`cat(
stack(g3,b3,e4),
stack(a3,c3,e4),
stack(b3,d3,fs4),
@@ -283,7 +281,7 @@ Plays the given items at the same time, within the same length:
We can write the same with **stack** and **cat**:
<MiniRepl tune={`stack(cat(e3, g3), cat(e4, g4, b4))`} />
<MiniRepl tune={`stack(seq(e3, g3), seq(e4, g4, b4))`} />
You can also use the shorthand **pr** instead of **polyrhythm**.
@@ -295,7 +293,7 @@ The following functions modify a pattern.
Like "/" in mini notation, **slow** will slow down a pattern over the given number of cycles:
<MiniRepl tune={`cat(e5, b4, d5, c5).slow(2)`} />
<MiniRepl tune={`seq(e5, b4, d5, c5).slow(2)`} />
The same in mini notation:
@@ -305,19 +303,19 @@ The same in mini notation:
Like "\*" in mini notation, **fast** will play a pattern times the given number in one cycle:
<MiniRepl tune={`cat(e5, b4, d5, c5).fast(2)`} />
<MiniRepl tune={`seq(e5, b4, d5, c5).fast(2)`} />
### early(cycles)
With early, you can nudge a pattern to start earlier in time:
<MiniRepl tune={`cat(e5, b4.early(0.5))`} />
<MiniRepl tune={`seq(e5, b4.early(0.5))`} />
### late(cycles)
Like early, but in the other direction:
<MiniRepl tune={`cat(e5, b4.late(0.5))`} />
<MiniRepl tune={`seq(e5, b4.late(0.5))`} />
<!-- TODO: shouldn't it sound different? -->
@@ -325,19 +323,19 @@ Like early, but in the other direction:
Will reverse the pattern:
<MiniRepl tune={`cat(c3,d3,e3,f3).rev()`} />
<MiniRepl tune={`seq(c3,d3,e3,f3).rev()`} />
### every(n, func)
Will apply the given function every n cycles:
<MiniRepl tune={`cat(e5, "b4".every(4, late(0.5)))`} />
<MiniRepl tune={`seq(e5, "b4".every(4, late(0.5)))`} />
<!-- TODO: should be able to do b4.every => like already possible with fast slow etc.. -->
Note that late is called directly. This is a shortcut for:
<MiniRepl tune={`cat(e5, "b4".every(4, x => x.late(0.5)))`} />
<MiniRepl tune={`seq(e5, "b4".every(4, x => x.late(0.5)))`} />
<!-- TODO: should the function really run the first cycle? -->
@@ -612,7 +610,7 @@ Turns numbers into notes in the scale (zero indexed). Also sets scale for other
<MiniRepl
tune={`"0 2 4 6 4 2"
.scale(slowcat('C2 major', 'C2 minor').slow(2))`}
.scale(seq('C2 major', 'C2 minor').slow(2))`}
/>
Note that the scale root is octaved here. You can also omit the octave, then index zero will default to octave 3.
+4 -1
View File
@@ -37,11 +37,14 @@ function useRepl({ tune, defaultSynth, autolink = true, onEvent, onDraw: onDrawP
(time, event, currentTime) => {
try {
onEvent?.(event);
if (event.context.logs?.length) {
event.context.logs.forEach(pushLog);
}
const { onTrigger, velocity } = event.context;
if (!onTrigger) {
if (defaultSynth) {
const note = getPlayableNoteValue(event);
defaultSynth.triggerAttackRelease(note, event.duration, time, velocity);
defaultSynth.triggerAttackRelease(note, event.duration.valueOf(), time, velocity);
} else {
throw new Error('no defaultSynth passed to useRepl.');
}