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: lossyWAV 1.4.2 Development (was 1.5.0) (Read 107937 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: lossyWAV 1.4.2 Development (was 1.5.0)

Reply #100
Internally, block size is determined by sample-rate, e.g. 512 samples for 44.1/48 kHz; 1024 samples for 88.2/96kHz; etc..

FLAC blocksize can be varied independently of lossyWAV processing block-size.

Recently I have been using foobar2000 to convert 44.1/16 FLAC to lossyFLAC - setting foobar2000 to output 24-bit as input to lossyWAV (and scaling by 0.5 to give the ANS "room" to work).

--static and --dynamic set the minimum-bits-to-keep for each sample from a fixed datum (--static) or a dynamic datum based on block noise (--dynamic).
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)

Re: lossyWAV 1.4.2 Development (was 1.5.0)

Reply #101
Internally, block size is determined by sample-rate, e.g. 512 samples for 44.1/48 kHz; 1024 samples for 88.2/96kHz; etc..
Yes I've read about this; I was asking if it's possible to alter this to let LossyWAV use, for example, block size of 4096 samples for 44.1 kHz.

a fan of AutoEq + Meier Crossfeed

Re: lossyWAV 1.4.2 Development (was 1.5.0)

Reply #102
Would this also work for MP3's? 
I ask because VBR MP3's could do either nicer or smaller if the sample rate (bitdepth) is reduced/optimized before encoding. 

Re: lossyWAV 1.4.2 Development (was 1.5.0)

Reply #103
It won't work for MP3.

Re: lossyWAV 1.4.2 Development (was 1.5.0)

Reply #104
It won't work for MP3.
Indeed.

@Max9000The method used by lossyWAV doesn't work with MP3 - and lossyWAV isn't competitive in terms of bitrate with MP3 either.
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)

Re: lossyWAV 1.4.2 Development (was 1.5.0)

Reply #105
Hi Nick.  And thanks!

I asked because the barrier to good small mp3 files was CD 44100 sample-rate spec (harms/exhausts small-rate mp3's); but, high quality small files can be had with 32000 sample rate, so long as it wasn't done with the mp3 codec's inbuilt fast-n-dirty resampler.   Foobar's PPHS set to Ultra will do much better than the codec's inbuilt resampler.

The trouble with non-adaptive sample rate reduction is noise floor (like a slower LP or tape). 

So, I'm curious about PPHS-ultra@32000 > LossyWAV > WavPack lossy@460 (also quality max) > GXlame -V30.

Basically, if a LAME variant can't toss the extra bits, then an interstage of WavPack might get it.  I'm just not sure if I got the chain right.  Where is the best spot for the 32000 conversion? 

P.S.  Application is internet radio. 
Could be really useful if:  Archive quality at smaller file size > also results in smaller production bandwidth consumption.  Is that feasible? 

Re: lossyWAV 1.4.2 Development (was 1.5.0)

Reply #106
The trouble with non-adaptive sample rate reduction is noise floor (like a slower LP or tape). 

I don't fully understand your idea, but LossyWAV increases noise floor, not decreases it. So this --
So, I'm curious about PPHS-ultra@32000 > LossyWAV > WavPack lossy@460 (also quality max) > GXlame -V30.
-- makes zero sense.

Re: lossyWAV 1.4.2 Development (was 1.5.0)

Reply #107
It would make more sense if I could use LossyWAV as an opportunistic resampler 44100 (or any) input, to 32000 (or lower) output. 
That would actually make smaller WAV files which could be used for smaller AAC, smaller MP3, etc...

Perhaps it is a prospective cool new feature for LossyWAV 1.5.0?

Re: lossyWAV 1.4.2 Development (was 1.5.0)

Reply #108
The trouble with non-adaptive sample rate reduction is noise floor
Aren't you confusing downsampling with bit depth reduction?

Re: lossyWAV 1.4.2 Development (was 1.5.0)

Reply #109
The trouble with non-adaptive sample rate reduction is noise floor
Aren't you confusing downsampling with bit depth reduction?
Indeed - lossyWAV does not resample the audio.
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)


Re: lossyWAV 1.4.2 Development (was 1.5.0)

Reply #111
Wanted to report on the savings on my FLAC library.

I used the POSIX port [1], as I am on Linux. Compiled flawlessly at first try! I converted my lib to standard losswav and standard FLAC compression. Used the following line:

Code: [Select]
flac -d "$i" --stdout --silent|lossywav - --stdout --quality standard --stdinname -- |flac - -b 512 -o "${i%.*}.lossy.flac" --silent &&  metaflac --export-tags-to=- "$i" | metaflac --import-tags-from=- "${i%.*}.lossy.flac"

