doomjs / opl3

OPL3 emulator
19 stars 5 forks source link

Realtime playback rate #2

Open SyntaxErrol opened 6 years ago

SyntaxErrol commented 6 years ago

I was looking into playing some original Adlib tracks on the web, DOSBox .DRO dumps from Adlib Tracker II. The results seem accurate and very promising but I have an issue where the realtime playback is too slow. Not choppy or anything, just lower pitch and tempo and this seems to be the case across Edge, Firefox and Chrome on Windows desktop as well as Firefox on Android.

Changing the sampleRate option doesn't seem to have an effect on realtime playback while rendering to .WAV, a setting of 48000 sounds about the same as what I'm hearing in the browsers live. So, the playback seems to be capped at 48kHz and a 49700Hz source will end up being played too slow. Am I missing something, is there a way around this?

doomjs commented 6 years ago

Hi @SyntaxErrol, you are using the JavaScript way to generate the WAV file? Like in the simple.html example? Set the sampleRate option to 49700 to create a WAV file with 49700Hz sample rate here. Browsers and audio players are then playing the file at the given sample rate. The CLI tool doesn't support custom sample rates. It's fixed to 48kHz.

SyntaxErrol commented 6 years ago

I'm not generating a file but using the webaudio.html template for realtime playback.