Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Does Wavpack (or FLAC) support compression on 10 or 12 bit waveforms? (Read 9419 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Does Wavpack (or FLAC) support compression on 10 or 12 bit waveforms?

I am investigating compression alternatives (beyond gzip/deflate/etc.) for short clips of 10 or 12 bit audio-frequency waveforms.  I can't find any reference in the documentation that wavpack supports anything other than 16/24 bit waveforms.

I haven't attempted any tests yet, but does anyone know if this is possible with wavpack (or other lossless codecs like FLAC)? I could pad to 16bit if necessary for a test, but it would be far less than ideal to add a 33% overhead before compression even begins.

Does Wavpack (or FLAC) support compression on 10 or 12 bit waveforms?

Reply #1
Any format that works with lossywav will work with <16 bit input.  The decoder might insist on zero padding to 16 bit when writing to wav (packed 12 bit formats are uncommonly used).

Does Wavpack (or FLAC) support compression on 10 or 12 bit waveforms?

Reply #2
Any PCM integer samples contained in the RIFF WAVE format will have a sample size corresponding to an exact number of bytes, i.e 8, 16, 24 or 32 bits. Audio where bits_per_sample is not divisible by 8 should be contained in a permissible sample size and padded with a number of LSBs (i.e. left shifted by the corresponding number of padding bits).
lossyWAV -q X -a 4 -s h -A --feedback 2 --limit 15848 --scale 0.5 | FLAC -5 -e -p -b 512 -P=4096 -S- (having set foobar to output 24-bit PCM; scaling by 0.5 gives the ANS headroom to work)

Does Wavpack (or FLAC) support compression on 10 or 12 bit waveforms?

Reply #3
Of course, both FLAC and WavPack compress such padded data efficiently: there's no (or almost no) overhead.

Does Wavpack (or FLAC) support compression on 10 or 12 bit waveforms?

Reply #4
How would 10 or 12 bit even be packed? (It can't be packed in WAV, right?) Anyway, the FLAC specification has room for any bitdepth between 4 and 32 bit, but I'm not sure whether the reference encoder accepts those, I never tried.

As others already said, padding is very well possible, because both WavPack and FLAC search for wasted bits, thats the method lossyWAV works. Overhead will be almost non-existent.
Music: sounds arranged such that they construct feelings.

Does Wavpack (or FLAC) support compression on 10 or 12 bit waveforms?

Reply #5
How would 10 or 12 bit even be packed? (It can't be packed in WAV, right?)


10 bits of sample 1, 10 bits of sample 2, etc.

But yes, I was forgetting, WAV does not allow packed samples, or integer numbers of bytes.

 

Does Wavpack (or FLAC) support compression on 10 or 12 bit waveforms?

Reply #6
How would 10 or 12 bit even be packed? (It can't be packed in WAV, right?) Anyway, the FLAC specification has room for any bitdepth between 4 and 32 bit, but I'm not sure whether the reference encoder accepts those, I never tried.

10 bit sample: 0111111111; Requires to be placed in a 16 bit container for WAV, i.e. 0111111111000000. As I said previously, WAV requires sample sizes to be an integer number of bytes.
lossyWAV -q X -a 4 -s h -A --feedback 2 --limit 15848 --scale 0.5 | FLAC -5 -e -p -b 512 -P=4096 -S- (having set foobar to output 24-bit PCM; scaling by 0.5 gives the ANS headroom to work)