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

[Script] Roll20 Audio Master -- Hear the dice, Hear the action!

1527112517
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I just know there's some cool emergent behavior hidden in that last post...
1527112886
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Heh, I'm sure there is, and I'm sure that you'll find it. I think you know more ins and outs about the actual use of the script than I do ;)
1527234968
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
You might think so, but I still am unable to figure out how to use the fade command. I know you recently pushed a fix, but this crashes: !roll20AM --vcontrol,volume:0,fade,tickTime:2,volTick:10,stop|Shing Jea Monastery by BeefJelly
1527235002
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
hmm, ok, looks like it still needs some work then.
1527255324
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Thanks, Scott. Also, if all were working and I was formatting properly, The track name is optional even for this? I.e. Without the track name it would adjust the master volume and stop whatever might be playing?
1527258269
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yep
1527259553
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Here's the error log from the above command, if that helps. ReferenceError: who is not defined at changeVolume (apiscript.js:3518:40) at _.each (apiscript.js:3570:25) at Function._.each._.forEach (/home/node/d20-api-server/node_modules/underscore/underscore.js:182:9) at fadeTracks (apiscript.js:3562:19) at Timeout.delayHandler [as _onTimeout] (apiscript.js:3783:33) at ontimeout (timers.js:399:18) at tryOnTimeout (timers.js:250:5) at Timer.listOnTimeout (timers.js:214:5)
1527260836
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
ok, I know the problem, thought I'd already fixed it, but I know what it is.
1527261652
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
If it's important, I'm working off the one click. Your last fix was over a month ago, so I assumed it has been merged.
1527261799
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yep, it should have been.
1527283837
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I switched to a manual install of the latest version. It does not crash, and it indeed reduces volume, then goes into a loop, posting this to the chat every few seconds: (From Roll20AM): The volume change command you sent was invalid. Volume to change to can be a number or basic arithmetic (e.g. 5,+5,-5,*2,/2).
1527318484
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hmm, ok, thanks keith
Hello, I love the functionality this script brings to Roll20. However, I have just started using it and it seems I consistently run into this problem: everything works fine until I use vcontrol. The commands for vcontrol work for like two commands, and then if I try again the whole API seems to stop working and I get this set of errors when I look at the API menu for the game I'm in: ReferenceError: who is not defined ReferenceError: who is not defined at changeVolume (apiscript.js:2808:40) at Timeout.delayHandler [as _onTimeout] (apiscript.js:3080:29) at ontimeout (timers.js:399:18) at tryOnTimeout (timers.js:250:5) at Timer.listOnTimeout (timers.js:214:5) I have to go and restart the sandbox, but it always breaks down again when using vcontrol. Just to be very specific, the commands that seem to cause this are --vcontrol,volume:100 (or any other number or expression)|any tracks. Thank you for your help.
1528675580
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
vcontrol has always been a little buggy for me too, unless setting a uniform volume for all tracks. Regardless, this script is in my regular toolbox for any session.
1528676442
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
hrmm, thanks Chris. I'll be making a development pass on the script sometime in the near future.
Hello, Since the vcontrol setting seems a little clunky at the moment, I tried to make a macro that would overlap for 3 seconds the current playlist and the new one I thought it would be as simple as : !roll20AM --stop,delay:3 !roll20AM --play,mode:shuffle,|Normal combat| But the stop function doesn't seem to work. What do I do badly ?
1528722351
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
You need to specify a track to stop or that all tracks should stop: !roll20AM --stop,delay:3|Track Name or leave blank for all
1528728103

