| |
Martin Piper
Registered: Nov 2007 Posts: 698 |
Sample streaming from tape
Has anyone done four bit sample streaming from tape before? I'm thinking the time between pulses can be directly translated to four bit volume values as they are read from tape.
Practically useless, except for pure geekyness. But I wanted to know if it's been done, before I do it myself. |
|
... 36 posts hidden. Click here to view all posts.... |
| |
Repose
Registered: Oct 2010 Posts: 225 |
On 2nd thought, I estimated pulse speed in a very poor way. Looking at typical tape response, a cheap tape deck would do 10kHz, so somewhere below that. That's still pretty poor sampling rate. |
| |
MagerValp
Registered: Dec 2001 Posts: 1065 |
Use Macbeth's delta encoding instead (0/+1/-1), it only requires three different pulses. |
| |
Frantic
Registered: Mar 2003 Posts: 1641 |
Vaguely related. Video streaming from tape:
Deep Throat |
| |
Martin Piper
Registered: Nov 2007 Posts: 698 |
Quote: So the question is, what's the max frequency of pulses you can read? Based on the music I heard, it seems at 1kHz. Your average pulse length would be 8, so your sample rate would only be 128Hz.
Or look at it this way, to get phone quality sample rate (8kHz), you'd need pulses at 64KHz. I'm pretty sure that's not possible.
In fact, your encoding method is not efficient. You face the same tradeoffs as disk encoding. It's only that pulse length can give the wrong value with a slightly different speed, but that's hidden due to the nature of audio.
If you write 1/0 directly with occasional sync, that's most efficient, then the factor is only 4 instead of 8.
This is still a very low sample rate. If you get fancy with ADPCM, you could do at best 2x ratio.
This concept could only play bass/drums at best.
The best system I could imagine is using some DSP to find a combo of SID waveforms as a basis function to recreate the psychoacoustically most relevant frequencies, then the sample rate needs to be more related to how quickly the sound changes, and you could get something like the "mp3" demo.
But for normal coders, basically just d'n'b.
Eh? On PAL, for 8KHz I'd need a pulse every ~123 cycles, right? Assuming one tape pulse encodes one SID volume store of 4 bits.
The TAP file format has a resolution of 8 cycles, so each of the 16 SID volume levels would be, in the TAP file, a pulse length of X to X+15. Where X is a lower boundary constant to allow enough cycles to trigger on tape pulse, read the pulse length with a CIA timer, reset the timer, store to SID, loop...
So in reality the tape pulses in cycle terms could be 64 to 192 cycles to map directly to volume levels 0 to 15. Even an upper limit of 192 cycles would, in PAL, give 5131 Hz, right? |
| |
chatGPZ
Registered: Dec 2001 Posts: 11290 |
You can also abuse the "long gap" to make gaps with 1 cycle granularity... i'd certainly try that, use 8bit, and the mahoney playback. |
| |
Martin Piper
Registered: Nov 2007 Posts: 698 |
I might also try the Mahoney sample method. If I really want to remove the rest of my hair. |
| |
Bansai
Registered: Feb 2023 Posts: 40 |
Quoting MagerValpUse Macbeth's delta encoding instead (0/+1/-1), it only requires three different pulses. I take it that saturating arithmetic on the integrator equation would self-correct for tape dropouts where pulses are lost or corrupted? That is, at some point the value would incorrectly want to +1 the $d418 volume beyond 15 or -1 below 0, and saturating math would eventually clamp the value stream right back to where it should be given how overdriven 4-bit samples are anyway. |
| |
Hoogo
Registered: Jun 2002 Posts: 103 |
Staying within the restrictions of the TAP format is reasonable. But better check Slushload V3 to see minimum reliable pulse lengths.
16 pulse lengths for 4 bit are nice to handle defects on tape. But you will get a higher sample rate if you use 4 pulse lengths and write 2*2 bit.
Also your bit rate will be variable.
And finally: An analog magnetic tape may behave more weird than a TAP file suggests. |
| |
Martin Piper
Registered: Nov 2007 Posts: 698 |
Proof of concept ready. :)
Download this: https://github.com/martinpiper/C64Public/raw/master/IRQTape/Tap..
Run it in PAL Vice. It will wait on a black screen for a TAP file to be attached.
Download this TAP file: https://github.com/martinpiper/C64Public/raw/master/IRQTape/vic..
Use "File->Attach tape image..." in Vice (do not use auto-start!) and press play on the tape using "File->Datasette control".
You should see narrow colour bars and hear a sample from Space Ace.
If you want a command line for Vice then this should work: x64sc.exe -remotemonitor -dstapewobble 0 -dsspeedtuning 0 -1 vice.tap TapeStreamSamples.prg |
| |
Martin Piper
Registered: Nov 2007 Posts: 698 |
The sample rate is variable, since the 4-bit chunks from the tape for the volume are variable. However the average sample rate is 5.1KHz since the average pulse length is 192 cycles. |
Previous - 1 | 2 | 3 | 4 | 5 - Next |