Savings: 279GB -> 125GB or about a 60% reduction. Not bad! Thanks to all involved!

[1] https://github.com/MoSal/lossywav-for-posix

Re: lossyWAV 1.4.2 Development (was 1.5.0)

Reply #112
Also, how's1.4.2/1.5.0 dev going? Things look a bit stalled ;)

Re: lossyWAV 1.4.2 Development (was 1.5.0)

Reply #113
Also, how's1.4.2/1.5.0 dev going? Things look a bit stalled ;)
It was released, here: https://hydrogenaud.io/index.php?topic=112649.0 - just over five years ago.

It's not under development - as I haven't identified any required additions or modifications.
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)

Re: lossyWAV 1.4.2 Development (was 1.5.0)

Reply #114
Also, how's1.4.2/1.5.0 dev going? Things look a bit stalled ;)
It was released, here: https://hydrogenaud.io/index.php?topic=112649.0 - just over five years ago.

It's not under development - as I haven't identified any required additions or modifications.

Hi,

I was wondering... Is it safe to turn off noise shaping (-s o) at higher settings (standard and higher /quality 2.5 and up)?
I've noticed huge increase in encoding speed and I didn't find issues on few critical samples that I've tested (in short: I've got fast encoding speed without obvious quality loss).
What is worst case scenario on disabled noise shaping at higher bitrate? I'm considering to use lossywav/flac at 450-480k.
lame --abr 288 -f --lowpass 17 (+ mp3gain@92 dB)

Re: lossyWAV 1.4.2 Development (was 1.5.0)

Reply #115
What is the worst-case scenario on disabled noise shaping at a higher bitrate? I'm considering using lossywav/flac at 450-480k.
dither/noise-shaping standing for truncation distortion noise artifacts. if you hear that you should turn on dither/noise shaping
Opus 96-192Kbps and Aac-lc 96-128Kbps
Source 32bit floating point is fine don't need dithering (dB noise -758dBFS that's a lot)
Source Fixed Point aka Integer should use dithering to prevent truncation distortion
Source is RAW


Re: lossyWAV 1.4.2 Development (was 1.5.0)

Reply #117
I find it interesting how it struggles when there's super low low-pass filter in music. For example lossyWav can't compress Diablo Swing Orchestra - Swagger And Stroll Down The Rabbit Hole album effectively - I get 700-800 kbps at standard preset. The reason seems to be the terrible sound on the album that is lowpassed at 13 khz.
Opus VBR 256 + SoX

Re: lossyWAV 1.4.2 Development (was 1.5.0)

Reply #118
The reason seems to be the terrible sound on the album that is lowpassed at 13 khz.
In this case you could use the "--limit <n>" option to reduce the upper frequency limit that the analysis uses. The minimum allowed value is 12.5kHz.
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)

Re: lossyWAV 1.4.2 Development (was 1.5.0)

Reply #119
This seems like something that could be circumvented by taking noise shaping into account during the analysis phase (if noise shaping is enabled, of course), because it seems as if the analysis assumes flat (white) noise.

Re: lossyWAV 1.4.2 Development (was 1.5.0)

Reply #120
Please find attached a new beta release of lossyWAV. Attachment removed as expired.

lossyWAV beta 1.4.3a, 21/06/2023 (expires 31/07/2023)
  • Minor bug identified and fixed: interpolation used for non-integer quality presets below zero extrapolated "backwards" using the following two integer presets rather than interpolating between the integer presets immediately above and below the selected value.
  • Quality range extended downwards with the addition of two new presets below X, extraportable (-q -5):
    • U, unadvised (-q -7)
    • A, aggressive (-q -6)
  • New adaptive shaping variant: weighted (W) added. Uses a weighted average of all active FFT analysis lengths to create the desired shape for the adaptive shaping method to work with. Shown in testing to reduce output size by c.0.4% (at -q -7).

General Comment
From experience using lossyWAV with adaptive shaping enabled to process 16-bit audio (primarily from CDs), using the foobar2000 commandline encoder to process FLAC to lossyFLAC, setting the converter to "lossless (or hybrid)" and selecting 24-bit in the "Highest BPS mode supported" dropdown, setting "Output bit depth" to 24-bit in the Converter Setup dialog dropdown, then adding "--scale 0.5" to the lossyWAV element of the commandline encoder settings (to losslessly scale the 16-bit-sample-in-a-24-bit-container) will usually result in the output files being smaller than they would otherwise have been, up to c.1% smaller at lower quality presets. I attribute this to giving the adaptive shaping method "room for activities" by allowing samples to exceed what would otherwise have been full scale in the unscaled 16-bit audio.
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)

Re: lossyWAV 1.4.2 Development (was 1.5.0)