Edited 1528745729
I thought it would be as simple as : !roll20AM --stop,delay:3 !roll20AM --play,mode:shuffle,|Normal combat| But the stop function doesn't seem to work. What do I do badly ? I see two issues here: the pipe character (|) in the stop command cannot be omitted (at least to my knowledge it is mandatory). Further, to stop all tracks from playing after three seconds (I think that's what you're trying to accomplish) you would need a different command. To my understanding after the pipe character the script normally expects either a playlist or a track to which to apply the command to, in your case the --stop command. Therefore giving a blank name like we're doing here will not work since the script does not know on which track to work. What we have to do is change the script execution to "inverted mode". This can be done by the "ignore" parameter as mentioned in the script documentation. So the correct command to stop all currently playing tracks and playlists would be: !roll20AM --stop,ignore,delay:3| This will tell the script to stop every track that is currently playing after three seconds, except those tracks/playlists where giving to the command. Normally this could be used to say stop all the sound effects but do not stop the background music. In your case we're not giving the script an track to exclude and thereby force it to stop all currently playing tracks yielding the result you wanted. @Scott: Is this the intended behaviour I'm describing or am I working around an issue that should be reported to you? I'm not completely sure but I read the documentation as my variant being the intended behaviour.
1528730512
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That's the format my  Soundboard macro uses: [STOP ALL MUSIC](!roll20AM --stop,ignore|)
1528734309
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
ah, yes, thanks Keith and Florian, I was rushing out the door, and forgot to mention that the ignore keyword must be included to stop all. Florian, no, that is the intended behavior.
1529161264
Victor B.
Pro
Sheet Author
API Scripter
I'd love to use the fade functionality and the wonderful macro functionality that keithcurtis created (very good job for both API and spreadsheet), but I'm also getting the same error.  Looking at the code first thing I see is that there's a parseInt on tickTime put not on volume or volTick.  parseInt looks at a character strings and returns back the number.  So tickTime:10 will return a 10, but volume:10 and volTick:10 will fail with the "who" error.  So it looks to me (and I could be wrong on this) that either parseInt is removed and you simply pass --volcontrol,0,fade,10,10,stop or add parseInt to all 3 commands.  I'm going to copy the code into my game and work with it for a bit.  
1529184238
Victor B.
Pro
Sheet Author
API Scripter
I've got it working.  If you wish to know what the issues were, PM me.  
1529256813

Edited 1529257057
Victor B.
Pro
Sheet Author
API Scripter
I've fixed numerous issues within this script:  I've made the following significant changes to the way the script operates: 1) The arithmetic logic surrounding volume has been removed due to complexity.  Master volume for all tracks and desired volume for a single track  (soon to be playlist) will be a number from 0-100. 2) Fade wasn't working as tickTime and volTick along with desired volume (including the original arithmetic) wasn't working.  The fade was calculating a new volume then calling changeVolume which was using the calculated volume to calculate a new volume, so the final volume was inaccurate.  The new fade is using current volume - desired volume/tickTime.  This gives a the change volume number.  Fade delays 1 second and reduces or increases the volume by the change volume number until desired volume is achieved.  So if you have a volume of 50, desired volume is 0 and tickTime is 10, it will reduce the volume by 5 each second for 10 second until volume reaches 0.  Volume will remain at zero, so when play is clicked for the track, it will reset the volume to the master volume.   3) The documentation has ticTime and it should be tickTime (k added). Also a parseINT was missing that would cause a failure 4) Master volume change wasn't working as the state;mastervolume wasn't actually being set correctly.  The arithmetic logic has been removed and a simple number from 1-100 will set the state.mastervolume as well as all track volumes.   5) Playlist Modes changed from a popup entry to a toggle.  Shuffle has been removed and trueRandom will be used for shuffling 6) listimport had numerous issues and has been fixed.  The process will pull in all playlists and associated tracks.  Import Jukebox added to the --config menu.  listimport will add new tracks found in existing playlists.  No manual entry of tracks.  To get setup, type Iroll20AM -- config and it can be usable within minutes.   7)  Cleaned up the buttons and displays a bit Still outstanding 1) Playlist Volume Control, fade control to playlist and track menu 2) Add Fade button to Playlist and Track menus to initiate a fade 3) Add Stop button to Playlist menu 3) Add default Fade Level (0-100) to config menu and apply default fade value to all tracks and playlist 4) Add Search and possibly ordering to Track menu (way future) I started making these yesterday, so shouldn't be long to get the outstanding stuff into the script.   I'll keep this script to myself unless roll20 (or whoever is supporting the script now) is interested.  
1529258298
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I am certainly interested. Thanks for working to make a great script even better.
1529259282

