word to float to word conversion (DSP for using VST effects)
Posted: Fri Jun 09, 2006 9:57 am
I am trying to use a VST plugin to process a 16 bit .wav-file (put some flanger og chorus on it). Each sample in the .wav-file is stored in a word (because it is a 16 bit sample) but the VST standard requires each sample to be a float in the range -1.0 to 1.0, ie. I need to do some conversion. I am going to do the conversion like this:
However, I believe that this is not the optimal way of doing the conversions. As for the word to float conversion I have read some people claiming that the above method is very slow - in this post
http://groups.google.dk/group/alt.stein ... 0fdae8dfa2
Mark Robinson claims that there is method to do the word to float conversion where you move the bits around somehow. I have been reading a lot about the different number representations + done some experiments, but I still can't see/understand how it can be done.
As for the float to word conversion - which is more important for me - I think the above method might create some 'harmonic distortion' because of the rounding (if I understand http://en.wikipedia.org/wiki/Dithering correctly). I have heard some people talking about 'dithering' - is that necessary in this case and can someone give me an example/explanation of how to do that on a float sample value?
Code: Select all
sample.w = 12345
If sample = - 32768
sample + 1
EndIf
convertedSample.f = sample / 32767
processedSample.f = 0.23423244432343 ; = output from VST-procedure: process(convertedSample)
backConvertedSample.w = processedSample * 32767
http://groups.google.dk/group/alt.stein ... 0fdae8dfa2
Mark Robinson claims that there is method to do the word to float conversion where you move the bits around somehow. I have been reading a lot about the different number representations + done some experiments, but I still can't see/understand how it can be done.
As for the float to word conversion - which is more important for me - I think the above method might create some 'harmonic distortion' because of the rounding (if I understand http://en.wikipedia.org/wiki/Dithering correctly). I have heard some people talking about 'dithering' - is that necessary in this case and can someone give me an example/explanation of how to do that on a float sample value?