Normalize the audio in Airtime ?
  • I see that replay gain function is not used in Airtime 1.7-git's files. I'm having hard time making the replay_gain to work with Airtime's setup. Since we are talking about radio it'll be really amazing if we can analize songs on the fly so the listener can enjoy the station without hearing loudness from time to time etc.

    BTW I've noticed that big internet radio stations do not use replay gain (and do not make dB levels equal for all their audio) which e unbelievable. So let's be professional.

    I guess I can analize the mp3's before import them in airtime (for instance) but it'll be amazing if it can be done on the fly. This is what I'm trying to achieve:

    http://savonet.sourceforge.net/doc-svn/replay_gain.html

    Please advise me how to proceed.

    Perhaps I can modify pypo to change the path sending to liquidsoap as replay_gain:uri like the example from savonet?
  • 8 Comments sorted by
  • Vote Up0Vote Down Paul BaranowskiPaul Baranowski
    Posts: 389Member, Administrator, Sourcefabric Team
    Hi Zdravko -
    We were planning on analyzing the files with replaygain on import. We
    definitely want to do that, but havent had time yet. If you can figure out
    a way to do it on the fly, even better. We haven't looked into very much
    yet so we can't offer you much advice at the moment.

    - Paul




    On Mon, Apr 4, 2011 at 11:01 AM, Zdravko <
    airtime-support@lists.sourcefabric.org> wrote:

    > I see that replay gain function is not used in Airtime 1.7-git's files.
    > I'm having hard time making the replay_gain to work with Airtime's setup.
    > Since we are talking about radio it'll be really amazing if we can analize
    > songs on the fly so the listener can enjoy the station without hearing
    > loudness from time to time etc.
    >
    > BTW I've noticed that big internet radio stations do not use replay gain
    > (and do not make dB levels equal for all their audio) which e unbelievable.
    > So let's be professional.
    >
    > I guess I can analize the mp3's before import them in airtime (for
    > instance) but it'll be amazing if it can be done on the fly. This is what
    > I'm trying to achieve:
    >
    > http://savonet.sourceforge.net/doc-svn/replay_gain.html
    >
    > Please advise me how to proceed.
    >
    > Perhaps I can modify pypo to change the path sending to liquidsoap as
    > replay_gain:uri like the example from savonet?
    >

  • I see.

    Well I'll try to analyze the mp3/ogg files on import by modifying the airtime-import script (free 3rd party tools needed would be mp3gain vorbisgain & ogginfo). I would definitelly share my experience if I have any results with replay gain.
    This project is awesome and it's getting better and better very rapidly so I'd do my best to contribute to the project and the community because I'm really excited about Airtime and my future netradio station.

    And thanks for your quick replies Paul Smile
  • Hi Zdravko,
    The reply_gain is mainly for low-fi environments that can't produce quality audio.
    You have to remember that reply_gain is a trade off between constant db level (RMS) and audio quality.
    If you are running this process on music, the music will sound worse. How much worse depends on the content.
    Heavily compressed music won't suffer too much, but more dynamic content (acoustic, classic) will suffer more.

    Modern pop music (from the late 90s and beyond) already push the dynamic range to the limit. Music content this days is around 6db of dynamic range and average at about -3db RMS (zero is the maximum digital value). You can get more information about it by search the term 'loudness war'.

    I would not recommend to auto run reply_gain on produced music. Only on talking tracks and very low level music.

  • Gal,

    thank you for your comment. I think you mean normalization instead of replay gain ?

    I think however mp3gain ( http://en.wikipedia.org/wiki/MP3Gain ) will be good way to go for mp3 files. I had a script from liquidsoap which used it pretty well. So I'll try to do something similar hopefully with good results.

    On the mp3gain site it also says that it does not degrade the quality:

    "Does normalizing the mp3 degrade its quality?

    No. MP3Gain does not decode and re-encode the mp3 to change its volume. You can change the volume as many times as you want, and the mp3 will sound just as good (or just as bad!) as it did before you started."


    http://mp3gain.sourceforge.net/faq.php

    http://en.wikipedia.org/wiki/Replay_Gain
  • They didn't really write HOW they are adding gain to the sound.
    There's only one way to do it, which is limiting/compressing the signal.
    The fact that they don't damage the file by re-encoding it to MP3 is nice, but they still avoid disclosing the fact
    that they are adding dynamic processing to the signal which lower it dynamic range. Your goal is to preserve high fidelity as possible to the original music.

    I recommend watching this video. It shows how those processes damage the sound.
    http://www.youtube.com/watch?v=3Gmex_4hreQ
  • I think we should add a choice to enable this feature. Maybe for some people, preserving the dynamic range is important, but for others they care more about having each song at the same volume (mp3's and webstreams are compressed already anyway, so we're not dealing with professional grade sound in these formats anyway).
    Airtime Pro Hosting: http://airtime.pro
  • Paul Baranowski wrote on Mon, 04 April 2011 15:36
    Hi Zdravko -
    We were planning on analyzing the files with replaygain on import. We
    definitely want to do that, but havent had time yet. If you can figure out
    a way to do it on the fly, even better. We haven't looked into very much
    yet so we can't offer you much advice at the moment.

    - Paul


    Paul I hope I'm not losing your time but I think I managed to have replay gain analized and amplify level calculated on the fly!

    I just added 2 simple lines in ls_script.liq and now it apears to work really well!

    enable_replaygain_metadata ()
    s = amplify(1.,override="replay_gain",s)


    these 2 lines I've added right after the first declaration of 's' in ls_script.liq (it's exactly right after s = fallback(track_sensitive=false, [queue, default]))

    This is my full ls_script.liq file (check lines 31 & 32 from pastebin) :
    http://pastebin.com/hx6KTxfK

    (The output is slightly modified to encode in aac instead of ogg - it's for my rtsp mobile stream prepared for old phones like SE K750i - I'm using vlc+darwin streaming server for that.)


    How I've tested it? I've cut 5 mp3s with quite different volume levels. Then I played them via airtime as 4 minute shows. The first time it was without replay gain. The second time was WITH replay gain.

    This is screenshot how I dumped the stream remotely with wget ( Very Happy ). The upper is my first try without replay gain, the second with with replay gain as I said:

    http://i56.tinypic.com/2ibgpp4.png
    (the red colors should be the clipping)

    BTW when the replay gain is activated in the logs it says:

    @400000004d9a13e219b087cc 2011/04/04 21:54:16 [src_5324:3] End of the current overriding.
    @400000004d9a13e21a51fbd4 2011/04/04 21:54:16 [src_5324:3] Overriding amplification: 0.604644.

    That floating point number is different each time according to the song of course.


    I've also attached the files I dumped.
    NO-replay-gain.wav & WITH-replay-gain-processing-on-the-fly.wav were downloaded using wget, then opened with audacity in order to cut their blank silence minutes in the beginning and then were exported to wav.

    audio_tests-files.zip contains the 5 files I played in Airtime-1.7-git in this order (top to bottom)

    1ba6o.mp3
    2ba6o.mp3
    3ba6o.mp3
    4ba6o.mp3
    5ba6o.mp3

    I hope this information is helpful.

    P.S. After writing and waiting for files to be attached to this post I just saw you new posts here...

    Ofir Gal, thank you for educating me. I just watched that video & I recalled something similar a friend of mine was telling me some time ago. I agree with you but in my case I have unbelievably limited resources for my radio. It has to be so too low-budget. If I had the oppurtunity I'would do everything the right way but... yeah...


    And Martin I think this is a good option. Sometimes freedom is to have options Smile It will be fine people to be able just to answer 1 bool question whether or not they want replay gain and how to find out more about it for instance.

    BTW by saying that I was thinking of asking you guys would it make sense if you make airtime to ask it's user during installation what type of setup they want - PRO - with the direct show recording from hardware option (I hope I have understood that one fine). And a budget NetRadio which allows almost everyone to put Airtime on cheap VPS somewhere and liquidsoap & airtime are configured in such a way that show recording is done automatically when the Airtime user connects to liquidsoap (actually to liquidsoap's input.harbor). That way users can easylly make live shows conencting from remote PC (like home) liquidsoap will fallback to user's conenction and the user can play files on his computer and stream them to the listeners while speaking one the mic during live show. When the user disconnect liquidsoap just fallbacks to the main airtime stream and everything if really almost transperent to the listeners.

    The setup I'm trying to have is similar btw. Hopefully it'll be working fine Smile
  • Is it easy to install on a servor ?