Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[Roll20AM Feature Request] Global Fade-Out

Currently, it's only possible to fade out a specific track using Roll20 Audio Master. It would be great if one could simply fade out whatever music was playing, without needing to input a specific track -- like Stop All Tracks, except fading them out instead. I'd love to be able to fade out whatever track is playing, and have that command at the start of most (if not all) my Roll20AM macros, so that the current music would fade out, while the current music faded in. Less jarring. Victor, I know you're a busy guy, but I thought I'd ask, especially since Roll20AM hasn't had an update in quite a while, I think.
1602108459
Victor B.
Pro
Sheet Author
API Scripter
There's two ways to do this 1) put your songs into a playlist and set the playlist to play all at same time (assuming that's what you are doing) and then fade out the playlist.  2) Put all your songs into one of the 4 tags and then fade out the tag playlist
Victor B. said: There's two ways to do this 1) put your songs into a playlist and set the playlist to play all at same time (assuming that's what you are doing) and then fade out the playlist.  2) Put all your songs into one of the 4 tags and then fade out the tag playlist 1) That's not my use case, though. I don't want to have multiple songs playing at the same time. I just want a way to fade out whatever track is playing without needing to specify the track. This way, I can have a generic fade out all tracks command as the first command in any macro that plays music. 2) I'm confused about what this would accomplish? 
1602436309

Edited 1602436649
Pat
Pro
API Scripter
So, like the Swap, but Crossfade - more like making all other playing tracks fade instead of stop, and the designated track to fade in.  eta: It doesn't look like "swap" was ever implemented... at least not as I can see from the code - it's only there in the comments and the help text, but no mention of it in the code itself... 
Pat said: So, like the Swap, but Crossfade - more like making all other playing tracks fade instead of stop , and the designated track to fade in.  eta: It doesn't look like "swap" was ever implemented... at least not as I can see from the code - it's only there in the comments and the help text, but no mention of it in the code itself...  Yeah, have never encountered swap in Roll20AM. But surely it would be possible to implement the Stop All Tracks command for fade-out? But yes to the part in bold.  Also, is the one-click version current? I thought the last available version was 2.12, from the one-click, but I also see a 2.13 in Vic's github...
1602464814

Edited 1602472290
Pat
Pro
API Scripter
All I see is 2.12 in the Github... and that's the one that is in the one-click library and has documentation mentioning "swap" - but if you do a code search on the repository code, swap only comes up in the help documentation print-out, not in the actual code. Swap in theory stops all other tracks, according to the documentation - which would be like the normal stop with no parameters, plus another macro call to play, which may be why it's not implemented (you can do it with two successive macros). If you can do something like all stop (implemented now), you can know which tracks are playing, which means you could (theoretically) fire off the fade-out of the other tracks, and fire off the fade in of the selected track(s) - a crossfade parameter. I'll take a look, as this is interesting to me too - I like fade in-outs better than hard stops. Maybe I can just get to "fade-out all playing" which would be half, and if followed by a standard fade-in would get the effect if not the spirit.  I was also disappointed to see no API controls for the scrubber - I'd love to be able to reset music or sound effects at least, if not pick the exact point in the scrubber to play from/to.  ======================= Edited to Add - I did it. Added a case for fade with no tracks or playlists, and triggered a cycling of all "playing" tracks to fade out all of them...and faded them all out. Six tracks at once. Not a likely scenario, but adding a fade command before any play macro will fade out all other playing tracks. Maybe I should add a "crossfade" as well, so it will exclude the provided track when it goes to fade all others.  Here's what I added:  ...in commandHandler after the "stop" block (included)                 if (cmdDetails.details.stop){ if (playlists.length == 0 && tracklists.length == 0){ stopAll(who) } } if (cmdDetails.details.fade){ if (playlists.length == 0 && tracklists.length == 0){ log("In fade all"); log(fadeAll(who)); } } ...later as a standalone variable     //****************************************************************************** //Special - Fade all tracks //****************************************************************************** fadeAll = function(who){ log("In Fade All Function"); var jbTrack, nomenu=true; if (debug){ log('Fading All Tracks') } _.each(state.Roll20AM.playLists,(list)=>{ if (list.playing){ if (debug){ log('Fading List:' + list) } //list.playing = false; //list.currentTrack = []; fadeListOut(list,nomenu,who); } }) log("Checking tracks for play state and fading out..."); _.each(state.Roll20AM.trackDetails,(track)=>{ // log("Checking track:" + track.id + "for playing state:" + track.playing); if (track.playing){ if (debug){ log('Fading Track:' + track.id) } //getTrackDetails fadeOutTrack(track.id,track.volume,0,track.fadetime,nomenu,who); //stopTrack(track.id,who) } }); },
Pat said: All I see is 2.12 in the Github... and that's the one that is in the one-click library and has documentation mentioning "swap" - but if you do a code search on the repository code, swap only comes up in the help documentation print-out, not in the actual code. Swap in theory stops all other tracks, according to the documentation - which would be like the normal stop with no parameters, plus another macro call to play, which may be why it's not implemented (you can do it with two successive macros). If you can do something like all stop (implemented now), you can know which tracks are playing, which means you could (theoretically) fire off the fade-out of the other tracks, and fire off the fade in of the selected track(s) - a crossfade parameter. I'll take a look, as this is interesting to me too - I like fade in-outs better than hard stops. Maybe I can just get to "fade-out all playing" which would be half, and if followed by a standard fade-in would get the effect if not the spirit.  I was also disappointed to see no API controls for the scrubber - I'd love to be able to reset music or sound effects at least, if not pick the exact point in the scrubber to play from/to.  Yeah, the "fade-out all playing" is really the big piece, since I already have fade-in commands for whatever track I want to play next in the macro. Looking forward to seeing what you do with this!
1602472354

