0

I am currently writing a small C# .Net Forms program that is based on the XMPlayer and also uses its functions.

For this I use the library ManagedBass and ManagedBass.Fx. Everything works fine so far, but I noticed that most of my songs are pitched down a bit and played slower and after a while I found out that the frequency (sampling rate) of the audio files is responsible for that.

A frequency higher than 44100 will play at a lower pitch and slower and a frequency lower than that will play faster and in a higher pitch. The Bass Stream of the library doesn't seem to regulate this automatically and I haven't found a parameter for it.

Now my question is what can be done about it. I don't like to change to another library.

Here is my initializing code:

try { if (Handle != 0) Bass.StreamFree(Handle); }
catch { }

Bass.Init();

int h = Bass.CreateStream(FileName, 0, 0, BassFlags.Decode | BassFlags.Default);

if (h == 0) return false;

int tStream = BassFx.TempoCreate(h, BassFlags.Default | BassFlags.FxFreeSource);

if (tStream == 0) return false;
Handle = tStream;

Bass.ChannelPlay(Handle);

I have tried all kinds of BassFlags, but nothing helped. Changing the frequency of one audio file to 44100Hz fixed the problem, but only for that one audio file and that can't be a solution as other media players can play all kinds of audio file frequencies.

Thanks in advance!

Zongo
  • 11
  • 1

0 Answers0