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 > SID streaming
2015-09-19 12:20
Sasq

Registered: Apr 2004
Posts: 156
SID streaming

I am experimenting with recording SID writes from Vice and replaying them as a stream, and so the question on how to compress the stream comes up.

The naive way is to record value (8bits), sid offset (5 bits) and cycle delta (~16bits). This can then be compressed in various ways.

But I am more interested in the assumptions you can make because of how the SID-chip works. With writes can you reorder for instance? Is there in fact a safe fixed order you can used for single speed songs?

Also is there writes you can skip which have no effect?
2015-09-19 12:36
chatGPZ

Registered: Dec 2001
Posts: 11386
i'd have individual streams for all registers, and then apply a combination of delta- and RLE encoding on them.

as for the order, unless you are dealing with some very old tunes (who sometimes do odd stuff like writing several times to the same register in one frame) you should copy your buffer into the SID registers in reverse order.... see eg goattracker instructions.
2015-09-19 13:02
Sasq

Registered: Apr 2004
Posts: 156
Also, which registers are safe to not update if the same value is written to then?

@groepaz separate streams would be problematic as most registers do not need writing every frame.
2015-09-19 13:05
chatGPZ

Registered: Dec 2001
Posts: 11386
its not a problem at all, if you delta pack them (infact, its an advantage)

also i wouldnt bother about finding out what doesnt have to be updated - just depack your stream(s) into a buffer and copy that to the SID every frame.
2015-09-19 13:18
tlr

Registered: Sep 2003
Posts: 1790
I did an implementation of this a while back. I didn't care about the exact cycle timing, rather just what is set up per frame call. Like groepaz says, individual streams and delta is the way to go although RLE is a little too weak for my taste. ;)
2015-09-19 13:58
chatGPZ

Registered: Dec 2001
Posts: 11386
of course you can always replace RLE by something that packs better, but uses more CPU :)
2015-09-19 14:00
Sasq

Registered: Apr 2004
Posts: 156
But there are some registers that are almost never written, would be waste of space to store a delta for them every frame? But other than that, huffman or similar with just 1 bit for indicating zero delta would make it pretty effecient.

But for samples another approach is also needed I guess, where a few set of registers are updated very often?
2015-09-19 14:06
tlr

Registered: Sep 2003
Posts: 1790
RLE of delta = 0 (or any constant delta) costs basically nothing per frame for that stream.

But, I'm interested in what your goal is? Is it being able to compress anything including cycle timing, like samples and stuff?
I assume you want it to play natively on the c64. Do you need it to fit in ram?

Like gpz says there is quite a compromise to be made between space vs. the amount of cycles needed to decompress the stream.
I went a little more towards the space side of things I guess.
2015-09-19 14:09
chatGPZ

Registered: Dec 2001
Posts: 11386
its even pretty efficient with just RLE ... if the delta is 0, then effectively you only store how many frames it takes until a change happens - using simple RLE that gives you like 5 seconds for each byte that never changes.... you should worry more about how to efficiently pack the bytes that DO change :)
for samples i'd use something completely different, for that you'll have to come up with a decoder that is very fast in the first place.
2015-09-19 15:09
Mixer

Registered: Apr 2008
Posts: 452
There are so many playroutines that only way that works for every case is to save writes and the cycle delta inbetween.

Sid registers are written in sequence after all, not all at the same time.

Write order is an issue if there are several writes to same register within one play routine call. The packer needs to catch these. As discussed elsewhere, the ADSR write order depends on what the ADSR values were and will be after the call and what state change will take place. This includes GATE bit of control register. Therefore, i'd manage ADSR+GATE so that the write order stays. For other registers the order is not as important as proximity of the writes, so that the writes happen during same "call".

Volumesamples need the correct cycle delta between writes.

8-bit samplestuff and other methods need cycle exact handling of control register and other manipulated registers. For those both cycles and write order are important.
2015-09-19 15:17
Sasq

Registered: Apr 2004
Posts: 156
I plan to use it on a real C64 yes... possibly streaming from SD-card or over TCP/IP.
 
... 5 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 - 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
csabanw
JackAsser/Booze Design
Alakran_64
Peacemaker/CENSOR/Hi..
Guests online: 103
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Organizers
1 Burglar  (9.9)
2 Sixx  (9.8)
3 hedning  (9.7)
4 Irata  (9.7)
5 Tim  (9.7)

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