On 14/11/2011 16:26, Romain Beauxis wrote:
> 2011/11/14 Henry Favretto <[email protected]>:
>>
>> On 14/11/2011 15:38, Romain Beauxis wrote:
>>> 2011/11/14 Henry Favretto <[email protected]>:
>>>>
>>>>
>>>> On 14/11/2011 14:40, Romain Beauxis wrote:
>>>>> 2011/11/14 Henry Favretto <[email protected]>:
>>>>>>
>>>>>> On 14/11/2011 13:03, Romain Beauxis wrote:
>>>>>>> 2011/11/14 Henry Favretto:
>>>>>>>> Hi there,
>>>>>>>
>>>>>>> Hi Henry!
>>>>>>>
>>>>>>>> I recently migrated my old script from 0.9.3 to 1.0.0 running on my
>>>>>>>> trusty old Debian Lenny box without much trouble except for one
>>>>>>>> rather subtle issue regarding the smart_crossfade utility
>>>>>>>> function...
>>>>>>>>
>>>>>>>> In my script I use it this way:
>>>>>>>>
>>>>>>>> ************************ # Crossfade songs 15 seconds fade.out =
>>>>>>>> fade.out(type="sin",duration=15.0) fade.in  =
>>>>>>>> fade.in(type="sin",duration=10.0) add = fun (a,b) ->
>>>>>>>> add(normalize=false,[b, a]) radio = smart_crossfade( fade_out =
>>>>>>>> 15.0, fade_in = 10.0, start_next = 25.0, margin = 3.0, high =
>>>>>>>> -15.0, medium = -30.0, conservative = true, default = fun (a,b) ->
>>>>>>>> add(fade.out(a),fade.in(b)), radio ) ************************
>>>>>>>>
>>>>>>>> I noticed (by listening to the stream and looking at the log) that
>>>>>>>> for some reason my provided default transition is never applied
>>>>>>>> e.g. when "No transition. Using default" is logged then the
>>>>>>>> sequence transition is still used (the function's default).
>>>>>>>>
>>>>>>>> IIRC the same script used to work as expected in 0.9.3 e.g. using a
>>>>>>>> crossfade when the default transition is applied...
>>>>>>>>
>>>>>>>> Did I miss something?
>>>>>>>
>>>>>>> There is a subtle detail with add() that could explain your issue or
>>>>>>> at least needs a fix. By default, add([a,b,c,d]) relays metadata and
>>>>>>> track limits of the first source, a in this example.
>>>>>>>
>>>>>>> Thus, on your script, you should write: default = fun (a,b) ->
>>>>>>> add([fade.in(b),fade.out(a)])  (by the way, did you miss the [ ] in
>>>>>>> your example?) since you want metadata and track limit from the new
>>>>>>> source (b).
>>>>>>>
>>>>>>> Please, try this and let us know if your issue is still not fixed
>>>>>>> :-)
>>>>>>>
>>>>>>> Romain
>>>>>>
>>>>>> Hi Romain,
>>>>>>
>>>>>> Indeed, I guess I must have missed those brackets.... my bad.
>>>>>>
>>>>>> Okay, so I did your proposed changes but now it gives me the following
>>>>>> error:
>>>>>>
>>>>>> ************* At line 46, char 33-56: this value has type [_] but it
>>>>>> should be a subtype of (the type of the value at line 37, char 13)
>>>>>> source(_) (infered at line 37, char 42) *************
>>>>>>
>>>>>> where line 46 in my script is
>>>>>>
>>>>>> default = fun (a,b) -> add([fade.in(b),fade.out(a)])
>>>>>>
>>>>>> and line 37 is
>>>>>>
>>>>>> add = fun (a,b) -> add(normalize=false,[b, a])
>>>>>>
>>>>>> Any idea what's wrong here?
>>>>>
>>>>> Well you have redefined add, thus your initial script was in fact
>>>>> correct, including the "new source should come first in add([])" bit..
>>>>>
>>>>> Could you try to add some printing in your default transition so as to
>>>>> check whether your default function is executed or that the problem comes
>>>>> from elsewhere. Something like this: default = fun (a,b) ->
>>>>> print("\n\nDEFAULT\n\n") add(fade.out(a),fade.in(b)), ...
>>>>
>>>> When I use the mentioned print statement I get:
>>>>
>>>> Line 46, char 55 before "(": Parse error!
>>>>
>>>> Sorry if I'm being ignorant here but I'm still learning....
>>>
>>> No pb!
>>>
>>> Could you show me a script extract around line 46? Right now I do not have
>>> enough informations to help you..
>>
>> Sure, here is the whole snippet again:
>>
>> ************
>> # Crossfade songs 15 seconds
>> fade.out = fade.out(type="sin",duration=15.0)
>> fade.in  = fade.in(type="sin",duration=10.0)
>> add = fun (a,b) -> add(normalize=false,[b, a])
>> radio = smart_crossfade(
>>     fade_out = 15.0,
>>     fade_in = 10.0,
>>     start_next = 25.0,
>>     margin = 3.0,
>>     high = -15.0,
>>     medium = -30.0,
>>     conservative = true,
>>     default = fun (a,b) -> print("\n\nDEFAULT\n\n") 
>> add(fade.out(a),fade.in(b)),
>>     radio
>>   )
>> ************
>>
>> Line 47 is the third from the bottom.
> 
> Weird.. Anyway, you can do this:
> 
> ************
> # Crossfade songs 15 seconds
> def smart_default(a,b) =
>   print("\n\nDEFAULT\n\n")
>   add(fade.out(a),fade.in(b))
> end
> fade.out = fade.out(type="sin",duration=15.0)
> fade.in  = fade.in(type="sin",duration=10.0)
> add = fun (a,b) -> add(normalize=false,[b, a])
> radio = smart_crossfade(
>     fade_out = 15.0,
>     fade_in = 10.0,
>     start_next = 25.0,
>     margin = 3.0,
>     high = -15.0,
>     medium = -30.0,
>     conservative = true,
>     default = smart_default,
>     radio
>   )
> ************

This gives me the following error:

At line 37, char 15-17:
  this value has type
    source(_)
  but it should be a subtype of
    [_]

, where line 37 would be the fourth line from the top of the snippet.

I also tried putting the definition of smart_default after my redefinition of 
add() but this gives
me yet another error:

At line 50, char 13-39:
  this value has type
    (...)->(_,_)->_
  but it should be a subtype of (the type of the value at 
/usr/local/lib/liquidsoap/1.0.0/utils.liq,
line 433, char 30)
    (...)->source(_) (infered at /usr/local/lib/liquidsoap/1.0.0/utils.liq, 
line 433, char 32-60)

where line 50 would be third line from the bottom in the snippet...

Henry


------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to