crunker icon indicating copy to clipboard operation
crunker copied to clipboard

fix: check equipment sampleRate

Open noxxxxxxxx opened this issue 5 years ago • 2 comments

iPhone and other morden equipments will use higher sampleRate: 48000 , if still use the default sampleRate to concat the audio file '.wav' or '.mp3', the sounds of the merged file isn't as same as the origin file.

I have tested on windows pc ,iMac, some android and iPhone devices, only iMac can use the default 44100 sample rate to concat file with origin sounds

this._context.sampleRate echo 48000 in other devices.

noxxxxxxxx avatar Jul 25 '20 04:07 noxxxxxxxx

I was going to say that I don't think that is simple as that, because this._sampleRate should correspond to the source's sample rate and the device where the result audio will be played should not be relevant to the merge/concat functions... BUT, doing the this._context.decodeAudioData(buffer) after fetching the audio, the buffer is resampled to the AudioContext's sampling rate, so the sample rate of the source shouldn't matter and should use the this._context.sampleRate instead of using a different sample rate with this._sampleRate.

Also, doing this should resolve the auto detecting the sample rate mentioned here. I didn't test yet.

Alynva avatar Jul 25 '20 18:07 Alynva

@noxxxxxxxx Are you able to change the code so that the context sampleRate is used as suggested by @Alynva and see if that fixes the issues across the different devices?

jaggad avatar Jul 27 '20 00:07 jaggad