impossible things - samples

Started by jaymzjulian, November 14, 2019, 01:34:57 AM

Previous topic - Next topic

jaymzjulian

This is mostly getting an idea out of my head - should not even consider this one ;).  In particular, I suspect it'd be a pretty big re-architect for something that almost no-one would use, BUT maybe it can lead somewhere....

in the context of thinking about music/sound effects, I was thinking about what you'd need to do to support a sampled audio stream - stuff like mixing a couple of sample channels on the v32 side (maybe from a mod file or similar), outputting that to the AY. 

I came up with that for an 18khz output, which would be quite acceptable through the vectrex's tiny speaker anyhow, you need to transfer 600 bytes/30th.  You could reduce this to 300bytes/30th if you used 4bit samples, which i believe is what you can get without _hacks_ anyhow on the AY (i.e. stop the oscillator, waggle the volume register).  This seems.... doable - obviously, that's a fair chunk of the dual port ram (this would NOT fly with vltron ;)).  Of course, the hard part then would be timing the 6809 side.  I suspect you end up with a loop that looks like:

* start an 18khz timer
* look at timer - am i due more samples than I have played?  yes?  play next due sample from buffer
* is there more things to draw?  yes?  perform next dreawing op
* loop

This is also probably why the samples in spike sound so bad - you're going to keep losing bits while a lot of drawing is happening... essentially here you have to output a sample every 90 cycles or so.  If a line takes more than 90 cycles to draw, then there's going to be distortion.  You could, of course, reduce that rate further, making this more realistic - I know when reading up on vectrex samples, malban mentioned 8khz, which seems super low to me, but then in c64 land we do 7khz a lot, so what would i know? :).  But that would give you 185 cycles per sample, which seems even more doable - as long as you check between each line draw if you're due one yet, I think it might _actually_ work out.  Interestingly, I _suspect_ the fastest way would be acutally just write the sample to the PSG volume register unconditionally - there's no harm in it, and the check is probably longer than the read timer/update

EDIT: that last statement is a lie thanks to the way the AY is hooked to the vectrex  ;)  I forgot that hot mess!

Vectrex32

Quote from: jaymzjulian on November 14, 2019, 01:34:57 AM
should not even consider this one

I'm sorry, I can't hear you. Could you repeat that? Louder?

:-) :-) :-)

- Bob