0
0

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[576] 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

• You must to post comments
0
0

so you want to downsample from 16 bit to 8 bit? surely if you just take the 8 high end bits from the pcm data that will give you an 8 bit number (ie use uchar=pcm shr 8)

• You must to post comments
0
0

use uchar=pcm shr ? What is that?

I had something that didn’t work
data = (UCHAR)Abs(wave[x])/10000 * 50

go ahead and laugh, cuz that was a retarded expression ๐

• You must to post comments
0
0

[code:12js9j37] data=wave[x] >> 8[/code:12js9j37] should work

• You must to post comments
0
0

[quote="birty":1zdpf2gn][code:1zdpf2gn] data=wave[x] >> 8[/code:1zdpf2gn] should work[/quote:1zdpf2gn]

For signed char, it is ok, but for uchar :

data = ( wave[x] >> 8 ) + 128

This range for uchar is 0 <–> 255 ๐

• You must to post comments
0
0

[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 ?

• You must to post comments
0
0

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
produces nothing

data=(wave[x] >> 8) + 128
produces nothing

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.

• You must to post comments
0
0

data = ( wave[x] >> 8 ) & 0xFF;

๐ณ

• You must to post comments
0
0

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.