Random songs on silence with fade-effect
  • Benjamin KrauseBenjamin Krause
    Posts: 6Member
    Hi,

    I've found the following entry in the FAQ: https://wiki.sourcefabric.org/display/CC/Playing+Random+Songs+on+Silence
    I think this feature is awesome, but it lacks a clean transition between songs.. is there a way to add a fade in/out effect between songs?
  • 18 Comments sorted by
  • James MoonJames Moon
    Posts: 73Member
    Hi,

    Here is a link to the manual on playlist-builder. There is a section explaining about fade in/out.

    http://en.flossmanuals.net/airtime/playlist-builder/
  • Benjamin KrauseBenjamin Krause
    Posts: 6Member
    Thanks for your reply, but I know how it's done through the GUI, but can the same effect be archived using code? Also, it seems like the metadata is not shown when playing songs this way...
  • Martin KonecnyMartin Konecny
    Posts: 809Member
    Hi,

    The method posted in that forum wiki is a quick hack that the Airtime Web UI does not know about. The Fade options in the GUI will not work. We will have an officially supported random song feature (with fading) scheduled for the future.
  • Albert FRAlbert FR
    Posts: 576Member
    I'm doing this ;)
    but it's a hack ;)

    drops = playlist(mode='randomize',reload=1,reload_mode="rounds", "/srv/users/drops/")
    music = playlist(mode='randomize',reload=1,reload_mode="rounds", "/srv/users/music/")
    jingles = playlist(mode='randomize',reload=1,reload_mode="rounds", "/srv/users/jingles/")
    default = rotate(weights=[1,3,1,3], [jingles, music,drops,music])

    def crossfade(s)
      #duration is automatically overwritten by metadata fields passed in
      #with audio
      s = fade.in(type="log", duration=0., s)
      s = fade.out(type="log", duration=0., s)
      fader = fun (a,b) -> add(normalize=false,[b,a])
      cross(fader,s)
    end


    don't forget to comment this two lines :

    #default = amplify(0.00001, noise())
    #default = rewrite_metadata([("artist","Airtime"), ("title", "offline")],default)

    Je peux le faire ;) [Pour vous] Gnu/Linux & Media Architect
  • Benjamin KrauseBenjamin Krause
    Posts: 6Member
    Thanks a lot for your comment Albert!
    Just wondering... what does all the shares mean (jingles, music,drops). I only have one share I grab my music from, can I remove all but the one called "music" or how does that part work? Trying it now. :)
  • Albert FRAlbert FR
    Posts: 576Member
    :D

    I've made some features ;)

    I'm trying to explain
    I hope the directories names are easy to understand ;)

    on this line :
    default = rotate(weights=[1,3,1,3], [jingles, music,drops,music])


    I've made a little rotate between all this directories :

    - 1jingle
    - 3 songs from music directory
    - 1 drop
    - 3 songs again

    and the system rotate ;)

    Je peux le faire ;) [Pour vous] Gnu/Linux & Media Architect
  • Benjamin KrauseBenjamin Krause
    Posts: 6Member
    @Albert:

    You are awesome, thanks! :D
    I've updated the FAQ, hopefully it will be useful for other users: https://wiki.sourcefabric.org/display/CC/Playing+Random+Songs+on+Silence

    Airtime has one of the best documentations I've ever seen, credits to the developers, you are doing an amazing job! :)
  • Albert FRAlbert FR
    Posts: 576Member
    thanks for the credits ;)

    but crossfade is another part of your question ;)
    Je peux le faire ;) [Pour vous] Gnu/Linux & Media Architect
  • A.ZUDJELA.ZUDJEL
    Posts: 4Member

    Post edited by A.ZUDJEL at 2012-02-26 11:18:09
  • A.ZUDJELA.ZUDJEL
    Posts: 4Member
    Hi,
    Do you think it's possible to play a folder according to a specific time ?

    Like  ' 'default = rotate(weights=[1,3,1,3], [jingles, musicA,musicB,drops,musicA,musicB])

    with "musicB" played between 2AM and 5AM and "musicA" anytime ?

    /////// Idea number 2 :
    I'm really new on python and programmation, but I understood it was possible to use python to ask the ftp to change the name of a folder (ftplib?).
    I was thinking about this case :

    Two folders :
    01 with songs to be played from 1AM to 1PM
    02 with songs to be played from 1PM to 1AM

    The program change the name of the folder according to time with the name "OnAir"

    Let's imagine our classic "default = rotate(weights=[1,3], [jingles, OnAir,]) "
    The program will read files from the OnAir folder. In reality OnAir is the folder 01 or 02 according to time.

    Any idea ? Is it possible or too crazy ?
    Thanks
  • Albert FRAlbert FR
    Posts: 576Member
    not exactly
    but you can try this :

    day=playlist(mode='randomize',reload=1,reload_mode="rounds", "/srv/airtime/day/")

    night=playlist(mode='randomize',reload=1,reload_mode="rounds", "/srv/airtime/night/")
    default=fallback([ request.queue(id="request"),
    switch([({ 6h-22h }, day),
    ({ 22h-6h }, night)])])

    I've don't tested it before write it here ;)
    try it, and tell us ;)

    don't forget to comment this two lines :



    #default = amplify(0.00001, noise())

    #default = rewrite_metadata([("artist","Airtime"), ("title", "offline")],default)

    Je peux le faire ;) [Pour vous] Gnu/Linux & Media Architect
  • A.ZUDJELA.ZUDJEL
    Posts: 4Member
    Thanks !!
    I'll try it this week and tell you about ;-))
  • Rick MundayRick Munday
    Posts: 104Member
    I love the idea of this! 

    And I appreciate the code offered as a work around, but please ensure that the code is somehow logged in for the developers to find in the future.


    I won't personally hack code into my system (since it makes future troubleshooting a nightmare) but these are all features we need, so we'll work it out manually in playlists and wait for it to be integrated into the system.

  • Albert FRAlbert FR
    Posts: 576Member
    I'm really agree with you
    but the reality is never as we hope too :(
    and if i want to use airtime, i'm needing to do some hacks
    anyway i hope the developpers can be inspired by our works
    Je peux le faire ;) [Pour vous] Gnu/Linux & Media Architect
  • A.ZUDJELA.ZUDJEL
    Posts: 4Member
    Hey,
    Yes, hope they'll catch all those new possibilities !

    I tried your hack but it didn't work. After restarting airtime, the player displayed a "loading error".

    To be sure I didn't write an error, here the code I wrote :

    01=playlist(mode='randomize',reload=1,reload_mode="rounds", "/home/radiogmt/music/01/")
    02=playlist(mode='randomize',reload=1,reload_mode="rounds", "/home/radiogmt/music/02/")
    03=playlist(mode='randomize',reload=1,reload_mode="rounds", "/home/radiogmt/music/03/")

    default=fallback([ request.queue(id="request"),
                        switch([({ 6h-12h }, 01),
                                ({ 12h-21h }, 02),
                                ({ 23h-6h }, 03)])])


    I also tried with two folders "day" and "night" as the one you gave but it didn't work too.
    I pasted this code instead of those corresponding lines :

    #default = amplify(0.00001, noise())

    #default = rewrite_metadata([("artist","Airtime"), ("title", "offline")],default)


  • Albert FRAlbert FR
    Posts: 576Member
    first : call your playlist with names not 01, 02 or 03
    second : I haven't tested that for the moment (i'm too busy) but perhaps add ,default a the end :

    default=fallback([ request.queue(id="request"),

                        switch([({ 6h-12h }, morning),

                                ({ 12h-21h }, afternoon),

                                ({ 23h-6h }, night)])], default)



    Je peux le faire ;) [Pour vous] Gnu/Linux & Media Architect
  • Albert FRAlbert FR
    Posts: 576Member
    after testing, the good thing to do :

    morning= playlist(mode='randomize',reload=1,reload_mode="rounds", "/home/airtime/Musique/")
    night= playlist(mode='randomize',reload=1,reload_mode="rounds", "/srv/airtime/stor/imported/")

    default=fallback([ request.queue(id="request"),switch([({ 6h-18h }, morning),({ 18h-6h }, night)])])

    directories are here for example ;
    Je peux le faire ;) [Pour vous] Gnu/Linux & Media Architect
  • Albert FRAlbert FR
    Posts: 576Member
    more fun :

    drops = playlist(mode='randomize',reload=1,reload_mode="rounds", "/srv/users/drops-day/")

    music = playlist(mode='randomize',reload=1,reload_mode="rounds", "/srv/users/music-day/")

    jingles = playlist(mode='randomize',reload=1,reload_mode="rounds", "/srv/users/jingles-day/")

    morning = rotate(weights=[1,3,1,3], [jingles, music,drops,music])


    drops2 = playlist(mode='randomize',reload=1,reload_mode="rounds", "/srv/users/drops-night/")

    music2 = playlist(mode='randomize',reload=1,reload_mode="rounds", "/srv/users/music-night/")

    jingles2 = playlist(mode='randomize',reload=1,reload_mode="rounds", "/srv/users/jingles-night/")

    night = rotate(weights=[1,3,1,3], [jingles2, music2,drops2,music2])


    default=fallback([ request.queue(id="request"),switch([({ 6h-18h }, morning),({ 18h-6h }, night)])])


    :D
    Post edited by Albert FR at 2012-03-05 05:51:39
    Je peux le faire ;) [Pour vous] Gnu/Linux & Media Architect