TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: RAJESH DHAWAN
from: MATHIEU BOUCHARD
date: 1997-08-09 22:25:00
subject: converting sound data

JK>> DK>> it didn't work.  No code is needed, I just need to know how to
JK>> DK>> convert a 16-bit sample to an 8-bit sample...  That's it.
JK>>  RD> Divide it by 2 ???
JK>> So 60000 / 2 fits in 8 bits???
 RD> Oops, I blundered :)
 RD>  8-bit-sample = 16-bit-sample/256
 RD> That ok ?
i'd rather do:
x=(x+128)/256
or
x=(x+128)>>8
(either way, most compilers generate the same code for these two)
matju
--- Terminate 4.00/Pro
---------------
* Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.