diff --git a/Tone/core/context/OfflineContext.ts b/Tone/core/context/OfflineContext.ts index 1a43c8ebd..9e7e9ebf2 100644 --- a/Tone/core/context/OfflineContext.ts +++ b/Tone/core/context/OfflineContext.ts @@ -2,6 +2,7 @@ import { createOfflineAudioContext } from "../context/AudioContext"; import { Context } from "../context/Context"; import { Seconds } from "../type/Units"; import { isOfflineAudioContext } from "../util/AdvancedTypeCheck"; +import { ToneAudioBuffer } from "./ToneAudioBuffer"; /** * Wrapper around the OfflineAudioContext @@ -91,10 +92,11 @@ export class OfflineContext extends Context { * Render the output of the OfflineContext * @param async If the clock should be rendered asynchronously, which will not block the main thread, but be slightly slower. */ - async render(asynchronous: boolean = true): Promise { + async render(asynchronous: boolean = true): Promise { await this.workletsAreReady(); await this._renderClock(asynchronous); - return this._context.startRendering(); + const buffer = await this._context.startRendering(); + return new ToneAudioBuffer(buffer); } /** diff --git a/test/helper/Offline.ts b/test/helper/Offline.ts index 341456f79..042ee8050 100644 --- a/test/helper/Offline.ts +++ b/test/helper/Offline.ts @@ -28,7 +28,7 @@ export async function Offline( } setContext(originalContext); const buffer = await offline.render(); - return new TestAudioBuffer(buffer); + return new TestAudioBuffer(buffer.get() as AudioBuffer); } export function whenBetween(value: Seconds, start: Seconds, stop: Seconds, callback: () => void): void {