Hi Sam,

I've been playing some more with varying results.

I have experimented with the averaging parameter but to be honest it doesn't really seem to make much difference... I've tried it on 10, 15, 30, 60 and 300 and it's very hard to tell the difference.

However increasing the 'buffer' parameter slightly definitely gives a vast improvement.

What is odd is that when the audio distortion is audible it follows a definite pattern, slowly getting faster over around 5 seconds, then slowing down over 5 seconds, then repeating.

I've also discovered that on my embedded ARM system one of the major causes of this distortion was when liquidsoap was launched too soon after boot (within 5 seconds or so)... I suspect this is somehow due to the clocks changing as the system settles. I'm booting off a class-4 SD card, so IO performance is pretty awful. I'm also using the cpufreq utilities to manually change governor, but i'm not sure how instant that change is.

By inserting a 5 second delay in my @reboot cron job before liquidsoap starts the problem appears to have mostly gone away.

I'm continuing to play and will keep you advised of what I find.



On 14 January 2014 08:33, Samuel Mimram <smimram@gmail.com> wrote:
Hi Matt,

My guess is that python induces some delay for some reason (for
instance we have to load all the python libraries) so Liquidsoap
thinks it has to catch up and therefore speeds up audio, etc. In order
to reduce the sensitivity of those effect, you have two parameters of
buffer.adaptative you can play with in order to reduce this effect:
- increase the "buffer" parameter, which will make the operator buffer
more and therefore slight delays will be smaller in proportion,
- increase the "averaging" parameter, which make the operator speed up
and down more slowly so that it will be barely noticeable.

Please keep me posted of your experiments, I am not really sure yet of
which default values I should put for the operator...

Cheers,

Samuel.