Reply #121
LossyWAV is fantastic.
I found LossyWAV to be excellent at compressing 24Bit 96KHz stereo LPCM to 640~768Kbps LossyFLAC. This is a reasonable bitrate and there are no phase problems from SRC. I tried to test LossyWAV 96KHz SINAD. it was about 128~144dB from 1KHz to 20KHz Sine signals at a volume of -12dB~0dB, and the IMD was satisfactory. It outperforms AAC 96KHz at the same bit rate, and Ogg 96KHz at 512Kbps.

But there's an idea. Is it possible to use blue noise or violet noise as a noise shaping dithering tool to reduce the bit depth for 96KHz PCM like the wavpack? In this way the SNR in the auditory sensitive frequency domain can be further improved.

Thanks again for your excellent work.

Re: lossyWAV 1.4.2 Development (was 1.5.0)

Reply #122
I'll take a look at implementing blue and violet noise shaping options for testing in the next beta version.
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)

Re: lossyWAV 1.4.2 Development (was 1.5.0)

Reply #123
Please find attached a new beta release of lossyWAV.

lossyWAV beta 1.4.3b, 06/08/2023 (expires 30/09/2023)
  • Minor bug identified and fixed: tuning of spreading method when additional analyses were added while using --altspread parameter was incomplete, now tuned for all analyses.
  • New optional fixed noise shaping added using an optional numeric parameter, in the range 0.0 to 4.0, after "fixed" in "--shaping", which shapes the added noise somewhere between white noise (0.0), blue noise (0.5), violet noise (1.0) with higher values included for testing purposes;
  • New adaptive shaping variant: weighted (W) modified. Now takes a numeric parameter between 0 and 3, implementing two boolean flags; option 1 makes a correction when "stretching" the results of shorter analyses to the same length as the adaptive shaping analysis length to take account of the linear interpolation method used; option 2 changes the default power to which values are raised when creating the desired noise shaping curve from 0.5 to 0.75. Selecting 0, e.g. --shaping weighted 0, as the value activates neither, 3, e.g. --shaping weighted 3, activates both.
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)

Re: lossyWAV 1.4.2 Development (was 1.5.0)

Reply #124
I did a 96KHz lossy compression SNR comparison based on cmpute's project: github.com/cmpute/audio-codec-benchmark.
Based on previous experience, three noise shaping options were chosen as representative: hybrid, fixed, and off.

The test-audio files tested combined a wide range of music genres and a variety of mastering styles, and I think that in the Noise-Rock, LossyWAV performed the best.

https://imgur.com/a/aOOldgi
(For detailed data, please see the annex.)

LossyWAV (-q 4~10 -a 3 -s h/f/o -l 16000 )+ FLAC (-5 -b 1024) consistently outperforms common codec ( AAC (QAAC, NeroAAC, FDK-AAC), Ogg Vorbis, and WMA PRO) in terms of SNR/Spectrogram-error and A-weighted SNR/Spectrogram-error when the bit rates are approximated. But achieving a bit rate below 512Kbps with 96KHz LossyFLAC is difficult, and at that point, while the SNR may be slightly higher than AAC, the audible advantage is lost. And it's not listed in the charts, but I compared it to commercial lossy encoders such as DTS 24/96 768Kbps & 1509Kbps, which actually doesn't perform as well as LossyFLAC in terms of listening and test data.

Among them, the LossyWAV with fixed 16KHz noise shaping has a very good SNR, and my actual ABX comparisons also felt less lossy, sounding more like a lossless audio with dithering.
However, the fixed noise shaping has worse compression ratio than the hybrid shaping for the same quality parameters.
If noise shaping is turned off, the difference to Hybrid mode is actually not that great aurally, but the SNR ratings will be better and the encoding will be fast. But down below q 1, hybrid shaping is audibly more comfortable.

https://imgur.com/a/OnHuDWN
more info here:
https://imgur.com/a/FcxZwRJ

I also wrote a SINAD and RMSE test, and the 24Bit LossyWAV has a SINAD performance that exceeds the 16Bit LPCM.
This performance is very impressive, nowadays narrow dynamic range pop music is more important to consider the performance of lossy codec at -0dB than wide dynamic range classical music.

Aurally, fixed noise shaping is better for high bitrates, just as wavpack's purple-like noise shaping doesn't work well at low bitrates lossy mode.
However, I tested it a few years ago. FLAC compresses purple/blue noise at the same level more efficiently than high-pass dithering noise. It seems that this may be the reason why wavpack lossy has a lower bitrate but approximating A-weighted SNR.

But considering the performance requirements and compatibility of decoding FLAC -5-b 1024.
There is no doubt that LossyFLAC has a reliable and reasonable 96KHz lossy compression performance.