Page 1 of 1

Resampling problem (Audio plays too slow)

Posted: Sat Feb 03, 2018 11:21 pm
by Franky666
Hello,

how can I manage to get Pure-Basic to play an audio file in the correct speed, if the sample rate of the audio file doesn't match the one used in the settings of the sound card?

Here is a snipped:

Code: Select all

initSound()
LoadSound(0, "audio.wav")
PlaySound(0)
Debug GetSoundFrequency(0)
Delay(5000)
Specs of audio.wav:
- 16-bit signed integer
- PCM
- 48000 Hz
- Stereo

My sound card is system-widely set to 44100 Hz (the sample rate setting in PulseAudio). Everything else that has to do with audio, works great on my computer.

If I run the snipped, the file plays way too slow (actually at 44100 Hz instead of 48000 Hz). There is no real-time resampling. Instead of resampling, the file is just slowed don to 44100 Hz.

The audio file plays fine in all other players installed on the same system.

How do I play it at the correct speed?

I tried SetSoundFrequency(0,48000) but it did nothing?

The opposite method, GetSoundFrequency(), delivers -17536 (a negative value :? So it should play backwards... that is nonsence value :shock: :mrgreen: )

Appendix: I'm on Linux Mint 18.1 (x64)

Re: Resampling problem (Audio plays too slow)

Posted: Sun Feb 11, 2018 9:07 pm
by Franky666
It's been dealt with.

I made a replacement using SDL and that is working fine. :mrgreen: