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 .
×
Pre-order D&D 2024 now and get an exclusive bonus, only on Roll20!
Create a free account

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

1491335892

Edited 1491335918
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Duplicate post due to forum timeout.
1491336997
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Scott C. said: @Dustin C. I realized what was going on while chasing down another bug. I had some old Help menu syntax in the script that was looking for a no longer used variable, so it was undefined which would crash the script. I'll get a fix out for that pronto. @Keith C. & Dustin C. So, I've tracked the problem with fade down. First of all, I apparently had some bad code in the fadeTracks function. Fixed that only to find the true problem. The problem is that the volume processor for tracks appears to not work until the volume slider stops moving, so the fade command's volume changes (while properly fading the volume if you watch the volume slider on the jukebox) are not implemented until all of them are completed. I'm working on trying to figure out a fix, but at this time, I'm not sure what that might be. I can't remember, is there (working) code that sets the volume, or increments it? I could add code to my macro that has a plus button for volume up and a minus button for volume down. Multiple presses could simulate a fade. And/or I could put in macro code that would respect and re-set  the track's base volume when play is pressed again.
1491337896
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
There is, however, I tested it before responding just now, and it also is not working quite as intended. Little annoyed with myself that this isn't working as it's supposed to.
1491338678

Edited 1491338715
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
To expand on that, It does work, but it adjusts based off of the master volume setting at the moment instead of the track's volume. (if your master volume is set to the default of 100%, then there's no difference). Syntax for incrementing would be: !roll20AM --vcontrol,volume:+1|Track Name|Track Name|...
1491341787

Edited 1491341845
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
And final update, I * have figured out what the problem with the fade was. The time unit being used by the script was milliseconds rather than seconds and the code had some errors in it that could also cause issues. Both of these are now fixed and I'll have a patch out by the end of the day. * By I, I mean with a great deal of help in my troubleshooting process from The Aaron
1491352638
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
V1.05 submitted for merge. Fixes the following: Fade functionality is working now tickTime is now actually in seconds Several erroneous pieces of the fade code have been fixed The script now whispers directly to the person who sent the command requiring chat output (help, errors, or menus). If the command is sent by an API script, the script will still whisper "gm" instead of a specific player Script messages are now noarchive, so they won't pollute your chat archive.
Awesome Scott! So im curious. Is it possible to referance a characters attributes with the commands? Like... !roll20AM --play|@{selected|sound} Then make an Attribute for each character (Mainly my army of NPCs) and use universal macros to referance them?
1491353352

Edited 1491353432
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Sure, Attributes are resolved before the chat message is sent to the API, so as far as the script is concerned these two are exactly the same: !roll20AM --play|@{selected|sound} !roll20AM --play|OrcSound
I just did my best Mr. Burns impression >:) Excellent....
1491446949

Edited 1491447250
I broke it! I think... My playlists deleted, as in they're still there, but empty. Only thing I did that was playlist related was make a new one. Edit: Just FYI I realized this bc it was calling on an empty playlist and was crashing the API
1491450163

Edited 1491451034
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hmm, ok, need to fix it so it doesn't crash on an empty playlist. And I'll try to figure out why it would have emptied them. EDIT: Dustin, can you walk me through what you did? It's adding playlists and editing playlists just fine in my scriptorium. Somewhat unrelated, but I did find a different crash case that I'll also have fixed in just a second. EDIT2: Also, I can't get it to crash on playing an empty list. Also, update for that other crash error is into my repository and pushed for merge to the repository.
1491454263

