Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Sample streaming from tape
2023-10-31 04:25
Martin Piper

Registered: Nov 2007
Posts: 699
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....
 
2023-11-01 14:43
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.
2023-11-01 15:15
Martin Piper

Registered: Nov 2007
Posts: 699
I might also try the Mahoney sample method. If I really want to remove the rest of my hair.
2023-11-01 21:41
Bansai

Registered: Feb 2023
Posts: 40
Quoting MagerValp
Use 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.
2023-11-06 18:41
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.
2023-11-10 15:00
Martin Piper

Registered: Nov 2007
Posts: 699
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
2023-11-10 15:04
Martin Piper

Registered: Nov 2007
Posts: 699
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.
2023-11-11 02:39
Martin Piper

Registered: Nov 2007
Posts: 699
The code changes for this example. https://github.com/martinpiper/C64Public/compare/e7dc2ef85d1c72..

Accuracy would be improved by using an IRQ instead of polling bit 4 on $dc0d.
2023-11-11 12:03
tlr

Registered: Sep 2003
Posts: 1762
Would be interesting to see how this works on real HW. If you just translate pulse length to sample value, then any imperfections in detecting the length will translate to some noise which is probably unproblematic.

This encoding is basically frequency modulation (as in FM radio).

If you accept relying on precise pulse length detection, then you could employ a differential encoding instead, e.g 0, +1, -1, +2, -2... This way you could choose to have a higher sample rate for small changes, improving high frequency content of the sound.
2023-11-11 12:32
Krill

Registered: Apr 2002
Posts: 2940
Quoting Martin Piper
Accuracy would be improved by using an IRQ instead of polling bit 4 on $dc0d.
Main thread running over a thousand NOPs, interrupt kicks in, does stuff, and jumps back to start of NOP desert.

Did any tape loaders use this to improve accuracy (= increase bit rate)? =)
2023-11-11 12:39
Krill

Registered: Apr 2002
Posts: 2940
Quoting tlr
If you accept relying on precise pulse length detection, then you could employ a differential encoding instead, e.g 0, +1, -1, +2, -2... This way you could choose to have a higher sample rate for small changes, improving high frequency content of the sound.
Hmm... wouldn't the larger diffs imply a steeper gradient on the time-domain wave, and thus should be encoded with the shorter pulses?
Previous - 1 | 2 | 3 | 4 | 5 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Jedfox/Exclusive ON
Guests online: 87
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Mojo  (9.6)
6 Uncensored  (9.6)
7 Comaland 100%  (9.6)
8 Wonderland XIV  (9.6)
9 No Bounds  (9.6)
10 Unboxed  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 Party Elk 2  (9.6)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.6)
5 Rainbow Connection  (9.5)
6 It's More Fun to Com..  (9.5)
7 Morph  (9.5)
8 Dawnfall V1.1  (9.5)
9 Onscreen 5k  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Booze Design  (9.3)
2 Oxyron  (9.3)
3 Nostalgia  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.2)
Top Swappers
1 Derbyshire Ram  (10)
2 Jerry  (9.8)
3 Violator  (9.8)
4 Acidchild  (9.7)
5 Cash  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.056 sec.