AY Crudentials: 2 Bit Samples

Probably the most technical forum around. It does not have to be coding related, or assembly code only. Just talk about how you can use the AY chip to do cool sounding things :)
User avatar
Twilighte
Game master
Posts: 819
Joined: Sat Jan 07, 2006 12:07 am
Location: Luton, UK
Contact:

AY Crudentials: 2 Bit Samples

Post by Twilighte »

2 Bit Samples refer to the source rather than the output.
2Bit samples have the clear advantage of being very memory efficient, since 4 sample values can be stored in every byte.
However, 2 bit samples suffer from low resolution having only 4 possible values.
The classic Rambo and Madonna samples used 2 Bit to great effect.

a 2 Bit sample is either stored in a byte as 0123 or 3210 format whereby the lower 2 bits of the byte store the first value, the next 2 bits hold the second and so forth.

Once the 2 bit entity has been extracted, it is then transformed into a 4 bit value (either through shifting (0,1,2,3 to 0,4,8,12) or used to index a table that holds better values) and finally sent to the AY Volume register.
User avatar
Euphoric
Game master
Posts: 99
Joined: Mon Jan 09, 2006 11:33 am
Location: France

Post by Euphoric »

What about using some sort of ADPCM coding to keep a higher resolution of samples, and still use only 2 bits per sample ?

Cheers,

Fabrice
User avatar
Twilighte
Game master
Posts: 819
Joined: Sat Jan 07, 2006 12:07 am
Location: Luton, UK
Contact:

Post by Twilighte »

What you say may be possible, but at 2 bit, one bit would be tied up as a polarity so effectively giving one bit step value, which is a bit small ;)
Also, playing 2 bit samples is slow because of the additional extract code (to get 2 bits from the 8 bit source) and the conversion code(to get 0-15 from 0-3), so further ADPCM stuff will reduce the speed even more.
However, it would be very interesting to do something like this, but i think it should come under a separate Topic.
User avatar
Euphoric
Game master
Posts: 99
Joined: Mon Jan 09, 2006 11:33 am
Location: France

Post by Euphoric »

at 2 bit, one bit would be tied up as a polarity so effectively giving one bit step value, which is a bit small
Not necessarily... Of course, it's not a lossless compression, so some differences between two successive samples cannot be coded, especially large differences...
So, suppose you use a small step and a bigger step in each direction, you have four values (e.g -2, -1, +1, +2) that you can code with two bits...

Cheers,

Fabrice
Post Reply