On Wed, Jan 8, 2014 at 10:21 PM, Matt Camp <matt@noise.net.nz> wrote:
> Hi Sam,
>
> I've been playing with buffer.adaptative a bit more with some rather strange
> behaviour.
>
> I'm using a custom python front-end to manage liquidsoap, and whenever I
> launch liquidsoap via subprocess.Popen() the adaptative buffer results in
> the audio constantly very slightly speeding up and slowing down... this
> happens within 1 second of starting liquidsoap, and is probably slightly
> changing pitch every 5 seconds or so... quite noticeable!
>
> Weirdly if I launch liquidsoap manually from a shell this isn't anywhere
> near as evident... I've tried the older python commands.getoutput() as well
> as the newer subprocess module, but for some reason audio input in
> liquidsoap definitely suffers when launched via python! I've also tried
> nice'ing the processes with no effect.
>
> Is there any way to get some debug output of why the adaptative buffer would
> be messing with the audio so much, or any ideas on why liquidsoap suffers
> under python?
>
> Cheers!
>
>
>
> On 16 November 2013 10:08, Samuel Mimram <smimram@gmail.com> wrote:
>>
>> Yeah :) I'll try to get a merge for next release soon!
>>
>> ++
>>
>> Sam.
>>
>> On Fri, Nov 15, 2013 at 11:11 PM, Matt Camp <matt@noise.net.nz> wrote:
>> > That seems to have done the trick.
>> >
>> > I've been streaming now for over 3 hours without a single buffer empty
>> > warning, and haven't noticed any artefacts in the audio at all.
>> >
>> > Awesome, thanks!
>> >
>> >
>> > On 15 November 2013 11:51, Matt Camp <matt@noise.net.nz> wrote:
>> >>
>> >> Sounds like a great idea!
>> >>
>> >> I'll test it out and report back.
>> >>
>> >> Many thanks!
>> >>
>> >> On 15 Nov 2013, at 10:42, Samuel Mimram <smimram@gmail.com> wrote:
>> >>
>> >> > Hi,
>> >> >
>> >> > I am not so confident about hardware details, sorry. There are ways
>> >> > to
>> >> > improve the situation but I don't think that it is physically
>> >> > possible
>> >> > to keep to clocks in sync. I came up with another solution. The idea
>> >> > is to modify the buffer operator so that if the source is late some
>> >> > samples are duplicated and if the source is ahead we drop some
>> >> > samples. If the drift is small we should not have an audible effect.
>> >> > You can try it by compiling the resampled-buffer branch (see
>> >> > https://github.com/savonet/liquidsoap/pull/131 ) and replace your
>> >> > "buffer" operator by "buffer.adaptative". How does that sound to you?
>> >> >
>> >> > Cheers,
>> >> >
>> >> > Samuel.
>> >> >
>> >> > On Thu, Nov 14, 2013 at 12:13 PM, Matt Camp <matt@noise.net.nz>
>> >> > wrote:
>> >> >> One other thing...
>> >> >>
>> >> >> This system has no onboard RTC, though I can add one via a uart
>> >> >> module.
>> >> >> Would that help at all?
>> >> >>
>> >> >> Also is there a way to show how full the liquidsoap buffer currently
>> >> >> is? I'd like to be able to monitor it without having to wait 46
>> >> >> minutes to
>> >> >> see if any changes have an effect.
>> >> >>
>> >> >> Sent from my iPad
>> >> >>
>> >> >> On 14 Nov 2013, at 08:08, Samuel Mimram <smimram@gmail.com> wrote:
>> >> >>
>> >> >>> Hi,
>> >> >>>
>> >> >>> You needed to play with clocks in your scripts for a good reason:
>> >> >>> the
>> >> >>> clock from alsa is not the same as the one for icecast. Even though
>> >> >>> you expect everything to run at 44100 hz, in practice the clock on
>> >> >>> your soundcard is a piece of hardware which unfortunately drifts a
>> >> >>> tiny bit, and this drift cumulates on the long run. In summary I
>> >> >>> think
>> >> >>> that your soundcard is producing data slower than your icecast
>> >> >>> needs
>> >> >>> and after some time, the buffer is empty and has to be refilled
>> >> >>> (during which there should be blank). If my analysis is right, here
>> >> >>> is
>> >> >>> what you can do:
>> >> >>>
>> >> >>> - buffer more, i.e. change last line to "buffer(buffer=5.,radio)"
>> >> >>> (with 5 you should experience the problem every 5*46min)
>> >> >>>
>> >> >>> - change your soundcard (1 sec every 46min does not seem very good,
>> >> >>> what hardware do you have?)
>> >> >>>
>> >> >>> Cheers,
>> >> >>>
>> >> >>> Samuel.
>> >> >>>
>> >> >>> On Wed, Nov 13, 2013 at 10:49 PM, Matt Camp <matt@noise.net.nz>
>> >> >>> wrote:
>> >> >>>> Here's an odd one... for some reason Liquidsoap appears to run out
>> >> >>>> of
>> >> >>>> buffer
>> >> >>>> every 46 minutes (give or take about a minute), causing a brief
>> >> >>>> blip
>> >> >>>> in the
>> >> >>>> audio.
>> >> >>>>
>> >> >>>> I'm doing live input and streaming to icecast2 in he_aac_v2 via
>> >> >>>> fdkaac.
>> >> >>>>
>> >> >>>> I've included the full log file and also the .liq file here:
>> >> >>>> http://pastebin.com/xuurQxbt
>> >> >>>>
>> >> >>>> Any ideas?
>> >> >>>>
>> >> >>>> 2013/11/13 18:14:38 [mksafe:3] Switch to warp_prod_4886 with
>> >> >>>> transition.
>> >> >>>> 2013/11/13 19:01:31 [warp_prod_4886:3] Buffer emptied, start
>> >> >>>> buffering...
>> >> >>>> 2013/11/13 19:01:31 [mksafe:3] Switch to safe_blank with
>> >> >>>> transition.
>> >> >>>> 2013/11/13 19:01:32 [mksafe:3] Switch to warp_prod_4886 with
>> >> >>>> transition.
>> >> >>>> 2013/11/13 19:49:19 [warp_prod_4886:3] Buffer emptied, start
>> >> >>>> buffering...
>> >> >>>> 2013/11/13 19:49:19 [mksafe:3] Switch to safe_blank with
>> >> >>>> transition.
>> >> >>>> 2013/11/13 19:49:20 [mksafe:3] Switch to warp_prod_4886 with
>> >> >>>> transition.
>> >> >>>> 2013/11/13 20:36:10 [warp_prod_4886:3] Buffer emptied, start
>> >> >>>> buffering...
>> >> >>>> 2013/11/13 20:36:10 [mksafe:3] Switch to safe_blank with
>> >> >>>> transition.
>> >> >>>> 2013/11/13 20:36:11 [mksafe:3] Switch to warp_prod_4886 with
>> >> >>>> transition.
>> >> >>>> 2013/11/13 21:22:41 [warp_prod_4886:3] Buffer emptied, start
>> >> >>>> buffering...
>> >> >>>> 2013/11/13 21:22:41 [mksafe:3] Switch to safe_blank with
>> >> >>>> transition.
>> >> >>>> 2013/11/13 21:22:42 [mksafe:3] Switch to warp_prod_4886 with
>> >> >>>> transition.
>> >> >>>>
>> >> >>>>
>> >> >>>>
>> >> >>>>
>> >> >>>> ------------------------------------------------------------------------------
>> >> >>>> DreamFactory - Open Source REST & JSON Services for HTML5 & Native
>> >> >>>> Apps
>> >> >>>> OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API
>> >> >>>> Access
>> >> >>>> Free app hosting. Or install the open source package on any LAMP
>> >> >>>> server.
>> >> >>>> Sign up and see examples for AngularJS, jQuery, Sencha Touch and
>> >> >>>> Native!
>> >> >>>>
>> >> >>>>
>> >> >>>> http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
>> >> >>>> _______________________________________________
>> >> >>>> Savonet-users mailing list
>> >> >>>> Savonet-users@lists.sourceforge.net
>> >> >>>> https://lists.sourceforge.net/lists/listinfo/savonet-users
>> >> >>>>
>> >> >>>
>> >> >>>
>> >> >>>
>> >> >>> ------------------------------------------------------------------------------
>> >> >>> DreamFactory - Open Source REST & JSON Services for HTML5 & Native
>> >> >>> Apps
>> >> >>> OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API
>> >> >>> Access
>> >> >>> Free app hosting. Or install the open source package on any LAMP
>> >> >>> server.
>> >> >>> Sign up and see examples for AngularJS, jQuery, Sencha Touch and
>> >> >>> Native!
>> >> >>>
>> >> >>>
>> >> >>> http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
>> >> >>> _______________________________________________
>> >> >>> Savonet-users mailing list
>> >> >>> Savonet-users@lists.sourceforge.net
>> >> >>> https://lists.sourceforge.net/lists/listinfo/savonet-users
>> >> >>
>> >> >>
>> >> >>
>> >> >> ------------------------------------------------------------------------------
>> >> >> DreamFactory - Open Source REST & JSON Services for HTML5 & Native
>> >> >> Apps
>> >> >> OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API
>> >> >> Access
>> >> >> Free app hosting. Or install the open source package on any LAMP
>> >> >> server.
>> >> >> Sign up and see examples for AngularJS, jQuery, Sencha Touch and
>> >> >> Native!
>> >> >>
>> >> >>
>> >> >> http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
>> >> >> _______________________________________________
>> >> >> Savonet-users mailing list
>> >> >> Savonet-users@lists.sourceforge.net
>> >> >> https://lists.sourceforge.net/lists/listinfo/savonet-users
>> >> >
>> >> >
>> >> >
>> >> > ------------------------------------------------------------------------------
>> >> > DreamFactory - Open Source REST & JSON Services for HTML5 & Native
>> >> > Apps
>> >> > OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
>> >> > Free app hosting. Or install the open source package on any LAMP
>> >> > server.
>> >> > Sign up and see examples for AngularJS, jQuery, Sencha Touch and
>> >> > Native!
>> >> >
>> >> >
>> >> > http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
>> >> > _______________________________________________
>> >> > Savonet-users mailing list
>> >> > Savonet-users@lists.sourceforge.net
>> >> > https://lists.sourceforge.net/lists/listinfo/savonet-users
>> >
>> >
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
>> > OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
>> > Free app hosting. Or install the open source package on any LAMP server.
>> > Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
>> >
>> > http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
>> > _______________________________________________
>> > Savonet-users mailing list
>> > Savonet-users@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/savonet-users
>> >
>>
>>
>> ------------------------------------------------------------------------------
>> DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
>> OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
>> Free app hosting. Or install the open source package on any LAMP server.
>> Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Savonet-users mailing list
>> Savonet-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/savonet-users
>
>
>
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics
> Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
> _______________________________________________
> Savonet-users mailing list
> Savonet-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/savonet-users
>

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Savonet-users mailing list
Savonet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-users