0
0

Hi ! I would like to know if it is possible, in a DSP callback, to convert the samplerate of the buffer data to another one. For example, if i init the driver with 44100, to convert it to 22050,11025 … and vice versa ? Because, when i play the converted wav file to 22050 (for example), the song play slowly :smile:
Thanx in advance

  • You must to post comments
0
0

Can’t you use FSOUND_SetFrequency to speed it up?

  • You must to post comments
0
0

Hi Adion !
I ve used your mp3 encoder and added ogg en wav encoding. Ogg work well (not very hard to do … thanx 😉 but the wav writer need an enhancement. It work well when writing to 8 or 16 bits, but when i want to convert the buffer to a lower rate, the song play slowely (it s normal …). I use the “Don Cross” Wav read/write class, i think it is supposed to write to another frequency, but how to pass the correct modified buffer ? Note that all the work is done in a DSP callback.

  • You must to post comments
0
0

So, you want to init fmod to 44100hz, yet save the sound to wav in a lower format to save disk space?
The most easy way to do it is just save 1 out of 2 samples.
A more accurate way is to take the average of 2 samples and save that.
You have to take into account that the buffer you get is a stereo buffer, so it looks like :
l1 r1 l2 r2 l3 r3 l4 r4
And you have to save
(l1+l2)/2 (r1+r2)/2 (l3+l4)/2 (r3+r4)/2
Of course there are even better ways to resample data, but this would be a very simple way to do it.
I don’t think fmod’s internal routines for doing this are available at this point.

  • You must to post comments
0
0

Mhhhh okay, it s clear now, i understand what you mean …. i ll try this method, thanx Adion, you rox ! :smile:

  • You must to post comments
0
0

Hey KarlKox, if you need a fast C resampling function, contact me by e-mail!
I made one some time ago for my MOD player in Visual Basic and I think it should work very nice!
It has also linear interpolation if u are going to use upsampling instead of downsampling!

mailto:sababros@tiscalinet.it

Bye!

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.