我有下面的tone.js代码,它们使用脉冲波进行了一些微调。在调谐过程的中途,脉搏波的特性会改变,就像脉冲宽度已改变一样。为什么会发生这种情况,我该如何解决?
import Tone from 'tone';
let synth = {
PULSE1: new Tone.Synth({
oscillator: {
type: 'pulse',
width: 0.5
}
}).connect(Tone.Master)
}
let track = {
transport: {
bpm: 100
},
instruments: {
PULSE1: {
notes: [
['0:0:0','C4','16n', {}],
['0:0:1','D4','16n', {}],
['0:0:2','D#4','16n',{}],
['0:0:3','D4','16n', {}],
['0:0:4','C4','16n', {}],
['0:0:5','G3','16n', {}],
['0:0:6','C4','16n', {}],
['0:0:7','D4','16n', {}],
['0:0:8','D#4','16n', {}],
['0:0:9','C4','16n', {}],
['0:0:10','Bb3','16n', {}],
['0:0:11','C4','16n', {}],
['0:0:12','D#4','16n', {}],
['0:0:13','C4','16n', {}],
['0:0:14','F4','16n', {}],
['0:0:15','D4','16n', {}]
]
}
},
}
Tone.Transport.bpm.value = track.transport.bpm;
track.instruments.PULSE1.notes.forEach(note => {
let [when, frequency, duration, options] = note;
Tone.Transport.schedule(time => {
synth.PULSE1.triggerAttackRelease(frequency, duration, time);
}, when);
});
Tone.Transport.start();