Tiny Core Linux

Tiny Core Extensions => TCE Q&A Forum => Topic started by: SamK on December 01, 2010, 04:07:48 AM

Title: Issues with Normalize-Audio
Post by: SamK on December 01, 2010, 04:07:48 AM
normalize-audio
Code: [Select]
error while loading shared libraries: libmad.so.0: cannot open shared object file: No such file or directorySeems to be a missing dependency - libmad.tcz


normalize-mp3
Code: [Select]
sh: normalize-mp3: not foundwhich normalize-mp3
Code: [Select]
/usr/local/bin/normalize-mp3   
Title: Re: Issues with Normalize-Audio
Post by: gutmensch on December 01, 2010, 04:20:23 AM
it's not only missing this one... normalize-mp3 and -ogg are only perl scripts referring to normalize-audio. they have a wrong shebang as well. and telling from the perl scripts they seem to need at least (including libmad)

audiofile.tcz
libmad.tcz
lame.tcz
mpg123.tcz
flac.tcz
vorbis-tools.tcz
perl5.tcz

updated dep list but shebang is still wrong, definitely needs some rework...
Title: Re: Issues with Normalize-Audio
Post by: SamK on December 01, 2010, 05:24:09 AM
...normalize-mp3 and -ogg are only perl scripts referring to normalize-audio.
I took normalize-mp3 (in the .tcz) to be this one as referenced in the on line readme:
http://normalize.nongnu.org/README.html and thought it should be be run independently.
Quote
5. Can normalize operate directly on mp3 files?
[...]
If you'd rather change the volume of the mp3 audio data itself, you still have to decode to WAV, normalize the WAV, and re-encode. A script, normalize-mp3, is included in the normalize distribution to do this for you.
This is exactly what I want to do.  I prefer not to set the RVA2 frame in an ID3v2 tag.
   
Title: Re: Issues with Normalize-Audio
Post by: gutmensch on December 01, 2010, 05:36:36 AM
as far as I know there is no way to change the loudness value of the encoded mpeg data directly, you can only set some flags like replaygain, which have to be considered by the music player - if not then they are disregarded at all.

normalize-mp3 calls mpg123 to decode and lame to re-encode the file, in the middle of these steps it normalizes with normalize-audio (over simple bitstream wav data).

so normalize-mp3 cannot be run "independently" without normalize-audio, lame, mpg123, etc. (is my guess).
Title: Re: Issues with Normalize-Audio
Post by: SamK on December 01, 2010, 06:02:33 AM
Perhaps my clumsy language did not help.

Decoding to wav, normalizing, then re-encoding to mp3 is what I prefer to do. 

By "independently" I meant that, after reading the on-line readme, I thought that normalize-mp3 is a script that requires its own start command at the command line which conducts these actions. 

The default action of normalize-audio seems to be to adjust the RVA2 frame in an ID3v2 tag to achieve normalization without the decoding/re-encoding steps.  This is what I want to avoid.   
Title: Re: Issues with Normalize-Audio
Post by: gutmensch on December 01, 2010, 06:39:58 AM
Quote
The default action of normalize-audio seems to be to adjust the RVA2 frame in an ID3v2 tag to achieve normalization without the decoding/re-encoding steps.  This is what I want to avoid.

the readme states that normalize-audio can be used to directly adjust the volume of an mp3 file without recoding it with some sort of ID3v2 frame data. but "normally" it computes peak and volumes of samples of wav files and adjusts this bitstream data (this is what's not written there). so if I read it correctly you can use normalize-audio to write RVA tags on mp3 files or you can use normalize-mp3, which recodes your mp3 files completely. normalize-mp3 calls normalize-audio either way when it decoded the mp3 to a wav file.
Title: Re: Issues with Normalize-Audio
Post by: SamK on December 01, 2010, 08:17:23 AM
...you can use normalize-audio to write RVA tags on mp3 files or you can use normalize-mp3, which recodes your mp3 files completely.
This is my understanding also and I now have it working on this basis.  Thanks for the assist.

It leaves one remaining issue.  When re-encoding the normalized wav file normalize-mp3 uses a lame bitrate of 128kps.  No matter what combination of switches are used for normalize-mp3 or lame I cannot find one which works at other than 128kps.  Is there something I am missing? (I am going "snow-blind on this now).
   
   
Title: Re: Issues with Normalize-Audio
Post by: gutmensch on December 01, 2010, 02:53:17 PM
That's strange, I took a deeper look into normalize-mp3. It searches for the path of the lame binary and then uses the switch -b for the desired bitrate. lame --help shows that option too so theoretically it "should" work with

Code: [Select]
normalize-mp3 --mp3encode=/usr/local/bin/lame -b 192 file
(take a look at the function starting on line 253).
When encoding with lame I would prefer the included presets like extreme or insane but since that is not available you might even copy the normalize-mp3 script to your own home/tc/bin/ folder and modify it to your needs. ;)
Title: Re: Issues with Normalize-Audio
Post by: tinypoodle on December 01, 2010, 11:32:16 PM
Have in mind that as a general rule, reencoding lossfully compressed audio with lossful compression will always result in quality loss.

Of course the judgment of tolerability of such lays in the ear of the beholder   ;)
Title: Re: Issues with Normalize-Audio
Post by: SamK on December 02, 2010, 12:34:00 AM
Have in mind that as a general rule, reencoding lossfully compressed audio with lossful compression will always result in quality loss.

Of course the judgment of tolerability of such lays in the ear of the beholder   ;)
If absolute quality were the principal concern I would use different tools/processes.  In this case it is not a primary driver.
   
Title: Re: Issues with Normalize-Audio
Post by: SamK on December 02, 2010, 12:53:29 AM
That's strange, I took a deeper look into normalize-mp3. It searches for the path of the lame binary and then uses the switch -b for the desired bitrate. lame --help shows that option too so theoretically it "should" work ...

When encoding with lame I would prefer the included presets like extreme or insane but since that is not available...
I have found a working solution - including a way to use Lame presets. It relies on the inclusion of normalize-audio variables and quoting the command.  Some examples follow.  Might they be worth including in the .info file?

Each example normalizes by decoding to a wav file, normalize, and re-encode to mp3.

Examples - to normalize a single mp3.
Code: [Select]
Using a constant bitrate to re-encode:
normalize-mp3  "--mp3encode=lame -b bitrate %w %m"  "filename.mp3"

Using a lame preset to re-encode:
normalize-mp3  "--mp3encode=lame --preset type %w %m"  "filename.mp3"


Examples - to normalize all mp3s in the current directory, with tracks retaining the same volume relative to each other.
Code: [Select]
Using a constant bitrate to re-encode:
normalize-mp3  --batch  "--mp3encode=lame -b bitrate %w %m"  *.mp3

Using a lame preset to re-encode:
normalize-mp3  --batch  "--mp3encode=lame --preset type %w %m"  *.mp3