Edited 1491454503
Im not sure, im adding tracks to the roll20, and orginizing them into playlists (again just Roll 20's). I just went to make another playlist and thought i'd check the old ones, and some flies are missing but not all (It was easy to notice bc I name them Ogre1, Ogre2 etc...). I noticed Ogre4 was gone, but not Ogre5. The only other Scripts I run that access tracks are DXWarlocks's Health Aura and It's a Trap 5e version. EDIT: I lied, I use Critical Sound Effects too. After losing the playlist before I re-added them via your + button in the playlist chat output. Tested it a few times and continued searching roll20 for sounds.  Let me know if you need any other info.
1491482068

Edited 1491482582
Scott, I think it might have something to do with moving the sound files in roll20, I was sorting the files into sub folders and now im missing some sounds from your playlists again. Do the Playlists work like a repeating field section? If you move thier order does it "break the link"?
1491483763
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
From what I understand, it shouldn't, but I'll look into that. Thanks for digging into the issue.
1491521550
PaprikaCC
Pro
API Scripter
Hey, Scott, I'm confused about your syntax. How do I use the fade? I typically have a few tracks that play that I want to fade out once combat is over over the course of 20 seconds. So far I have: !roll20AM --vcontrol,volume:0,ignore,fade:10,tickTime:1,volTick:-10
1491525204
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yeah, the syntax gets a little arcane for that. The script's fade is more of a stepwise volume changer than a true fade. The fade functionality has the following parts: volume: The final target volume fade: This is just the fade keyword that tells the script you are doing a fade tickTime: how often do you want to change the volume during the fade in seconds * volTick: how much to change the volume by each time it is changed. This is always greater than 0. So, it doesn't support just putting in a "fade to 0 over 20 seconds" option. The best it can do at the moment is this (assuming you are starting at 100% master volume): !roll20AM --vcontrol,volume:0,ignore,fade,tickTime:0.5,volTick:2.5 Note that the above will fade your master Volume (and thus all tracks). If you wanted to specify the fade to specific tracks, you'd want to add track names after "|". *If you are using version 1.04 (the current one-click version) this is actually in milliseconds. This is corrected in the new v1.05.
1491526285
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hey Dustin, Would you mind letting me into your game to see what's going on? I can't replicate the loss of tracks in my game. The problem isn't moving tracks from folder to folder in the jukebox since the script finds the tracks based on their unique id, which doesn't change unless you delete and re-add them. PM me if you're willing to do that.
1494063768

Edited 1494064374
Mal
Plus
Is there any way to use this with the 5th Ed Shaped sheet? Say one presses a spell and then the script goes off? I can't seem to add the script to the freetext, freeform or anything to actually make it work :(
1494075059
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
I believe kryx changed where those fields appear in the template so that they are no longer at the end. You could use my customized roll listener script to have specific commands sent when certain text is chatted. Note, there has been a bug reported WITH CRL that I just haven't had time to chase down.
1494087370
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The best solution I have found with shaped is to add the API command as an attacher. It doesn't go off automatically, but does put a link in the chat when the ability is used. I just use the ability (say, fireball), and when the fireball is reported in the chat, I click the link that plays the sound.
So where do you guys get the sound effects for this script ?
1494447457
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
The script will play any track you have in your jukebox.
Scott C. said: The script will play any track you have in your jukebox. I understand that but the brief looking I did in the Jukebox shows a slim selection -- not like it used to be. Just wondering if you guys log into those services and make your own sound bites or where you get them from?
1494509524
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
There are I think 5 services in the Jukebox now. Far more than there used to be. What are you looking for? Using "FX" or "SFX" in the search field is a good start. Fanburst is good for sound effects.
1494510460
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
You can upload your own sounds to fanburst and then play them through the jukebox.
1496517544

Edited 1496518193
for some reason volume control doesn't work...  !roll20AM --vcontrol,volume:0,ignore,fade,tickTime:0.5,volTick:2.5 I don't think i've formatted it wrong. can you help me by any chance? Apparently ReferenceError: adj is not defined ReferenceError: adj is not defined at changeVolume (apiscript.js:637:12) at Timeout.delayHandler [as _onTimeout] (apiscript.js:938:29) at ontimeout (timers.js:393:18) at tryOnTimeout (timers.js:244:5) at Timer.listOnTimeout (timers.js:214:5) is what i got...
1496531681
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
I'll take a look when I get home on a bit. Did you do 1click install,or copy paste the script in?
whichever one is adding from the library in the API setting
I can't seems to have the playlist menu directly: What should be the macro for it?
1497811544
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
The square brackets denote optional arguments. Simply remove the brackets.
Hi, I got the idea of using the script to add sounds to some actions like attacks, spells etc simply putting a command from the script inside the macro for that actions. So, for example, a cleric from my game party have this macro for his attack: /em @{selected|character_name} vibra un colpo con la sua morning star radiante. %{selected|repeating_attack_$2_attack} !roll20AM --play|Grunt I noticed that players can't use it due to some restriction to play music tracks. So the sound works only if I, and only me, use the macro. How can I let my players use it as well?
1501412834
Ziechael
Forum Champion
Sheet Author
API Scripter
You can set player accessibility using the config menus: --config,[menu: Which Menu ] Brings up the chat based menu interface for the script • menu: Which Menu - Specifies one of the config menus to send to chat. Possibilities are: • playlists - Brings up the list of created playlists and their current play state and player access state and the controls to play/stop them, add more playlists, toggle player access and see the details of an individual playlist. • tracks - Brings up the list of all tracks and their current volume and play state and controls to change these. • restrict - Brings up the menu to set how the script reacts to player and API messages and what denotes a player accessible track. • playlist name - Providing the name of a playlist will bring up the details menu for that playlist.
1501414909
Kryx
Pro
Sheet Author
API Scripter
Scott C. said: I believe kryx changed where those fields appear in the template so that they are no longer at the end. You could use my customized roll listener script to have specific commands sent when certain text is chatted. Just noticied this now, but freeform of an item (offense, utility, spell, action, etc) does appear at the end of the roll template. I'm not sure what is needed for this script, but if a freeform field running API commands is required it works perfectly fine if you add a line break at the start of the "freeform" section.
1501425246
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Ah, good to know Kryx, thanks. Gianmarco V. (Ravencroma) said: Hi, I got the idea of using the script to add sounds to some actions like attacks, spells etc simply putting a command from the script inside the macro for that actions. So, for example, a cleric from my game party have this macro for his attack: /em @{selected|character_name} vibra un colpo con la sua morning star radiante. %{selected|repeating_attack_$2_attack} !roll20AM --play|Grunt I noticed that players can't use it due to some restriction to play music tracks. So the sound works only if I, and only me, use the macro. How can I let my players use it as well? In addition to the config menu where you can globally disable restrictions or adjust playlist restrictions, you can add - players-  to the end of a track name to denote it as a player accessible track.
1501479209
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Kryx said: Scott C. said: I believe kryx changed where those fields appear in the template so that they are no longer at the end. You could use my customized roll listener script to have specific commands sent when certain text is chatted. Just noticied this now, but freeform of an item (offense, utility, spell, action, etc) does appear at the end of the roll template. I'm not sure what is needed for this script, but if a freeform field running API commands is required it works perfectly fine if you add a line break at the start of the "freeform" section. Thanks Kryx! That's been driving me crazy why I couldn't get it to work.
1502379673

Edited 1502380032
Is it possible with Shaped to add a command to the freeform portion of a character's sheet so that it would make the sound play on attack? If it could randomly choose between several attack sounds that would be even greater.
1502383113

Edited 1502385574
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
sirren said: Is it possible with Shaped to add a command to the freeform portion of a character's sheet so that it would make the sound play on attack? If it could randomly choose between several attack sounds that would be even greater. For the first item, just look directly above your post. The method is described. For the second, see Scott C.'s post below. (I had forgotten about shuffle).
1502383136
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
sirren said: Is it possible with Shaped to add a command to the freeform portion of a character's sheet so that it would make the sound play on attack? If it could randomly choose between several attack sounds that would be even greater. See Kyx's post above: Kryx said: Scott C. said: I believe kryx changed where those fields appear in the template so that they are no longer at the end. You could use my customized roll listener script to have specific commands sent when certain text is chatted. Just noticied this now, but freeform of an item (offense, utility, spell, action, etc) does appear at the end of the roll template. I'm not sure what is needed for this script, but if a freeform field running API commands is required it works perfectly fine if you add a line break at the start of the "freeform" section. As for the randomness, make a playlist of your attack sounds and use the shuffle play mode.
1502458527

Edited 1502458539
Thanks! I figured it out with your help! But looks like the "single" play mode works best for this. Seems like with shuffle it keeps playing the playlist forever?
1502460819
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Ah,yeah, that is true. I'll have to add a single random mode. In the meantime you can name your attack sounds like so: attack sound # And then in the command you'd have an inline roll in place of the number. so, say, you had 3 sounds, your command would look like this: !roll20AM --play|attack sound [[1d3]]
1502517636

Edited 1502517776
I don't imagine it is possible to somehow extract Roll20AM playlists and import them into a backup of a game? That is, I mean, if they do not correspond with the Jukebox playlists for which I know there is a --listImport command.
1502542114
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Unfortunately not, the track IDs are unique to the game (like all IDs). It's probably possible, but it'd be essentially another script.
1504439792

Edited 1504439859
Hello, Scott! Running into some problems with the script using it the way I described previously. I use lines like this to attach the sounds to attacks/spells: " !roll20AM --play,mode:single|Greataxe" The problem is that whenever someone uses an ability that has a sound attached, it would also change the current music track that is being played in the background. Can you think of a workaround? Is it maybe possible to add a new "play" option which would be equivalent to "single" but would not interfere with other sounds that are currently being played?
1504449135
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hmm, with that command, it shouldn't change what is playing. I'll need to do some digging.
Hi, Scott! Love the script, but am getting a consistent API-crash when I try to adjust a track's volume, either through the config menus, or with a direct command, e.g.: !roll20AM --play|FX-spell-cast-03 --vcontrol,volume:70|FX-spell-cast-03 The error I get in the API Console Log looks like this: ReferenceError: adj is not defined ReferenceError: adj is not defined at changeVolume (apiscript.js:5053:12) at Timeout.delayHandler [as _onTimeout] (apiscript.js:5354:29) at ontimeout (timers.js:393:18) at tryOnTimeout (timers.js:244:5) at Timer.listOnTimeout (timers.js:214:5) Any idea what's going awry, and whether it's operator error or a latent bug? N.B. I'm running Roll20AM v1.05.
1505858451

Edited 1505864056
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hi Victoria, looks like I've got a misplaced semicolon (not sure where that came from). I'll get a fix in tonight. It should update the one-click tuesdayish.
1505864079
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
UPDATE: Pushed the fix for the undefined adj. No version number change.
Scott C. said: UPDATE: Pushed the fix for the undefined adj. Awesome. Thanks!
1506271142

Edited 1506271170
Hey, Scott! Sorry to bother, but did you happen to get a chance to look into why when using "single" with sound effects it changes the background music track?