Closed masakakinoki closed 2 years ago
you are missing the "C1": cymbalSynth.triggerAttack("C1", time, 0.3);
On Sun, Nov 21, 2021 at 2:55 PM abirdwhale @.***> wrote:
This code (code A) is working: https://editor.p5js.org/abirdwhale/sketches/JzjyxlscM
let bassSynth, cymbalSynth; let counter;
function setup() { counter = 0;
bassSynth = new Tone.MembraneSynth().toDestination(); // cymbalSynth = new Tone.MetalSynth().toDestination();
loopBeat = new Tone.Loop(song, "8n");
Tone.Transport.bpm.value = 140; Tone.Transport.start(); loopBeat.start(1); }
function song(time) { bassSynth.triggerAttack("C1", time, 0.3); // cymbalSynth.triggerAttack(time, 0.3); }```
This code ( code B) is not working:https://editor.p5js.org/abirdwhale/sketches/wVFbFZxlx
let bassSynth, cymbalSynth; let counter; function setup() { counter = 0; // bassSynth = new Tone.MembraneSynth().toDestination(); cymbalSynth = new Tone.MetalSynth().toDestination(); loopBeat = new Tone.Loop(song, "8n"); Tone.Transport.bpm.value = 140; Tone.Transport.start(); loopBeat.start(1); } function song(time) { // bassSynth.triggerAttack("C1", time, 0.3); cymbalSynth.triggerAttack(time, 0.3); }``` Could anyone point out what's wrong with code B? Many thanks, Masa — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <https://github.com/Tonejs/Tone.js/issues/981>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAEYV4QRDGIH237Z7ASC3ZDUND24HANCNFSM5IPF4C6A> .
Oh, such a simple misunderstanding of how .triggerAttack ( ) works. Thank you, @dirkk0 !
I made the mistake because I was looking at the old document. https://tonejs.github.io/docs/r13/MetalSynth
I should have checked the latest document. https://tonejs.github.io/docs/14.7.77/MetalSynth
This code (code A) is working: https://editor.p5js.org/abirdwhale/sketches/JzjyxlscM This code ( code B) is not working: https://editor.p5js.org/abirdwhale/sketches/wVFbFZxlx
Could anyone point out what's wrong with code B?
Many thanks, Masa