Edited 1529259303
Victor B.
Pro
Sheet Author
API Scripter
This script is actually really well structured.  It had a few issues with some of the calls and underscore.js (a way to manage the objects/data).  Otherwise, it's solid.  
1529259502
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hey everyone, Victor and I have been PMing back and forth. I've come to the realization that I just don't have the time to dedicate to this script that it deserves. Fortunately, Victor has stepped forward with some great edits to the script already and he will be taking the lead on the development moving forward. I look forward to seeing what he does with the script in the future.
1529267318
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Good news. Thanks, both of you. I'm looking forward to putting some of the new features into practice.
1529270096

Edited 1529272058
Victor B.
Pro
Sheet Author
API Scripter
Here's a sample of where I'm going with it.   - Master Volume sets volume for all tracks - Fade Volume sets the default fade for all tracks (you can fade soft to loud as well as loud to soft - Playlists brings up the Playlist you've imported from Jukebox - Restrictions restrics players from song access - Import Jukebox brings in all playlists and tracks from your jukebox                                                                                                                                   Playlist icons - Play button - obvious - Up arrow - incremental increase of volume - Down arrow - incremental decrease of volume - Lock - allows or restricts player access to playlist - Mode - Dice - random play - Single Arrow - play one song at a time - Two People - play all songs at once (together) - Trash Can - delete the playlist
1529272630
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Looking classy Victor. The script's in good hands
1529273156
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
You're going to put my soundboard macro out of work. :) That looks amazing, Victor.
Am I to take it then that vcontrol is working and doesn't cause the script to crash? Thanks for the attention to this issue and script!
1529287083
Victor B.
Pro
Sheet Author
API Scripter
vcontrol was working.  There were certain conditions where it didn't.  What I'm trying to accomplish is that you can use the API without having to type anything but !roll20AM --config to start the process.  Once the pages are up, you can use them without any further commands.  It's hard to see but there's a cog icon on lower right.  This returns you to the config menu.  So you'll be able to navigate between screens without typing anything in chat.  
1529295893
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Will the existing command set still function? I likes me macro.
1529298978
Victor B.
Pro
Sheet Author
API Scripter
Yes, existing command sets will function.  Arithmetic volume setting (*, /,+,-) is deprecated, so replace the arithmetic with a target volume.  Fade will enable gradual or fast increases/decreases by setting the fade volume and the fade time (in seconds), So a quick increase might have a fade time of 1 or 2 seconds.  volTick is deprecated.  . Otherwise, the rest should behave exactly the same.  
1529334350
vÍnce
Pro
Sheet Author
Can we have some cross-fade between tracks and a little reverb with a room-size setting?  ;-P Great work on a great script.  Thank you Scott and Victor.
1529339503
Victor B.
Pro
Sheet Author
API Scripter
LOL, you can have cross fade.  I'm not kidding.  Nice thing about this script is that it allows multiple playlists to occur at same time so it's possible to fade out one playlist (or track) and fade in another.  :)
1529345790
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Victor B. said: Yes, existing command sets will function.  Arithmetic volume setting (*, /,+,-) is deprecated, so replace the arithmetic with a target volume.  Fade will enable gradual or fast increases/decreases by setting the fade volume and the fade time (in seconds), So a quick increase might have a fade time of 1 or 2 seconds.  volTick is deprecated.  . Otherwise, the rest should behave exactly the same.   <little girl>Squee!</little girl>
1529507901
Victor B.
Pro
Sheet Author
API Scripter
Here's an update.  I'm still a bit away from final product.  I am looking for beta testers.  Please PM me if interested. 
Wow, just wow.
1529688335
Victor B.
Pro
Sheet Author
API Scripter
I have a single beta tester.  Anyone else want to get in now's your chance for any feature requests.  The commands have changed, so if you using the previous version, you can get it from github or you'll need to upgrade your macros if you are using them.  You can always use the chat window now to manage your tunes.  See previous post.  Here are the new commands: After the '|' comes tracks or playlists or both, comma separated. Roll20 Audio Master Native Commands -- audio,[play,stop,[ignore],fade,[in,out],increase,decrease]|<playlist or track or multiple or both, comma separated> play: starts the track stop: stops the track fade: gradual change of sound level in: starts from 0 and increases to Fade In Volume based using Fade Time out: starts at current volume and decreases to Fade Out Volume using Fade Time increase: increases volume by 5% decrease: decreases volume by 5% Audio Options --audio,play| (required, at least one list or track ) plays lists or tracks --audio,stop| (optional, if no tracks or playlists, stops everything) stops lists or tracks or if blank, stops everything --audio,stop,ignore| (required, stops all but list or track) stops everything but the list or track specified --audio,fade,in| (required, at least one list or track) fades in lists or tracks to fade in volume --audio,fade,out| (required, must be a playing track) fades out lists or tracks to fade out volume --audio,increase| (required, at least one list or track) increases lists or tracks volume by 5% --audio,decrease| (required, at least one list or track) decreases lists or tracks volume by 5% Edit Options --edit,mode,[single,loop,shuffle,random,together]|(required, at least one list or track) single - plays one tracks and then stops loop - plays all tracks in list in order of play list shuffle - randomizes the play list and plays all tracks in shuffled order random - continuous play, one random track at a time from play list together - plays all tracks at once in playlist --edit,access,[gm,player] | (required, at least one list or track) sets playlist or track for player access (or not) --edit,fade,in,level | (optional, if blank, updates all tracks and playlist) sets fade in volume level --edit,fade,out,level | ((optional, if blank, updates all tracks and playlist) sets fade out volume level --edit,fade,time,level |(optional, if blank, updates all tracks and playlist) sets fade time (in seconds) --edit,volume,level |(optional, if blank, updates all tracks and playlist) sets starting volume level Config Options --config| brings up main chat box -config,playlists brings up playlists chat box with a list of all playlists --config.tracks brings up tracks chat box with a list of all tracks (including playlist tracks) --config,menu=<playlist name> brings tracks assigned to playlist box --config,import imports all tracks/playlists currently in Jukebox
1529689792
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Looking good. I'll try to find some time to test as well.
1529897923
Victor B.
Pro
Sheet Author
API Scripter
We are entering beta test.  Soon as I get feedback and Scott gives go ahead to push into Github the versions you are currently running will fail.  This is not backward compatible.  If you want to continue your current version, you'll need to pull it from Github.   You'll be able to import everything from Jukebox, play at the playlist level, open playlists to view the tracks, play a track(s) from the playlist, fade in, fade out, make incremental changes to the volume, etc.   You'll be able to launch multiple playlists or tracks at the same time.   Here's the final look and feel.  
1529899014
vÍnce
Pro
Sheet Author
:-)
1529899022
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Much more attractive interface than the previous example! Very slick. Several questions so far. 1) If you click a playlist title (ex. Rats) will you be given a similar screen to control the individual tracks in that list? 2) I would recommend switching the positions of volume up/volume down. I think it would be more intuitive to have the lower value come first, as in reading order, numberline order, or standard volume controls. 3) Given the size of the buttons, does the "remove" button require a confirmation in case of an accidental press?
1529899335
Victor B.
Pro
Sheet Author
API Scripter
1) Yes 2) Easily Done  3) No confirmation yet.  Accidental means go back to import jukebox and click it again and it will bring back your track.  However, a confirmation should probably be added.  The font images can be made larger.  I purposely kept them small because when you view tracks, and you have a LOT within a playlist, the chat box gets big.  
1529904304
Victor B.
Pro
Sheet Author
API Scripter
Here's a display of the tracks associated with the playlist.  There's also a complete track view that shows all tracks you have imported independent of the lists they may be assigned to. 
1529907363
Victor B.
Pro
Sheet Author
API Scripter
Track View shows all tracks in Jukebox.  A future feature is adding a search capability to this.  
1529907458
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
That is looking so cool. I'm fine with the size of the controls. But I realize that "more compact" is a personal preference.
1529907615

Edited 1529908903
Victor B.
Pro
Sheet Author
API Scripter
One last thing.  Delay has been removed for the time being due to complexity.  If I were to build it into roll20AM, I'd need to build it into the UI (User Interface).  If requested, I could add it to the feature request.   @keithcurtis, awesome!  Good to hear.  
1529968175
Victor B.
Pro
Sheet Author
API Scripter
Here is a beta version of Audio Master.&nbsp; Remember commands have changed!!! This won't be plug and play with existing commands that you have embedded in macros or character sheets.&nbsp;&nbsp; <a href="https://gist.github.com/vicberg/6635c77f7f730529cc" rel="nofollow">https://gist.github.com/vicberg/6635c77f7f730529cc</a>... PM me with comments or ideas or problems found.&nbsp;&nbsp;