no no, I mean the upper byte is the incrementor - not the pointer. Your pointer would be word length. If the upper byte was a value of 1, then your playback rate would be 1:1.Chilly Willy wrote:
A byte really isn't enough for a decent instrument sample. I used a word when I did some MIDI instruments on the Amiga. Most of my instruments weren't 64K long, but most WERE longer than 256 bytes. You probably could do some really simple instruments in 256 bytes, though.
pseudo code would be:
load r1, float_counter
add r1, float_incementor
store float_counter, r1
load r1,whole_counter
addc r1,whole_incrementor ;add+carry
store whole_counter,r1
load r2, wave_pointer
add r2,r1
store wave_pointer,r2
load r1,(r2)
That's interesting. So you kept the frequency playback of the hardware channel static and did the frequency scaling in software? Did you do any other effects? Like phase modulation, phase distortion, sync, etc?Anywho, I used a long for the sample step - it was a 16.16 fixed point number. I could simply do a swap, use the word index addressing mode, then swap back. The 68K is nice that way. If you were doing a 32X or SEGA CD game, you could use the main 68K CPU that way. It's also fast enough to add several instruments together in that manner. On a 14 MHz 68020, I could mix 16 stereo instruments and 16 stereo sound effects together with that sort of pitch scaling using only about 5% of the CPU time (on a stock A1200). All instruments and sound effects were a 11025 Hz sample rate.
What's the relation of the 256byte chunks? Does that have something to do with alignment/LUT or are you copying 256 bytes into ram as not to stall the z80 playback routine?my engine does no resampling whatsoever... and I can't add it becasue of the way samples are played back... everything happens in 256 byte chunks... and if I change it, I'd rather have no sample playback at all since I lose the rate, and I need it for good sounding cymbals... if banks would be changed by a single (or two writes) I would have happily had resampling, but since resampling is pretty dynamic business, I have to change banks really often and that just kills the rate.... lest kick Sega in the nuts !!!