Page 5 of 5

Re: CVSD Compressed audio example

Posted: Sat Dec 29, 2018 6:57 pm
by Chilly Willy
AMBTC uses a different approach than traditional VQ. It's more about quantizing a single block into two values that give a mean value the same as the original block. VQ is finding small blocks that are most representative of the entire sample. And I can't believe you think the vq2 samples sound bad. They're almost identical to the original (as 22050 Hz 8-bit samples, of course). Plus they're far better than the CVSD or AMBTC results. They're arguably better than comparably compressed ADPCM.

Re: CVSD Compressed audio example

Posted: Sat Dec 29, 2018 7:08 pm
by amushrow
Thanks for those Chilly Willy, I think the stuff I've been working on sounds cleaner for the same file sizes so I'm going to continue on with that.
Hopefully I can get it running on an actual console in the next few days and get some real world comparisons. Then I can stop thinking about it and do something else, I must have listed to the same sample tracks hundreds of times over the last few days.

Re: CVSD Compressed audio example

Posted: Sun Dec 30, 2018 1:50 am
by Chilly Willy
No problem. I'd love to see your codec when you're done. I'm fascinated by codecs in general. If you have something better at the same compression ratio that plays on Z80, I certainly am interested in it. :D

Re: CVSD Compressed audio example

Posted: Sun Dec 30, 2018 8:57 am
by cero
https://files.catbox.moe/incsd9.zip
This zip contains the first bad 10s from both the original Bad Apple and the vq2 version, both in the same 22kHz 8bit mono format. Do you really not hear the difference? The vq2 version is a lot worse.

edit: I haven't tried the other formats you mention, and I believe you when you say they're worse. I'm just saying that the current quality is not acceptable, at least in my opinion.

Re: CVSD Compressed audio example

Posted: Sun Dec 30, 2018 1:26 pm
by Chilly Willy
I can hear the difference, but it's better than ADPCM in my opinion. I'd love to hear better that still decodes on Z80. And I mean that literally - 8-bit/16-bit compatible compression tends to be not so good since you're talking about rather low power processors, so all 8-bit intended codecs suffer in one way or another.

Re: CVSD Compressed audio example

Posted: Sun Dec 30, 2018 6:10 pm
by cero
Besides tuning the encoder, it could easily be turned to a lossless compressor. A quick pass over a random song shows there aren't very many unique u32s, just tens or hundreds of thousands.

VQlossless: 256 x 4 samples followed by the number N, then N of codes. Probably 30-60% compression, N could be limited to a few kb so that Z80 can still access it all.

edit: Okay, with a different song this wouldn't work at all. But having such dynamic quality might help the vq too.

Just ideas, anyway.

Re: CVSD Compressed audio example

Posted: Sun Dec 30, 2018 6:41 pm
by gligli
Hello,
A while ago I made this demo of a Z80 codec I made: http://sfx.gligli.free.fr/mddev/SoundChunks_Demo.7z
It's full sample rate (26390Hz 8bit mono) and uses statistical compression to achieve 8 minutes of music on 4MB.
There are a few bugs especially on sibilance but it worked fine already :)

Re: CVSD Compressed audio example

