timidity icon indicating copy to clipboard operation
timidity copied to clipboard

Tempo and pitch on Windows/Android

Open nwsw opened this issue 5 years ago • 1 comments

Some platforms/systems use a sampleRate of 48000. This results in faster, higher pitched play back. The fix is to use the sampleRate from the audio context:

_loadSong(midiBuf) {
	const optsPtr = this._lib._mid_alloc_options(
		this._audioContext.sampleRate || DEFAULT_SAMPLE_RATE,
		AUDIO_FORMAT,
		NUM_CHANNELS,
		BUFFER_SIZE
	)

nwsw avatar Dec 08 '20 11:12 nwsw

I saw this too in bitmidi.com and another site that used this API.

I never thought the results of browser code would be OS-dependent.

DoomTay avatar Dec 11 '20 20:12 DoomTay