Edited 1602472675
Pat
Pro
API Scripter
Check previous post! Added to the latest roll20AM - two blocks and it works, the trick is not overrunning the track you want to fade in (so you'd want to run the fade all before the fade in specific track)  Tested it with the all-fade and the fade-in of a specific song in the same macro, and it worked beautifully. Several times. While it might be nice to refine this with a crossfade that's more specific and can be in a single command, the two in one macro seems to work great. 
Pat said: Check previous post! Added to the latest roll20AM - two blocks and it works, the trick is not overrunning the track you want to fade in (so you'd want to run the fade all before the fade in specific track)  Tested it with the all-fade and the fade-in of a specific song in the same macro, and it worked beautifully. Several times. While it might be nice to refine this with a crossfade that's more specific and can be in a single command, the two in one macro seems to work great.  Whoa! Can't wait to try this out, thank you!
1602475016
Pat
Pro
API Scripter
@Jay R. - just to be clear, you'll have to get the whole script from the Github as it is now (the 2.12 version), paste it in as a new script, then augment it with those two - I would have pasted, but the entire script is over two thousand lines as it is and thought that might be gauche to post. 
Pat said: @Jay R. - just to be clear, you'll have to get the whole script from the Github as it is now (the 2.12 version), paste it in as a new script, then augment it with those two - I would have pasted, but the entire script is over two thousand lines as it is and thought that might be gauche to post.  Oh, of course! Don't worry, it was quite clear from your initial post that you'd modified the 2.12 script. :)
1602533621
Pat
Pro
API Scripter
By the way, you can take the "fadeAll(who)" out of the log() - I had it in there because the script was failing silently without it - with the log, it fails and spits out the consequences so I know what's going wrong. 
1602829816
Victor B.
Pro
Sheet Author
API Scripter
Thanks I'll take a look.  My logging is verbose and not always clean
Pat said: By the way, you can take the "fadeAll(who)" out of the log() - I had it in there because the script was failing silently without it - with the log, it fails and spits out the consequences so I know what's going wrong.  Hey Pat. I'm trying to run your mods in the Roll20AM now, but I'm not sure where to place the second code block. Does it go right at the end? Somewhere else? I tried putting the second block at the end but it disabled all my scripts with  SyntaxError: Unexpected end of input
1603236900

Edited 1603236986
Pat
Pro
API Scripter
Jay R. said: Hey Pat. I'm trying to run your mods in the Roll20AM now, but I'm not sure where to place the second code block. Does it go right at the end? Somewhere else? I tried putting the second block at the end but it disabled all my scripts with  SyntaxError: Unexpected end of input It's got a comma at the end, so it's part of the series of variables defined - I put mine right before the stopAll entry. 
Pat said: Jay R. said: Hey Pat. I'm trying to run your mods in the Roll20AM now, but I'm not sure where to place the second code block. Does it go right at the end? Somewhere else? I tried putting the second block at the end but it disabled all my scripts with  SyntaxError: Unexpected end of input It's got a comma at the end, so it's part of the series of variables defined - I put mine right before the stopAll entry.  OK, thanks. I'll try that!
Pat said: Jay R. said: Hey Pat. I'm trying to run your mods in the Roll20AM now, but I'm not sure where to place the second code block. Does it go right at the end? Somewhere else? I tried putting the second block at the end but it disabled all my scripts with  SyntaxError: Unexpected end of input It's got a comma at the end, so it's part of the series of variables defined - I put mine right before the stopAll entry.  OK, fixed it and it's loading, but what is the actual command to fade out all tracks?
1603241691
Pat
Pro
API Scripter
Ah okay! I played off the stop all tracks !roll20AM --audio,fade| It plays off of the !roll20AM --audio,stop|
Pat said: Ah okay! I played off the stop all tracks !roll20AM --audio,fade| It plays off of the !roll20AM --audio,stop| Tried the command and it does not fade out whatever music is playing. The API window registers "In Fade All" but nothing actually happens.
1603249187

Edited 1603249507
Pat
Pro
API Scripter
That sounds like it is erroring out in the fadeAll script, and that's why I had it in the encapsulation of log() previously. Otherwise it would be logging all the rest of the tracks and whether or not they were playing.  ...and I don't think it is going to let me add the whole thing here.  Try:  disabling the standard roll20AM purging the playlist re-importing it.  roll20AM uses state so it may not go the first time. 
Pat said: That sounds like it is erroring out in the fadeAll script, and that's why I had it in the encapsulation of log() previously. Otherwise it would be logging all the rest of the tracks and whether or not they were playing.  ...and I don't think it is going to let me add the whole thing here.  Try:  disabling the standard roll20AM purging the playlist re-importing it.  roll20AM uses state so it may not go the first time.  Hey Pat. I'd already disabled the standard Roll20AM before trying last night. Unfortunately, purging the playlist and re-importing hasn't worked. Running !roll20AM --audio,fade| when a track is playing does nothing, though "In fade all" appears in the API log. Might it be due to the fact that there is already a "fade" command in Roll20, which needs in or out in order to function?
1603303820

Edited 1603304613
Pat
Pro
API Scripter
That's just it - what I did was use the same fade command, but like stop, if no tracks or playlists are provided, it goes to fade all, like stop goes to stop all.  I'll look over my code and see if I missed another section where I edited - I can't paste my whole text here, because it exceeds the size limit. I'm not sure how else to share.  I ran a text-comparison, and the only changes besides turning on logging (which you'd need to do at the top, turning it to true) - the sections I clipped and pasted are the only difference, and it's working on my test campaign. I'm not sure what else to say... I guess I failed, and I'm sorry I wasted your time. 
Pat said: That's just it - what I did was use the same fade command, but like stop, if no tracks or playlists are provided, it goes to fade all, like stop goes to stop all.  I'll look over my code and see if I missed another section where I edited - I can't paste my whole text here, because it exceeds the size limit. I'm not sure how else to share.  I ran a text-comparison, and the only changes besides turning on logging (which you'd need to do at the top, turning it to true) - the sections I clipped and pasted are the only difference, and it's working on my test campaign. I'm not sure what else to say... I guess I failed, and I'm sorry I wasted your time.  Not a waste of time at all! I'll double-check tonight to make sure I haven't missed anything. If it's working in your test campaign, there has to be a way for me to make it work too. :)
Trying again tonight, and having no luck. I've checked the code blocks, made sure they were pasted where they were supposed to be, and tried a few times to fade all, without success. Maybe, as you said earlier, there was a code modification or block you forgot to post? It's bizarre that it works for you and not for me.
1603335358
Pat
Pro
API Scripter
whelp, I did the file comparison for that reason and ... nothing else popped up.  Does the code stop working when you go to fade all? Or does it just not work? 
It just doesn't work. I get the "In Fade All" command appear in the API window, but nothing happens. I can run other Roll20AM commands just fine, though.
1603342430
Pat
Pro
API Scripter
...which means it might be failing silently in the fadeAll function. I had to log the heck out of it to get it to work for me, because it seems to want to eat all of its errors. - so maybe try putting the call to fadeAll back in the log() function  log(fadeAll(who));
Pat said: ...which means it might be failing silently in the fadeAll function. I had to log the heck out of it to get it to work for me, because it seems to want to eat all of its errors. - so maybe try putting the call to fadeAll back in the log() function  log(fadeAll(who)); Ok, so putting the call back in the log() function worked, weirdly! It threw out more detail in the API window -- "In Fade All Function" and "Checking tracks for play state and fading out..." followed by "undefined" -- and then actually did the fade-out! Yay. :)
1603410112
Pat
Pro
API Scripter
I'll have to figure that junk out - seriously, it shouldn't take pushing it to a log file call to get it to execute - I'll tinker with it and see if I can figure out what's going on.