Fix wavetables breaking after playback
This commit is contained in:
parent
e7578be6c5
commit
95700e1196
4 changed files with 24 additions and 9 deletions
|
|
@ -61,17 +61,25 @@ export async function renderPatternAudio(pattern, cps, begin, end, sampleRate, d
|
|||
|
||||
let haps = pattern.queryArc(begin, end, { _cps: cps });
|
||||
|
||||
await Promise.all(haps.map(async (hap) => {
|
||||
if (hap.hasOnset()) {
|
||||
await superdough(hap2value(hap), hap.whole.begin.valueOf() / cps, hap.duration, cps, hap.whole?.begin.valueOf());
|
||||
}
|
||||
}));
|
||||
await Promise.all(
|
||||
haps.map(async (hap) => {
|
||||
if (hap.hasOnset()) {
|
||||
await superdough(
|
||||
hap2value(hap),
|
||||
hap.whole.begin.valueOf() / cps,
|
||||
hap.duration,
|
||||
cps,
|
||||
hap.whole?.begin.valueOf(),
|
||||
);
|
||||
}
|
||||
}),
|
||||
);
|
||||
logger('[webaudio] start rendering');
|
||||
|
||||
return audioContext
|
||||
.startRendering()
|
||||
.then((renderedBuffer) => {
|
||||
console.log('downloading')
|
||||
console.log('downloading');
|
||||
const wavBuffer = audioBufferToWav(renderedBuffer);
|
||||
const blob = new Blob([wavBuffer], { type: 'audio/wav' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue