Asked
Resolved Resolved by Synthiam Support!

$Ezbplayingaudio Variable Not Changing To 1 When Playing Sound Files Through My

, Maybe I'm misunderstanding what the Variable $EZBPlayingAudio is used for. I understand it's a default variable in ARC that's always available. I have the Smart Variable Watcher installed to keep an eye on my variables while I'm testing scripts. I see this variable listed in the watcher and it's value is always at 0.

I play lots of sound files through  an EZB from many EZB soundboards I have installed in my ARC robot project. Most of these sound files are long one or two sentence phrases. Some are very short. When I play my files I never see the $EZBPlayingAudio variable change from 0 to 1 in the watcher skill. If so as I understand it,  this would indicate that the EZB is playing audio. I found this explanation from Athena that she gave a few months ago when she was asked by @DJ to list and explain the default variables available in ARC:

Quote:

$EZBPlayingAudio - This boolean variable indicates whether the EZ-B is currently playing audio. It is set to True when audio is being played and False when no audio is playing.
I'm looking to use this variable (or some other method) to let my Javascripts know when my sound files are done playing. I currently use a ton of sleep(); commands after I call sound files to play and it's difficult to get the timing correct by manually timing and adjusting the sleep times between files and other commands. Eventually I do get close. However If my timing is off, either the sound file gets cuts short or there is a longer then needed gap after the file stops playing. I felt using the $EZBPlayingAudio variable would help here.

I guess my questions would be: *Is this variable working correctly? *Am I misunderstanding how to use it? *Is there a better way to keep my scripts running smoothly between sound files?

Thanks!


Related Hardware EZ-B v4

ARC Pro

Upgrade to ARC Pro

Stay on the cutting edge of robotics with ARC Pro, guaranteeing that your robot is always ahead of the game.

PRO
Canada
#1  

The $EZBPlayingAudio variable is designed to indicate when the EZ-B v4 is actively playing audio through its onboard speaker system. However, it's important to note that this variable specifically reflects the state of audio being played directly by the EZ-B v4's hardware, not audio played through the PC's sound system or other external audio outputs.

From your description, it sounds like you are playing sound files through the PC using the Soundboard v2(PC) skill. This means the audio is being played through your computer's sound system rather than directly from the EZ-B v4's speaker. As a result, the $EZBPlayingAudio variable does not change because the EZ-B v4 itself is not directly playing the audio.

To achieve the functionality you're looking fordetecting when a sound file has finished playing to synchronize your scriptsyou have a couple of options:

  1. Use the Soundboard v2(PC) Skill with Scripts: The Soundboard v2(PC) skill allows you to add scripts to the timeline of each audio file. You can use this feature to trigger scripts at specific times, such as at the end of a sound file. This way, you can execute the next steps in your script without relying on sleep commands and manual timing.

  2. Custom Scripting Solution: If you need more control or wish to use audio playback status in your JavaScript scripts, consider implementing a custom flag or variable within your scripts that you manually set when starting and stopping audio playback. You can then check this custom variable to determine if your audio has finished playing.

  3. Audio Playback Event: Some programming environments or libraries offer events or callbacks that are triggered when audio playback is completed. If you're developing custom scripts or applications outside of ARC that play audio files, you might explore whether such functionality is available in your development environment.

Unfortunately, there isn't a built-in feature in ARC that directly signals the end of audio playback through the PC's sound system in the way you described for synchronizing scripts. The key is to leverage the scripting capabilities within the Soundboard v2(PC) skill or implement a custom solution tailored to your project's needs.


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
#2  

@Athena. Please reread my post. I did state that I'm indeed playing these files from EZB soundboards installed in ARC and through an EZB. mounted on my robot.  Based on that information do you have any other suggestions?

PRO
Canada
#3  

Thank you for the clarification, Dave. If you're playing the sound files through EZB soundboards and directly from the EZ-B v4 mounted on your robot, the $EZBPlayingAudio variable should indeed reflect the audio playback state. If it's not changing as expected, there might be a few things to consider:

  1. Ensure EZ-B v4 Firmware is Up-to-Date: Make sure your EZ-B v4's firmware is up to date. Firmware updates can resolve unexpected behavior and ensure compatibility with ARC features.

  2. Check EZ-B Connection: Verify that your EZ-B v4 is properly connected and communicating with ARC. If the connection is intermittent or unstable, it might affect the variable updates.

  3. Use the Correct Soundboard Skill: Since you're playing audio through the EZ-B v4, ensure you're using the Soundboard (EZB) skill, not the Soundboard v2 (PC) skill. The Soundboard (EZB) skill is designed to play audio files directly through the EZ-B v4's speaker, which should then correctly update the $EZBPlayingAudio variable.

  4. Scripting Alternative: As an alternative approach, you can use scripting to manually set a custom variable when you start playing an audio file and reset it when the file is expected to finish. This method requires you to know the duration of each audio file. Here's a simplified example using EZ-Script:

# Set a custom variable to indicate audio is playing
SetVar("$MyAudioPlaying", 1)

# Play your audio file (replace "YourAudioFileNameHere" with your actual audio file name)
ControlCommand("Soundboard (EZB)", "PlayTrack", "YourAudioFileNameHere")

# Wait for the duration of the audio file (replace DurationInSeconds with the length of your audio file in seconds)
Sleep(DurationInSeconds * 1000)

# Reset the custom variable to indicate audio has finished playing
SetVar("$MyAudioPlaying", 0)
  1. Contact Support: If you've verified all the above and the $EZBPlayingAudio variable still does not reflect the correct state, consider reaching out to Synthiam's support. There might be a specific issue with your setup or a bug that needs to be addressed.

Using the Soundboard (EZB) skill and ensuring everything is correctly set up should allow the $EZBPlayingAudio variable to work as intended. If the issue persists, further investigation with Synthiam's support might be necessary.


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
PRO
Synthiam
#4  

It works fine - without understanding how you're using it, i can't tell you if it's being used incorrectly.

I recorded and played back audio and watched the variable change from 0 to 1. Here's my screenshot

User-inserted image

#5  

@Athena, Thanks. I've verified that everything is connected and I'm using the proper soundboards. The $Ezbplayingaudio Variable does not change from 0 to 1 in the Smart Variable Watcher when I play a file through the EZB. The only thing I haven't done id check for updated firmware on the EZB.

As far as you suggestion to use custom variables, for me,  that would be much the same as using the sleep() command that I'm already using.

I've actually installed the regular Variable Watcher thinking it may be and issue with the Smart Variable Watcher. This variable still wont change.

One other thing to consider, I'm connected to the EZB's camera port from an onboard computer through it's USB port. Would connecting through a COM port instead of over WIFI cause this problem?

#6  

@DJ. Thanks for the help. Like I just posted back to Athena, I'm connecting to the EZB through my computers USB port. I'm running headless and using Tight VNC to control ARC from my laptop. The sound files are loaded into several EZB Soundboards in ARC that is controlling the robot. When I play a sound file from any of my EZB soundboards that variable will not change. It stays at 0. This is the case weather I trigger a sound file from a script ot click on the play button directly on the soundboard.

PRO
Synthiam
#7   — Edited

You're playing the sound out of the ezb soundboard or out of the PC speaker?

Used the soundboard EZB and also see it change

User-inserted image

PRO
Canada
#8  

Based on the information provided, it seems there might be a misunderstanding regarding how the $EZBPlayingAudio variable works and the setup you're using. Let's clarify a few points to ensure we're on the same page:

  1. SoundBoard(EZB) vs. Soundboard v2(PC): The $EZBPlayingAudio variable specifically reflects the audio playback state when using the SoundBoard(EZB) skill, which plays audio through the EZ-B v4's speaker. If you're using the Soundboard v2(PC) skill, which plays audio through your computer's speaker, the $EZBPlayingAudio variable will not change, as this variable is tied to the EZ-B's audio playback.

  2. Connection Method: The method you use to connect to the EZ-B (USB vs. Wi-Fi) should not affect the $EZBPlayingAudio variable when playing audio through the EZ-B v4's speaker using the SoundBoard(EZB) skill. However, it's crucial to ensure that the audio files are indeed being played through the EZ-B v4 and not the PC for this variable to update correctly.

Given your setup and the clarification from @DJ, if you're indeed using the SoundBoard(EZB) skill and the audio is played through the EZ-B v4's speaker but the variable still doesn't change, here are a few troubleshooting steps:

  • Firmware Check: Ensure your EZ-B v4's firmware is up to date. Firmware updates can resolve unexpected behavior and improve compatibility with ARC features.

  • Skill Verification: Double-check that you're using the SoundBoard(EZB) skill for playing audio files and not the Soundboard v2(PC) or any other PC-based audio playback method.

  • Scripting Approach: If the primary goal is to synchronize actions with audio playback and the $EZBPlayingAudio variable isn't updating as expected, consider using the scripting approach with known audio file durations as a workaround. While it's similar to using sleep(), it provides a more controlled way to manage actions in sync with audio.

  • Support Inquiry: If after verifying the above points the issue persists, it might be beneficial to reach out to Synthiam's support directly. There could be a specific issue with your setup or a bug that needs to be addressed.

Remember, the $EZBPlayingAudio variable is designed to reflect the audio playback state of the EZ-B v4 when using the SoundBoard(EZB) skill. Ensuring that the audio files are played through the correct skill and the EZ-B v4's speaker is crucial for this variable to work as intended.


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
#9  

I'm playing the sound file through the EZB. I did the sound mod where I attached a audio jack to the proper traces before the EZB's onboard amp. I then have an amp and speaker connected to that break out plug. I have the sound turned off on the onboard computer that ARC is running on. Here's a little vid of what is happening:

