Sound Processing in Airtime / Audio Processing with Liquidsoap
  • Hi,
    A few days ago, while I was looking for a new broadcast solution for a new webradio project, I've discovered Airtime. The possibilities are very interesting. I love the smart blocks idea, the big schedule and all the technical addons, auto-post to soundcloud etc. Coming from Sam Broadcaster, I find in Airtime and liquidSoap a totally different approach to radio-programming.

    But I'm also really concerned by the sound processing aspect which is essential in my opinion for a good listening experience.

    I've read the liquidSoap docs and I can see that liq includes a sound processing part. I've found a concrete example of classic sound chain processing in use in this code:

    gate + multiband compression + final comp + limiter


    # Audio processing

    # Gate the input for starters, stops noise from clobbering things in silent periods.
    source = ladspa.gate(source, threshold = -60.0, attack = 0.15, hold = 1.0, decay = 200.0, range = -25.0)
    # Multiband compression - split up, compress, recombine, sky does it all, but is not very configurable. 3-band.
    source = sky(source)
    # Now overall compression, faster attack, harder ratio, mostly RMS based.
    source = compress(source, attack = 5.0, gain = 8.0, knee = 10.0, ratio = 5.0, release = 100.0, threshold = -18.0, rms_window = 0.7)
    # Normalize, with a higher threshold to stop suck-up.
    source = normalize(source, target = -1.0, threshold = -65.0)
    # Limiter, this one's a scaling one which limits nicely and without artefacting mostly
    source = ladspa.tap_limiter(source, limit_level = -0.5)
    # And a final limiter - this should never really get hit, but stops anything nasty hitting the DAC. Highly peak-focused.
    source = limit(source, threshold = -0.2, attack = 2.0, release = 25.0, rms_window = 0.02)
    # Stick a meter on this. This is queryable via telnet. Force the source name.
    source = server.rms(source, id="input_source")


    Something like that would be for sure, more convenient for me than a simple leveler, which I think is Replay gain used in Airtime 2.5

    So, my questions are:

    - do you use the liquidSoap audio processing in your stream ?

    - if so, is it hard to implement and use w/ airtime ?

    - are the results ok ? ( I don't expect an Orban processing, but I'm curious about the result)

    - have you found any other workaround to process the sound of your radio ? Like Jack + DSP like Stereo Tool or any other solution.

    I'm using Airtime on Ubuntu in Virtual Box on a Mac, so the audio tests are not easy to accomplish. Beside that, I'm new to scripting etc, and more used to hardware compression... I was also thinking of livestreaming from my Mac, most of the time , process the sound locally, and stream to Airtime Pro, manage all the schedules, recordings, shows etc, from there, but the sound processing problem would be the same, and I can't find a good automation software on Mac, something that would have all the features of Airtime is quite unimaginable :-)

    I hope somebody will have time to answer,

    thank you !
  • 16 Comments sorted by
  • Vote Up0Vote Down Daniel JamesDaniel James
    Posts: 844Member, Sourcefabric Team
    Hi John, you have the option to route audio from Airtime's soundcard output to a hardware processor such as an Orban Optimod, or to modify the Liquidsoap script as in the example you give, or to route Liquidsoap output via JACK through software processing (such as JAMin). Our standard Liquidsoap package does not currently include JACK support, but it is quite easy to recompile Liquidsoap and enable this feature, or use Debian/Ubuntu's version of Liquidsoap with the plugin liquidsoap-plugin-jack:

    http://packages.ubuntu.com/saucy/liquidsoap-plugin-jack

    The use of ReplayGain is a very different approach because it relies on pre-playout analysis of files. Another variation on this idea are the automated pre-production services which adjust the level of speech packages. However, neither of these ideas can help process true live broadcasts.

    My personal take on this issue is that it depends what kind of music you want to broadcast. If you are broadcasting contemporary pre-recorded music with lots of dynamic range compression I am sceptical that listeners can benefit from further compression and limiting, especially since the market for better quality headphones seems to have taken off in recent years. Also, home and in-car amplifiers have become more powerful and so there is little chance of output not being loud enough to hear on the listener side.

    To my ears, using good quality source files with ReplayGain produces excellent results, so I would recommend double-blind testing this approach against the Optimod sound at an equivalent output level before concluding that post-processing was still necessary. If broadcasting live speech together with music, I would personally look at dynamics processing on the mic input side before relying on output processing to balance the mix.

    Cheers!

    Daniel
  • Hi Daniel,
    Thank you very much for your detailed answer. I understand your opinion.
    As a matter of fact, my music programmation is very eclectic and the levels can change a lot between vinyl records from the 50's, ambient, classical music, electronica etc.

    I don't like aggresive processing and "hard loudness" like most fm station are used to broadcast nowadays, but I like to "normalize" the stereo field, apply a multiband comp on the sound, and "color" the sound a little bit. I'd be happy if I could route the sound to my UA soundcard and through a LA2A + a Precision multiband. Or even, better, an Optimod :-)

    My first tests with Replay Gain were not very positive. Sometimes, I've noticed an indesirable saturation (for eg; on low volume level tracks w/ deep basses like an Aphex Twin Ambient work), even at 0db. I think a quality of the files is pretty decent. 

    But, once again, I don't have a perfect environment to run to tests at the moment. I use Airtime on Ubuntu 12.04 on VirtualBox on a Mac and I'm having trouble routing the sound correctly between the guest and the host. I'm completely new to ALSA etc...

    Now that I've finally found a smart automation system, I will try to go further and learn how to edit the scripts, recompile etc. like you suggest, and find my sound :-)

    Thanks again !
  • Vote Up0Vote Down Daniel JamesDaniel James
    Posts: 844Member, Sourcefabric Team
    Hi John, we would be very interested to hear your test results. If using VirtualBox you will probably need to tinker with the audio hardware emulation on the guest OS. In Settings -> Audio, what do you have set for Host Audio Driver and Audio Controller?

    ReplayGain should not be making your files sound any worse - if it does, that could be a bug in Airtime. What does the Airtime library say the correction value is for the Aphex Twin track you mention?

    A good discussion of the problems in balancing older and newer music can be found in the article: http://www.soundonsound.com/sos/sep11/articles/loudness.htm

    Cheers!

    Daniel
  • Hi Daniel,

    Regarding the technical details:
    Core Audio + ICH AC97 It was the only combination that was working for me in VirtualBox. Also, I had to route the sound to my Universal Audio soundcard via Soundflower on the mac.
    I will try to record the tests with ReplayGain as soon as I find a workaround to simplify this audio installation between VirtualBox and osX... I have to check the Airtime library and I'll tell you what was the correction value.

    About the sound processing:
    Thanks for the link about Loudness war, About radio processing, loudness etc. this link was also interessant. http://www.radioiloveit.com/radio-production-radio-jingles-radio-imaging/omnia-radio-sound-processor-and-audio-signal-processing-tips/ 
    Previously, we mentioned Orban... Well, I've found out that Omnia has a new sound processing software that has an "Undo" feature. Basically, it cleans up the redcordings , and then, apply a sound treatment on them. Not a solution to end the loudness war, but maybe something to avoid double compression.

    Best,
  • The correction value was -1.79 / It's a FLAC file


    Edit / 
    I've doubled check and had a look at the wave, and it seems that the saturation was "normal" for this track...
    So, regarding the Aphex Twin example, it's a false alarm. ReplayGain is not responsible.
    Really sorry.
    Post edited by John Elberstein at 2013-11-26 10:25:58
  • Vote Up0Vote Down Daniel JamesDaniel James
    Posts: 844Member, Sourcefabric Team
    No problem, a false positive or two is to be expected along the way :-)

    Another issue I have found is where the track was taken from a compilation which was badly remastered. One time I actually thought my tweeters had blown, but inspection of the waveform showed the track had been severely clipped. Just recently I had another issue where tracks from an old CD-R were distorted throughout, possibly because the dye layer had started to break down.

    Cheers!

    Daniel
  • Hello, 

    I managed to rebuild liquidsoap with jack output and finally managed to route to a dsp (stereotool) and all works fine. I can route the output from the dsp to, for example, darkice. But it would be more nice to send the audio output of the dsp back into the airtime stream system. Is this possible by modifying the liq script to read jack and send this to the icecast or shoutcast server as configured in airtime? This will will keep the data to the stream servers unharmed, only the audio is bypassed through the dsp program.

    Thanks for any reply,

    Huub
    (sorry for my Dutch-English grammar)

  • Vote Up0Vote Down Daniel JamesDaniel James
    Posts: 844Member, Sourcefabric Team
    Hi Huub, your grammar is fine :-)

    It sounds like you want to use Stereotool as an 'insert' effect so that the output stream parameters can still be configured via the Airtime admin interface. In principle, that sounds feasible to me, by modifying the Liquidsoap script as you suggest. You would probably also need to modify Airtime's model of the script so that it did not reset your Liquidsoap configuration each time the stream settings page was updated.

    Good project, please let us know how you get on!

    Daniel
  • Hello Huub!
    I'm interested too how to process audio with stereo tool.
    Please share how did you do.

    Thx
    Peppi
    (sorry my pour english)
  • This is my two cents.
    Where your software has to
    • interface with any external instrument use Hardware. Like if you have to monitor or send to a transmitter
    • interface with any stream ,web or other software  use any processing software,from previous experience the best way is to install that processing on another machine for editing or processing

    From my observation ,the more processor on one machine the more load you put on it and especially wit LS you will have to do a lot of catchup if you do not have good processing power.


    That's my OPIN

    @Peppi

    Peppi said:

    Hello Huub!

    I'm interested too how to process audio with stereo tool.
    Please share how did you do.

    Thx
    Peppi
    (sorry my pour english)


    I do not use this but it seems that this is a I/O software where as ardour is Jack (i might be wrong)
    Post edited by Voisses Tech at 2014-03-10 22:39:17
    Anyone reading this a find it funny about my grammar , I make no apology ,Go get a translator.
    "The Problem with education today is that it takes a university degree to switch on a light bulb"
    "You learn from your mistakes but wise people learn from others mistakes avoid Making mistakes there is not sufficient rooms to make them"
    "Innuendo","If's","Assumptions" and "Fear" are for politician.Who,What,where,When and How are for those seeking knowledge and care about Humanity.
    "I might be in Mud but that does not Make me a Wild Hog(pig)"
    “Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage to move in the opposite direction.”
    "The only thing that remains constant is change itself"
    May the force be with you,until our path or destiny bring us in tandem.
  • i would love to see the ability to change liquidsoap audio processing settings in the preferences menu other than replay gain...
  • Follow my comment here
    on processing  and also look at the python script in the source code how the replay gain is handle.

    This recommendation to me would appear as making a GUI for Sound processing by Liguidsoap within Airtime and recompiling as some of these plugins are not compiled in the current version of liquidsoap used by Airtime

    http://forum.sourcefabric.org/discussion/comment/29011#Comment_29011
    Anyone reading this a find it funny about my grammar , I make no apology ,Go get a translator.
    "The Problem with education today is that it takes a university degree to switch on a light bulb"
    "You learn from your mistakes but wise people learn from others mistakes avoid Making mistakes there is not sufficient rooms to make them"
    "Innuendo","If's","Assumptions" and "Fear" are for politician.Who,What,where,When and How are for those seeking knowledge and care about Humanity.
    "I might be in Mud but that does not Make me a Wild Hog(pig)"
    “Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage to move in the opposite direction.”
    "The only thing that remains constant is change itself"
    May the force be with you,until our path or destiny bring us in tandem.
  • Hi guys,
    i hope you are all fine.
    I managed to process audio with stereotool using the fantastic liquidsoap by using the command line version of stereotool with the help of 2 named pipes, as follows:

    mkfifo /tmp/audioin.pcm
    mkfifo /tmp/audioout.pcm

    nohup ./stereo_tool_cmd_64 /tmp/audioin.pcm /tmp/audioout.pcm -s ./youfm_rhfat.sts & (the youfm_rhfat.sts is my preset file, you may create a preset using a gui version of stereotool, save the preset and then use it in the above command line).


    and now the liquidsoap part:

    Assuming that we have a liquidsoap object named radio (we have defined already in "radio" the playlists we want etc), now its time for the output:

    output.file(%wav(stereo=true, channels=2, samplesize=16, header=true, duration=1.),
    "mkfifo /tmp/audioin.pcm",
    radio
    )


    The above chunk, outputs audio to the named pipe which stereotool reads from. Then, in the same file we do the audio reading stuff:

    s = mksafe(input.external("dd if=/tmp/audioout.pcm 2>/dev/null")) // we read the data into object s


    Now, we are able to use object s as usual in liquidsoap, for example, to stream the produced audio to a shoutcast server:

    output.shoutcast(%mp3, host="server",
    port=8899, password="password",
    s)

    The only problem with the above process, is that if you need to do any changes in the configuration and you have to kill the liquidsoap process, you should "kill -9" the "dd if..." process manually because it remains active, but i dont think that is such a big deal :)


    Good luck to everyone who want stereotool process with liquidsoap !

    Diamantis


  • Thanks for your post Diamantis! This is what I'm looking for.

    Sadly, it doesn't work as expected for me. 

    First, When I'm trying exactly what you wrote, StereoTool doesn't receive any audio and thus doesn't send back anything.

    Then, I'm trying something else. If I edit
    output.file(%wav(stereo=true, channels=2, samplesize=16, header=true, duration=1.), "mkfifo /tmp/audioin.pcm", radio )
    to
    output.file(%wav(stereo=true, channels=2, samplesize=16, header=true, duration=1.), "/tmp/audioin.pcm", radio ) 

    StereoTool starts to process and I receive the audio on the output but it is unprocessed (even though my STS isn't bypassed at all).

    Do you know what's wrong? Thanks!
  • Hi BagPttx and sorry for my late response,

    assuming that you followed my tutorial ( by creating both audioin.pcm and audioout.pcm etc), make sure that you have successfully loaded the settings file into stereotool. What i did is to download also the winamp dsp version of stereotool in order to create a preset settings file according to what i liked, and then to export this settings file. Finally, i used the exported settings file with the stereotool command and thats it.


  • Hiya,

    Hope Diamantis is still around - I'm trying to get this working on my standard airtime installation...

    Trying to get all the main aurtime output sent to the mkfifo... Every time I add code to ls_script.liq, i break my output :( I also don't have a 'radio' object as far as I can tell?

    Where exactly in ls_script.liq do I add the part to output master audio form airtime? Also, what is the name of the source object to use?

    Thanks :)