Posted: Mon Dec 31, 2018 6:39 am
by gasega68k
I have done some stuff on audio compression too :) , I think the first one I did was on 2007, mostly are some kind of "adpcm", even on wolf3d I did a 2:1 audio compression for samples similar to sonic (back then I didn't know Sonic was using compression on pcm, until I was looking on sonic sources when I was getting some problems with wolf3d on fm music playback on real hardware, and I noticed that it was similar to what I did).

The last one I did was one that do 3:1 compression, from one byte you get 3 samples, like this:

Bit 7 and 6 select one of 4 tables with 2 values, bit 5 indicate 1= add or 0=substract, bit 4 select one of the 2 values, the same goes for bits 3-2, and bits 1-0, it will use the same table for 3 samples.

The tables are:
1, 4
4, 8
8, 16
16, 32

For example if you have bits 7-6 = 01 , bits 5-4 = 10, bits 3-2 = 01 and bits 1-0 = 11
it will be:
1. add 4
2. sub 8
3. add 8

Now if you have bits 7-6 = 11 , bits 5-4 = 11, bits 3-2 = 10 and bits 1-0 = 00
it will be:
1. add 32
2. add 16
3. sub 16


Chilly Willy, I did a z80 vq3 version a few days later when you posted about it on plutiedev discord channel, and I think it sound better than mine, here are some examples I did:
http://www.mediafire.com/file/pc2bsdu4q ... est+vq.zip

In the Zip there are 3 roms: "test_vq3_z80_22khz.bin" is the Sonic cd intro at 22khz, "starwars_music_demo_vq3.bin" is a starwars soundtrack with about 9 minutes of music at 12.4 khz, the songs and duration (exept the starwars theme) are based on the N64 game "shadows of the empire", and the song names are based on the leves (mostly).

"starwars_music_demo_vq3f.bin" is the same but the diference is that in this one I did a "2x oversampling", is just playing one sample that is: old sample + current sample / 2, making a 24.8 khz playback, which removes some of the noise.


And for comparision this is the same Sonic cd intro at 22 khz with my 3:1 compression code:
http://www.mediafire.com/file/66h1y64a6 ... z.zip/file

Re: CVSD Compressed audio example

Posted: Mon Dec 31, 2018 10:01 am
by cero
Seems deltas + Huffman would allow a 70-80% lossless 8bit pcm file, but is the z80 fast enough with its bit shifts? Probably not fast enough for 2-4 sfx using such, and music is better off using fm/psg.

Re: CVSD Compressed audio example

Posted: Mon Dec 31, 2018 6:16 pm
by bioloid
wow, is there something working good here at 22k ? will need it for my future demo to save space please

Re: CVSD Compressed audio example

Posted: Mon Dec 31, 2018 8:12 pm
by Stef
I've my very simple ADPCM driver which provide 2 channels @22Khz with 1:2 ratio but to be honest i think you can find much better now :)

Re: CVSD Compressed audio example

Posted: Tue Jan 01, 2019 1:56 am
by bioloid
1:2 could be ok if quality is ok

Re: CVSD Compressed audio example

Posted: Tue Jan 01, 2019 2:01 am
by Chilly Willy
gasega68k wrote:
Mon Dec 31, 2018 6:39 am
Chilly Willy, I did a z80 vq3 version a few days later when you posted about it on plutiedev discord channel, and I think it sound better than mine, here are some examples I did:
http://www.mediafire.com/file/pc2bsdu4q ... est+vq.zip

In the Zip there are 3 roms: "test_vq3_z80_22khz.bin" is the Sonic cd intro at 22khz, "starwars_music_demo_vq3.bin" is a starwars soundtrack with about 9 minutes of music at 12.4 khz, the songs and duration (exept the starwars theme) are based on the N64 game "shadows of the empire", and the song names are based on the leves (mostly).

"starwars_music_demo_vq3f.bin" is the same but the diference is that in this one I did a "2x oversampling", is just playing one sample that is: old sample + current sample / 2, making a 24.8 khz playback, which removes some of the noise.


And for comparision this is the same Sonic cd intro at 22 khz with my 3:1 compression code:
http://www.mediafire.com/file/66h1y64a6 ... z.zip/file
Nice! That's a great set of demos for trying on hardware (or emulators). Like I said, I think VQ is just slightly better than ADPCM at the same compression ratio, and much easier to decode. And super-sampling was a good idea for reducing the noise. I did notice it wasn't as noisy, which is perhaps the main thing you notice with VQ.

Re: CVSD Compressed audio example

Posted: Tue Jan 01, 2019 6:20 pm
by Stef
bioloid wrote:
Tue Jan 01, 2019 1:56 am
1:2 could be ok if quality is ok
I think the quality is quite ok, i don't really notice much difference compared to original sample (high playback rate help) :)
It's embedded in SGDK and so really easy to use if you want to test it out (just use a WAV file with ADPCM driver).

Re: CVSD Compressed audio example

Posted: Tue Jan 01, 2019 7:14 pm
by bioloid
Oh ok, awesome, thanks!