Finally, after several headache, i decided to play whith
the queue only, because i noticed that liquidsoap process well
the crossfade between track of the same queue...
(just my opinion, i just can't stand what liquidsoap do internally)

So i transform the script to push a new track to the queue
each time a track is played. And i use a server variable
to do the rotation.

Full script :


set("log.file",true)
set("log.level",3)
set("log.file.path","/home/radio/log/test.log")
set("server.telnet",true)

nbtrack = interactive.float("nbtrack",0.)

def Titre() = 
  result = get_process_output("php /var/www/titre.php")
  request.create(result)
end

def Jingle() = 
  result = get_process_output("php /var/www/jingle.php")
  request.create(result)
end

def crossfade(~conservative=true,s)
  s = fade.in(duration=5.,s)
  s = fade.out(duration=5.,s)
  fader = fun (a,b) -> add(normalize=false,[b,a])
  cross(conservative=conservative,duration=3.,fader,s)
end

flux = request.queue(id="titrequeue",interactive=true,queue=[Titre()])

def AddTitre(m)
  cnt = nbtrack() + 1.
  if cnt > 5. then
    ignore(server.execute("var.set nbtrack = 0."))
    result = get_process_output("php /var/www/jingle.php")
    ignore(server.execute("#{source.id(flux)}.push #{result}"))
  else
    ignore(server.execute("var.set nbtrack = #{cnt}"))
    result = get_process_output("php /var/www/titre.php")
    ignore(server.execute("#{source.id(flux)}.push #{result}"))
  end
  log(label="ON TRACK",level=3,"Track count #{cnt}")
end

flux = on_track(AddTitre(), flux)

flux = crossfade(flux)

flux = fallback(track_sensitive=false,[flux,blank()])

output.icecast(%mp3, host="127.0.0.1", port=8000, mount="/", protocol="icy", 
encoding="ISO-8859-1", user="source", password="test", flux)


But i still don't understant why the following snippet don't do the trick :

flux = 
rotate(weights=[1,1],[request.dynamic(request1),request.dynamic(request2)])
flux = crossfade(flux)


Hope this help

MrChrisCool
www.lagrossetambouille.com


----- Mail original -----
De: [email protected]
À: "Romain Beauxis" <[email protected]>
Cc: [email protected]
Envoyé: Samedi 8 Décembre 2012 18:03:20
Objet: Re: [Savonet-users] Crossfading


Hello, i'm still trying to crossfade, i start with a
very simple script, it could be run without pervasive scripts :
(like all the others)


ChooseTitre = playlist("/pathtofile/")
ChooseJingle = playlist("/pathtofile/")
flux = rotate(weights=[1,1],[ChooseJingle,ChooseTitre])
flux = fallback(track_sensitive=false,[flux,blank()])
output.icecast(params_for_icecast,flux)


This script works well.
I want to crossfade :
so, i try this script :


ChooseTitre = playlist("/pathtofile/")
ChooseJingle = playlist("/pathtofile/")
def crossfade(~conservative=true,s)
  s = fade.in(duration=5.,s)
  s = fade.out(duration=5.,s)
  fader = fun (a,b) -> add(normalize=false,[b,a])
  cross(conservative=conservative,duration=3.,fader,s)
end
flux = rotate(weights=[1,1],[ChooseJingle,ChooseTitre])
flux = crossfade(flux)
flux = fallback(track_sensitive=false,[flux,blank()])
output.icecast(params_for_icecast,flux)


This script didn't work, liquidsoap fall back to blank,
i had to use playlist.safe instead to make it works, so liquidsoap
check all the files before :


ChooseTitre = playlist.safe("/pathtofile/")
ChooseJingle = playlist.safe("/pathtofile/")
def crossfade(~conservative=true,s)
  s = fade.in(duration=5.,s)
  s = fade.out(duration=5.,s)
  fader = fun (a,b) -> add(normalize=false,[b,a])
  cross(conservative=conservative,duration=3.,fader,s)
end
flux = rotate(weights=[1,1],[ChooseJingle,ChooseTitre])
flux = crossfade(flux)
flux = fallback(track_sensitive=false,[flux,blank()])
output.icecast(params_for_icecast,flux)


That's ok, but now i want to control wich file is send to liquidsoap,
so i replace playlist.safe by a request.dynamic :


def Titre() =
  result = get_process_output("php /var/www/titre.php")
  request.create(result)
end
def Jingle() =
  result = get_process_output("php /var/www/jingle.php")
  request.create(result)
end
def crossfade(~conservative=true,s)
  s = fade.in(duration=5.,s)
  s = fade.out(duration=5.,s)
  fader = fun (a,b) -> add(normalize=false,[b,a])
  cross(conservative=conservative,duration=3.,fader,s)
end
flux = rotate(weights=[1,1],[request.dynamic(Jingle),request.dynamic(Titre)])
flux = crossfade(flux)
flux = fallback(track_sensitive=false,[flux,blank()])
output.icecast(params_for_icecast,flux)


This script make liquidsoap hang !!!

Perhaps liquidsoap can't manage the cross function if he don't have prepared
the files in advance. Is it possible to make the request dynamic safe ?...
Perhaps there is a function like on_metadata named something like 
on_query_track where
i could put some code to do the crossfade...
Or perhaps i have to play with the transitions parameter of the rotate function 
to achieve
the crossfade...
Or perhaps i have to manually control the queue process to insert the 
crossfade...
I'm not skilled in liquidsoap scripting, so i'm lost...


Any idea to make a crossfade with request.dynamic and rotate ?

I sincerly hope to find a solution...

Kind regard
MrChrisCool
www.lagrossetambouille.com

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to