14 February 2024, 10:02 | #1 |
Registered User
Join Date: May 2022
Location: Adelaide, South Australia, Australia
Posts: 209
|
More .iff sound compression than delta
As the title says, I want to be able to compress .iff sound in a way that can do more than the 50% reduction delta compression offers.
I'm going to implement this so it fits within the 8SVX structure, and with decoding can be played back the same as any other 8SVX sound. I'm thinking it would be best to apply some kind of compression on top of delta compression, rather than an entirely different thing. For performance, it must be able to be decoded in real time at 20KHz sample rate on an Amiga with a 68000. Does anyone know a suitable compression algorithm I could use to make this possible? Thanks. |
14 February 2024, 10:04 | #2 |
Registered User
Join Date: May 2022
Location: Adelaide, South Australia, Australia
Posts: 209
|
Side note: Forgot to mention this but it might be important, it would be best if the compression works on short and long pieces of audio alike.
I want to use this primarily so long PCM audio can be fit onto a floppy at lower sample rates (2 minutes at 10KHz with room to spare for instance) as well as being able to work on high sample rate sound effects, hence the requirement for being able to decode at 20KHz. |
14 February 2024, 12:17 | #3 |
Registered User
Join Date: Feb 2017
Location: Denmark
Posts: 1,284
|
I experimented with fitting as much audio onto a floppy last year, and got 5min 8seconds @ 7813Hz by pulling all stops (routine is just fast enough to handle ~30KHz).
Getting more than 50% compression ratio is probably not worth it on plain A500. At 20KHz you only have around 350 CPU cycles/sample, and if you're streaming from disk you also need to factor in the time to read and decode each track. I used (slightly modified for speed) ADPCM (50%) with Huffman coding for each nibble (~92% so ~46% total), and an alternate MFM encoding scheme @ 164 tracks increasing disk capacity to 1.06MB. Challenge is that audio data (even delta) has a lot of entropy. To really improve on the ratio you probably need to use some advanced coding scheme, but the realtime constraint really puts a limit on how much you can do, and I'm not aware of any that will work. |
14 February 2024, 12:54 | #4 |
Registered User
Join Date: May 2022
Location: Adelaide, South Australia, Australia
Posts: 209
|
I suppose that's why PCM floppy music disks never took off, only trackers.
I've been curious about the idea of automatically detecting repetetive chunks of audio and only saving them once. Like how .zip files can encode variably sized blocks of data rather than single characters. If you have instrumental music, even when two instruments are playing at the same time, usually they have synchronised timing such that chunks would repeat. Is there any kind of precedent for that as audio compression? |
14 February 2024, 14:27 | #5 |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,799
|
Basic delta encoding only gives you so much, to improve on that you want linear predictive coding on top so that you typically have smaller differences to encode. However, that just adds more complexity.
|
14 February 2024, 15:11 | #6 | |
Registered User
Join Date: May 2022
Location: Adelaide, South Australia, Australia
Posts: 209
|
Quote:
Is there a list anywhere of the compression codes for .iff? Surely someone would have implemented codes other than just delta compression. I'd rather not have it where I try and use an audio file with the custom encoding and some software thinks it's in it's own proprietary format. |
|
14 February 2024, 15:33 | #7 |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,911
|
As mentioned by paraj ADPCM is probably most advanced and at the same time computationally friendly with plain A500 sound compression - you can also try to play around A-law/u-Law codecs - i.e. non-linear quantization step - for example 4 bit then you could achieve close to 50% compression and use simple table to decode 4 bit to 8 bit value (something like Fibonacci Delta Compression but with different quantization steps). Something more complex will be probably beyond capability of plain 68000.
--- Started to dig on 8 bit audio compression and some discussion already negate some of my ideas but anyway https://www.bitsnbites.eu/hiqh-quality-dpcm-attempts/ https://www.drdobbs.com/database/aud...sion/184408798 https://stackoverflow.com/questions/...its-per-sample https://comp.compression.narkive.com...ression-scheme Last edited by pandy71; 14 February 2024 at 15:59. |
14 February 2024, 15:48 | #8 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,377
|
Quote:
But as you prefer something on top of delta compression, you may try to use data that has been delta crunched as source, but in the decrunched form (i.e. normal data but with the losses). It may sound strange but this removes entropy. You can then use smpl mode of xpk library, or do it yourself and convert it to sample mode (values will be not direct but difference with previous), then recrunch with some huffman encoder. |
|
14 February 2024, 22:46 | #9 |
Registered User
Join Date: May 2022
Location: Adelaide, South Australia, Australia
Posts: 209
|
Lossy is completely acceptable. The quality of fibonacci delta compression is fine, maybe even a bit more compressed than that. The main this is keeping the samples rate at or above 10KHz.
|
14 February 2024, 23:09 | #10 | |
Registered User
Join Date: Mar 2019
Location: Poland
Posts: 65
|
Quote:
wavepak http://aminet.net/package/mus/misc/wavepak - implements another compression scheme, called expotential delta - its basically Fibonacci delta with different quantisation table. http://aminet.net/package/mus/misc/8svx_comp implements adpcm compressions in 8svx. These packages implement 8svx compression using compression id 1-4. Perhaps there are more, but havent seen any so far. |
|
15 February 2024, 01:01 | #11 |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,911
|
Btw 'algorithm' experiments with vector quantization are truly impressing - check https://www.pouet.net/prod.php?which=65976 ; https://www.pouet.net/prod.php?which=64861 and https://www.pouet.net/prod.php?which=65459 - others https://www.pouet.net/user.php?who=66775&show=credits
|
15 February 2024, 13:34 | #12 | |
Registered User
Join Date: May 2022
Location: Adelaide, South Australia, Australia
Posts: 209
|
Quote:
Thanks for the references, I'll try and implement a test algorithm using the techniques. |
|
15 February 2024, 13:36 | #13 | |
Registered User
Join Date: May 2022
Location: Adelaide, South Australia, Australia
Posts: 209
|
Quote:
|
|
15 February 2024, 19:41 | #14 |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,911
|
|
15 February 2024, 23:58 | #15 |
Registered User
Join Date: May 2022
Location: Adelaide, South Australia, Australia
Posts: 209
|
While the code I'm writing won't be open source (or at least I plan for it not to be), I will make open source the structure of the compressed data such that someone else could write their own program to compress or decompress it. Along with documentation of the compression, IDs for it will be documented (IDs plural, as there will likely be several levels of compression trading off size for CPU time).
|
16 February 2024, 22:19 | #16 | |
Registered User
Join Date: Jun 2010
Location: PL?
Posts: 2,911
|
Quote:
|
|
18 February 2024, 20:08 | #17 | |
Registered User
Join Date: Feb 2016
Location: Homeless
Posts: 67
|
Quote:
As far as I understand, method 0-4 are used for official 8svx, wavepak, and 8svx_comp, so 5-15 should be also free for use... or are they used for something else? |
|
18 February 2024, 22:36 | #18 |
Coder/webmaster/gamer
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,702
|
They are free for use.
|
19 February 2024, 00:41 | #19 |
Registered User
Join Date: May 2022
Location: Adelaide, South Australia, Australia
Posts: 209
|
It's incase anyone figures that 5-15 are free to use, so they don't make software that will misinterpret my IDs as their propietry format.
|
19 February 2024, 02:58 | #20 |
Coder/webmaster/gamer
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,702
|
But they would not think they are free to use, if you register your compression format at the official registry at https://wiki.amigaos.net/wiki/IFF_FO...Chunk_Registry, as has been done for eg. various new IFF ANIM compression types.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
I need An IFF/8SVX and an IFF/ANIM Player for PC | searcher | request.Apps | 24 | 02 July 2020 12:09 |
Delta Music 1.4 | warfalcon | Coders. Asm / Hardware | 1 | 12 June 2016 08:13 |
Delta Music 1.0 | chris70c | request.Apps | 3 | 01 July 2010 09:05 |
.wav to Amiga .iff sound file | KevG | request.Apps | 8 | 14 May 2010 23:15 |
Delta 2002 | hit | request.Modules | 0 | 30 August 2008 21:53 |
|
|