mrcoke wrote:Well, i just want to understand the basics to be able to play digisound. I know already, that a digisound is definded by its resolution in bits and the replay rate in KHz. That's clear so far. But i don't know how to interprete the values of a digisound value - means: on a 8bit sample there are values like 0 (zero) that means silence - but there are positive and negative values up to 128 - ok, a greater value is a greater sound, but what is the difference between negative and positive values ?!??
oberje wrote:There's no real difference in signed/unsigned, it's just a convention, ultimately to be played on the PSG the value is always translated to a positive ( or 0 ) volume ( obtained by setting various combinations of the 4 bit volumes for the 3 channels ).
Aside: 0 can be silence, but note, any value will be silent if it is continuous and unchanging. It's the change in volume & the frequencies that makes the sound.
bod/STAX wrote:Sorry, I can never remember which is which when it comes to signed samples and unsigned samples.
But if you have a sample that contains the values -127 to +128 then you just add 128 ($80) to all the bytes
of the sample thus giving you values from 0 to 255. These values then can be an offset into a sound table
that contains all sound that can be played through the soundchip.
Click this link and scroll down to where I've uploaded the source code to the Lost Boys Megabang demo.
You'll see that it replays samples at various speeds using the above method (the sample already has 128 ($80)
added to it).
Users browsing this forum: No registered users and 3 guests