#152: Blank with smart_crossfade
-------------------------+--------------------------------------------------
  Reporter:  karye       |       Owner:  toots    
      Type:  Bugs        |      Status:  reopened 
  Priority:  1           |   Milestone:  0.9.0    
 Component:  Liquidsoap  |     Version:  0.3.7+svn
Resolution:              |    Keywords:           
       Mac:  1           |       Linux:  1        
    Netbsd:  1           |       Other:  1        
   Freebsd:  1           |  
-------------------------+--------------------------------------------------
Comment (by mrpingouin):

 I ran some tests with the following script, which is a simplification of
 paulvt's luon-radio.liq. Please read the comments in the script.

 {{{
 def crossfade(a,b)
   add(normalize=false,
       [ sequence([ blank(duration=2.),
                    fade.initial(duration=4.,b) ]),
         fade.final(duration=4.,a) ])
 end

 smart_crossfade = smart_crossfade(conservative=true,
                                   width=4., medium=-25.,
 default=crossfade)

 tracks = playlist(id="tracks", "~/media/audio/jazz")

 # Override the previous with two tracks between which
 # there was a noticeable underrun.
 tracks = sequence([
    single("/home/dbaelde/media/audio/jazz/Chili Sauce - Prima,
 Louis.mp3"),
    single("/home/dbaelde/media/audio/jazz/Herbie Hancock/\
            1976 - Herbie Hancock - Man Child/06 - Heartbeat.mp3")])

 # Instead of the usual mksafe() I fill failures with a sine:
 tracks = fallback(track_sensitive=false,[tracks,sine(440.)])

 # replace tracks by skip_blank(tracks), you get more hicups
 default = smart_crossfade(tracks)

 # Let's avoid the ALSA complaints:
 # ... Could not set buffer size to 'frame.size' (1764 samples), got 4704.
 set("frame.size",4704)
 # But we still get the underruns:
 # ... Underrun! You may minimize them by increasing the buffer size.

 # Save the stream to an ogg file. It takes some CPU power and creates more
 hicups,
 # but allows you to check if the stream itself is corrupted.
 # Passing bufferize=true to ALSA also doesn't change much.
 output.file.vorbis("~/tmp/out.ogg",output.alsa(bufferize=false,default))
 }}}

 I do hear some hicups, sometimes a bit before the transition, sometimes a
 bit after: they correspond to ALSA underruns. I don't hear any sine,
 except at the beginning if tracks is a playlist, not overridden by the
 two-file sequence -- this is normal, since a playlist takes a little time
 to load. This means that the stream is correct, it is only late. You can
 check it by listening to the out.ogg file.

 Paulvt, can you confirm these observations on that simple script?

 My conclusion is that the bug is not directly related to smart_crossfade.
 It is only a problem of too much load at some points, causing a bad
 realtime behavior. It would not happen with an icecast output, because it
 is significantly buffered. The high load is caused by operators such as
 smart_crossfade, but also skip_blank, normalize, etc, which analyze the
 stream.

 In a sense, this ticket can be seen as a feature request: "avoid load
 peaks which kill real-time listening". I don't see it as critical since
 the main purpose of liquidsoap is still icecast outputs. But I am
 disturbed by these load peaks, since I don't understand their origin.

 Paulvt, is realtime (alsa/ao/..) output your primary goal with liquidsoap,
 or do you only use it for testing purposes?

-- 
Ticket URL: <http://savonet.rastageeks.org/ticket/152#comment:29>
Savonet <http://savonet.rastageeks.org/>
Let's program our stream !
------------------------------------------------------------------------------
_______________________________________________
Savonet-trac mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-trac

Reply via email to