Resampling problem (Audio plays too slow)

Linux specific forum
User avatar
Franky666
User
User
Posts: 17
Joined: Wed Jan 09, 2008 10:43 pm
Location: Germany

Resampling problem (Audio plays too slow)

Post 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)
User avatar
Franky666
User
User
Posts: 17
Joined: Wed Jan 09, 2008 10:43 pm
Location: Germany

Re: Resampling problem (Audio plays too slow)

Post by Franky666 »

It's been dealt with.

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