Hey guys, this may seem odd, but I want to convert pcm data
(32767 to -32768) to (0 to 255). any ideas on how to do this?
I want to do this becuase I need waveform data for winamp visual plugins.
unlike Karlkox’s winamp plugin interface, I do not use winamp input plugins
to feed it audio data.
The data needs to be converted to an Unsigned Char
Global Wave As UCHAR
I know i need 2 channels, but I have that taken care of already, i just need
to cram fmods data into winamps data
If any body has any idea please, please help. Thanks
- nci asked 13 years ago
[quote="KarLKoX":84pmh6yf][quote="birty":84pmh6yf][code:84pmh6yf] data=wave[x] >> 8[/code:84pmh6yf] should work[/quote:84pmh6yf]
For signed char, it is ok, but for uchar :
data = ( wave[x] >> 8 ) + 128
This range for uchar is 0 <–> 255 ;)[/quote:84pmh6yf]
isn’t it +127 since char is -127 <–> 128 ?
well, lets see. I tried:
data = (uchar) Wavedata[x]
this produced promising results, the wave data was extremely maxed out.
if i turned the volume way down, i was able to see a sort-of good wave.
data=wave[x] >> 8
data=(wave[x] >> 8) + 128
any hints on how to reduce the “volume” of my wave?
I tried just dividing it, but the signal gets cut in half. I have to process
both left and right, i guess.
Ack! my retardedness at it again! 😮
I forgot I switch to a UCHAR pointer and was trying some different
things. I forgot to switch it back when testing your relpies 😕
Well, this works perfectly:
data = wave[x] >> 8
I did not use + 128 or 127 becuase it produced some nasty looking thing.
Thanks for all your help.
KarLKoX: I noticed in your winamp plugin emulator, that some vis plugins
crash. I tried the same ones in my emulator and they crash too. So, i think
there is something we are both missing… Yes, i am using multi-threading.
Most plugins will work, but some, like I said, just plain do not cooperate
Please login first to submit.