kool kitty89 Posted October 26, 2015 Share Posted October 26, 2015 I'm not sure if this technique is ever actually used in existing games or demos, but using 2 POKEY channels and two timers, it should be possible to get 8-bit linear PCM output through POKEY. Set one timer to the desired sample rate and set one 4-bit volume level for the upper 4 bits of a sample while the lower 4 bits go to the other channel. The second channel gets its volume then cut again to 1/16 by using the second timer to set the duration of the pulse to 1/16 of a sample period. Yes you'd get noise at low sample rates (more and more audible below 11 kHz) but that's true to some extent for harmonics of low sample rate PCM in general. (and not the same sort of squeal and noise as 1-bit PDM/PWM on a PC speaker or beeper or whatnot) Using cycle timed loops instead of interrupts (or polling) for the timing would also be possible. I also know using 4-bit samples in general is often more practical on the A8 due to memory constraints (and SNR often favoring 4 bit over 8 bit at low bitrates) and that PCM playback is also CPU intensive (from previous talks with malducci, I believe 50 cycles per interrupt for decently tight code) and this method would be more CPU intensive than straight 4-bit playback, but it still seems interesting at least. (8-bit output is better for software mixing too, but that's only good if you have free cycles to dedicate to mixing, and I know multiplexing 4-bit samples on a single channel is also an option there) I may also be misusing the term PDM, pulse-width modulation might be more correct here, but I think PDM applies. (there isn't really modulation involved either, just fixed pulse width of the lower channel ... you COULD modulate a single channel to get those added 16 volume levels, but that still takes 2 timers -or careful coding- and I don't think would sound as good) 16 Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.