PRO
Synthiam
#10  

Are you sure the smart variable watcher is updating? Try playing the sound, then pressing the REFRESH on the smart variable watcher. Maybe it's being shy or something.

#11  

@Athena, what do you think about the following?

I've been doing a lot of troubleshooting and observing to try to figure this non changing $EZBPlayingAudio variable out. @DJ, yes I did try to refresh the Smart Variable Watcher. I also rebottled the robot, the EZB's and restarted ARC. I've been playing a lot of files to figure this out, both Wav and MP3 from the many EZB Soundboards I have installed and watching this variable not change.

Until............

I have three EZB's on my robot. of course you know they would be connected to connection 0,1 and 2 in ARC's Connection skill. I have all my EZB soundboards playing the sound files mapped to the 3rd EZB (connection 2). I decided to switch some of them over to the other boards to see if the $EZBPlayingAudio variable would change with one of them when a file was played. I found that the Variable would only change to 1 when sound was played through EZB #1 (ARC connection 0). I tried this many times and could only get the variable to change when playing through the first EZB. Odly, it would take a few clicks on the EZB Soundboard sound file after changing the soundboard 1 from the other two EZB's to actually start changing the variable to 1. Along with this, every once in a while, maybe after clicking on the sound file 5 or 6 times the variable would miss a change from 0 to 1. Perhaps I was clicking to fast and not letting the file finish but I just thought I'd mention it.

Anyway, after all this, does the $EZBPlayingAudio variable support multiple EZB's if sound is mapped to another EZB other then connection 0? If not is there a possible fix?

PRO
Canada
#12  

Based on your observations and the detailed troubleshooting you've conducted, it seems that the $EZBPlayingAudio variable is indeed behaving as you described it only changes to 1 when audio is played through the EZ-B connected as EZB #1 (ARC connection 0). This behavior suggests that the $EZBPlayingAudio variable is specifically tied to the first EZ-B controller in the ARC connection setup.

To address your questions and observations:

  1. Support for Multiple EZ-Bs: It appears that the $EZBPlayingAudio variable is designed to reflect the audio playback state of the first EZ-B controller (connection 0) in the ARC setup. This design choice might be based on the assumption that the primary EZ-B controller would handle most interactive tasks, including audio playback.

  2. Possible Fix/Workaround: If you need to monitor audio playback status on other EZ-B controllers (beyond connection 0), a potential workaround would be to implement custom scripting or use other variables to track the playback state manually. For example, you could set a custom variable to 1 right before playing an audio file on a specific EZ-B and reset it to 0 after a calculated delay based on the audio file's length. While not as convenient as having the $EZBPlayingAudio variable automatically reflect the state for all EZ-Bs, it could serve as a temporary solution.

  3. Feature Request: Given your use case and the limitation you've encountered, it might be worth reaching out to Synthiam's support or forums to request a feature enhancement. Specifically, the ability for the $EZBPlayingAudio variable (or a similar mechanism) to reflect the audio playback state across multiple EZ-B controllers in a project could be beneficial for users with complex setups involving multiple EZ-B units.

  4. Refreshing the Smart Variable Watcher: As you've noticed, sometimes the Smart Variable Watcher might not immediately reflect changes to variables. Regularly refreshing it, as DJ suggested, can help ensure you're seeing the most up-to-date variable states. However, the core issue you're experiencing seems to be related to how the $EZBPlayingAudio variable is designed to work with multiple EZ-B controllers.

Your detailed troubleshooting and the video demonstration you've provided are incredibly helpful for understanding the issue. If the workaround mentioned above doesn't suit your needs, reaching out to Synthiam directly for support or to suggest this feature might be the next best step.


I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.
#13   — Edited

@Synthiam Support , Could you please conform my observation and Athena's comment that perhaps the variable $EZBPlayingAudio only works with the first EZB in mutable EZB connections in ARC as discusses above? I'd like to hear it from a real human so I which way to move on this. I may have to move the EZB that handles the sound files to the 0 (first) connection in ARC. I hope not, this would mean a lot of scripts I'd need to edit.

If so, is it worth putting in a Future Request to have some type of multiple EZB support for the $EZBPlayingAudio variable? If it can't be done I wont waist you time asking.

Thank You.

#14  

It may be complicated to have the variable work across multiple EZBs. We will take a further look, but it seems to be a limitation with the ARC's existing framework because there are multiple EZBs and one variable. However, this is something we have taken care of with ARCx. I'm not sure what we can do for legacy ARC. We will keep you updated if something comes to light and there's a breakthrough of an idea.

#15  

Thank you for the clarification. I was unsure as to how this variable worked and on what. It's kinda undocumented or at least I couldn't find anything that explained it's limitations. If I decide to take advantage of using it with my sound system I guess I'll have to go through the work of switching it over to EZB #1 in my project.