Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 4 123 ... LastLast
Results 1 to 10 of 36
  1. #1
    Senior Member max.spicer's Avatar
    Join Date
    Apr 2005
    Location
    York, United Kingdom
    Posts
    1,661

    Normalising FLAC files

    I'm just getting towards the end of the horrible task of ripping all my music from CD to flac. I did all of this without any normalisation, but I'm beginning to wonder if this was a mistake. What exactly does the normalisation process do? Can it be done "post-rip" by a Linux tool (my server runs Debian Testing)? Do you lose quality by doing this? It's a bit of a pain to have tracks play at significantly different volume levels when create playlists from different albums, but I'm prepared to put up with this if the alternative is loss of quality.
    Some people think the title of this song is irrelevant,
    but it's not irrelevant - it's a hippopotamus.

  2. #2
    Christian Pernegger
    Guest

    Normalising FLAC files

    The preferred method for doing this is ReplayGain, which stores gain
    correction values for the track on its own and for the track as part
    of its album. Unlike regular normalization this doesn't touch your
    audio data at all - it's only applied at playback time.

    A quick apt-cache search tells me that crip should be able to add the
    relevant info under linux.

    AFAIK the sb doesn't support RG yet, though. An enhancement bug has
    been filed under http://bugs.slimdevices.com/show_bug.cgi?id=1311

    C.

  3. #3
    Senior Member max.spicer's Avatar
    Join Date
    Apr 2005
    Location
    York, United Kingdom
    Posts
    1,661
    Thanks for the information. I've had a quick look at crip, and it looks like it relies on doing the ripping there and then. Unfortunately, I've just about finished doing my ripping so need something that can read through already encoded flac files, calculate replay gain information for them and then write it into the files. If anyone knows a tool that can do this, I'd be very grateful to hear about it!
    Some people think the title of this song is irrelevant,
    but it's not irrelevant - it's a hippopotamus.

  4. #4
    Senior Member jth's Avatar
    Join Date
    Apr 2005
    Location
    Phoenix, AZ, USA
    Posts
    367
    flac replaygain can be applied serverside, as long as you don't mind sending wav to the squeezebox.

    Here's my slimserver-convert.conf file:

    flc wav * *
    [flac] -dcs --force-raw-format --endian=little --sign=signed --apply-replaygain-which-is-not-lossless=a --skip=$START$ --until=$END$ $FILE$
    flc mp3 * *
    [flac] -dcs --apply-replaygain-which-is-not-lossless=a --skip=$START$ --until=$END$ $FILE$ | [lame] --resample 44100 --silent -q 9 -b $BITRATE$ - -

    metaflac --add-replay-gain *.flac will add the replaygain tags to an album's worth of flac files. If you are fortunate to have 1 album per directory it is pretty straightforward to write a script to recursively add replaygain correctly to your albums.

  5. #5
    Senior Member max.spicer's Avatar
    Join Date
    Apr 2005
    Location
    York, United Kingdom
    Posts
    1,661
    Quote Originally Posted by jth
    metaflac --add-replay-gain *.flac will add the replaygain tags to an album's worth of flac files. If you are fortunate to have 1 album per directory it is pretty straightforward to write a script to recursively add replaygain correctly to your albums.
    Aha! I hadn't spotted that metaflac would do that for me. Thanks for pointing that out! I assume that replay gain for FLAC will be added to the SB2 at some point in the future. Does anyone have any further information on that?
    Some people think the title of this song is irrelevant,
    but it's not irrelevant - it's a hippopotamus.

  6. #6
    Senior Member max.spicer's Avatar
    Join Date
    Apr 2005
    Location
    York, United Kingdom
    Posts
    1,661
    My music is all stored in a directory for each album, so I guess I can simply do the following:

    ---
    #!/bin/sh
    basedir=${1:-.}

    IFS="
    "
    for dir in `find $basedir -type d`; do
    metaflac --add-replay-gain "$dir/*.flac"
    done
    ---

    This would work, but would output errors for loads of directories that only contain other directories. Can anyone suggest how to only call metaflac for directories containing flac files?
    Some people think the title of this song is irrelevant,
    but it's not irrelevant - it's a hippopotamus.

  7. #7
    Senior Member jth's Avatar
    Join Date
    Apr 2005
    Location
    Phoenix, AZ, USA
    Posts
    367
    A lazy person might just redirect stderr to /dev/null, or you might try something like [ -f "$dir/*.flac" ] && metaflac --add-replay-gain "$dir/*.flac"

  8. #8
    Senior Member max.spicer's Avatar
    Join Date
    Apr 2005
    Location
    York, United Kingdom
    Posts
    1,661
    I don't think this would work. If you put quotes around the *, it doesn't expand. If you remove them, it expands and test complains that there are too many arguments. I haven't yet tried this though, so I could be wrong.
    Some people think the title of this song is irrelevant,
    but it's not irrelevant - it's a hippopotamus.

  9. #9
    Senior Member jth's Avatar
    Join Date
    Apr 2005
    Location
    Phoenix, AZ, USA
    Posts
    367
    Yes, you are right, I had forgotten that file test operators only work on single files. Perhaps something like this:

    ls $dir/*.flac >/dev/null 2>&1 && metaflac --add-replay-gain $dir/*.flac

    As with any sort of this kind of script, I'd recommend duplicating a portion of your directory tree and testing against that to ensure correct behavior before running against your whole collection.

  10. #10
    Senior Member max.spicer's Avatar
    Join Date
    Apr 2005
    Location
    York, United Kingdom
    Posts
    1,661
    Ooh, nice hack! The joys of UNIX shell scripting. :-) That said, I had the misfortune to have to right some Win95 batch files the other day. You have to use GOTOs for goodness sake!
    Some people think the title of this song is irrelevant,
    but it's not irrelevant - it's a hippopotamus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •