News for hackers. Stuff that matters.
Re:Lyra V2 – a better, faster, and more versatile speech codec by dale_glass on Saturday October 01, 2022 @06:37AM (#33045533)
We support that already, yup. But it never hurts to see if there's something better than that out there.
Re:Lyra V2 – a better, faster, and more versatile speech codec by orlp on Tuesday October 04, 2022 @12:12PM (#33082483)
You can bootleg your own fast lossless codec by doing delta-encoding on the raw PCM to get a lot of zeros and then feed it through an off-the-shelf fast compressor like snappy/lz4/zstandard/etc. It won't get remotely close to the dedicated audio algorithms, but I wouldn't be surprised if you cut your data size by a factor 2-4 and essentially no CPU cost compared to raw uncompressed audio.
Re:Lyra V2 – a better, faster, and more versatile speech codec by muziq on Wednesday October 05, 2022 @05:07PM (#33101255)
You’ve not done this before have you ?
Re:Lyra V2 – a better, faster, and more versatile speech codec by orlp on Thursday October 13, 2022 @10:15AM (#33191258)
I haven't, but now I have. I took https://opus-codec.org/static/examples/samples/music_orig.wa... from https://opus-codec.org/examples/. Then I wrote the following snippet of Python code:

    from scipy.io import wavfile
    import numpy as np
    import zstd

    sampling_rate, samples = wavfile.read(r'data/bootleg-compress/music_orig.wav')
    orig = samples.tobytes()

    naive_compressed = zstd.ZSTD_compress(orig)
    deltas = np.diff(samples, prepend=samples.dtype.type(0), axis=0) # Per-channel deltas.
    compressed_deltas = zstd.ZSTD_compress(deltas.ravel()) # Interleave channels and compress.

    decompressed_deltas = np.frombuffer(zstd.ZSTD_uncompress(compressed_deltas), dtype=samples.dtype)
    decompressed = np.cumsum(decompressed_deltas.reshape(deltas.shape), axis=0, dtype=samples.dtype)
    assert np.array_equal(samples, decompressed)

    print(len(orig))
    print(len(naive_compressed))
    print(len(compressed_deltas))
giving:

    17432876
    15518973
    12817602
Looks like my initial estimation of 2-4 was way off (when FLAC achieves ~2 this should've been a red flag), but you do get a ~1.36x reduction in space at basically memory read speed.
Re:Lyra V2 – a better, faster, and more versatile speech codec by zinekeller on Saturday October 01, 2022 @07:05AM (#33045653)
While I also want a low-computation codec that can save space, the historical use cases unfortunately assumes a lot more CPU power to be compensated for a lot less bandwidth, so there's little research in this area, and there's no real incentive to make something like ProRes and DNxHD as if you are editing audio the SSD speeds has been so fast that you'll run into CPU problems first.