Asked
I have a question regarding the ability to play two sound files simultaneously using ARC's PC Soundboard feature. Unfortunately, I can't test this myself at the moment, as I am in the process of rebuilding my robot. However, having an answer would greatly assist in my planning.
Here’s an overview of my current setup:
- My robot includes a Single Board Computer (SBC) running Windows 11, on which ARC is installed.
- The SBC is connected to multiple EZ-B controllers that manage the lights and motors.
- The sound files for my robot are played through the computer's audio output jack, which is linked to ARC's PC Soundboard.
- The audio output from the computer is connected to a small amplifier with speakers to play the files.
My goal is as follows:
- I want to play two sound files from ARC at the same time.
- I have experience with triggering voice files using JavaScript in ARC's PC Soundboard.
- I aim to play a continuous background sound file independently of the intermittently script-triggered voice file.
- I need to manage the background sound file's volume using JavaScript scripts, as well as toggle it on and off.
- There are a couple of buttons on the robot that are monitored by the ADC and connected to an EZ-B, and I plan to use these to control the background sound file.
- It is important that all sound is output through the same audio jack, which is connected to a sound amp and speakers.
- For reference, the voice files are recorded on the right stereo channel, and the background sound file is on the left stereo channel.
Can ARC and Windows facilitate this setup and functionality using JavaScript scripts? Any advice or guidance would be greatly appreciated.
Related Hardware EZ-B v4
Related Controls
Output Audio from EZ-B
Soundboard (PC)
Below is some background and guidance on your setup and requirements:
Simultaneous Audio Playback in ARC
By default, ARC’s PC Soundboard is designed to play one file at a time through the computer’s default audio output. Although Windows supports playing and mixing multiple audio streams at the system level, the Soundboard skill (and the builtin ARC audio functions like Audio.playAudioFile and Audio.say) are not setup to give you independent control of two separate streams on different stereo channels with separate volume controls.
Your Goal
You want to have:
A continuous background sound file (on the left stereo channel), which you can start/stop and adjust the volume
An on-demand voice file (on the right stereo channel) triggered via JavaScript
Because both sounds would be routed to the same audio output jack (and thus through the same amplifier/speakers), achieving independent channel control (and separate volume control) isn’t a feature that ARC’s PC Soundboard currently offers out-of-the-box.
What Are Your Options?
Using ARC’s Built-in Audio APIs
You can use JavaScript to trigger Audio.playAudioFile(filename) or Audio.say(txt) to play sounds. However, if you try to play a second file while one is already playing, one of the audio streams may stop or the sounds may mix in an uncontrolled fashion. In other words, ARC isn’t currently configured to run two independent audio file streams with separate volume controls via the built-in PC Soundboard.
Custom robot skill or External Audio Mixer
To get the functionality you’re aiming for (two simultaneous audio streams on separate stereo channels with independent control), you may need to develop a custom robot skill. For example, you could create a JavaScript (or Python) skill that utilizes an external audio library on Windows capable of playing multiple streams concurrently. This would allow you to:
You can get started learning about creating custom robot skills here:
Create a robot skill Overview
Audio File Preparation
Another approach (if a full custom skill is more than you need) is to pre-mix your sound files into one stereo file. For example, edit your audio files with Audacity (or a similar tool) so that the background is sent exclusively to the left channel and the voice to the right, then trigger additional controls (or even swaps) via ARC. However, note that this approach limits the independent volume control and on/off toggling of the background sound in real time.
Next Steps
Evaluate the Requirements:
Decide if the added complexity of developing a custom skill (or using an external audio library) is worth the flexibility you’re seeking.
Explore a Custom Skill:
If you choose to develop a custom solution, start by reviewing the ARC documentation and look into JavaScript audio libraries that work well on Windows. You might then call these libraries from within ARC’s JavaScript environment.
Ask Follow-Up Questions:
Feel free to share more details about which parts are most critical for your project. For example:
Is independent volume control a high priority, or would simultaneous playback (even if mixed) be acceptable?
Would you be open to using a custom audio mixer application outside of ARC that you control via scripts?
For more information on using the PC Soundboard in ARC, visit:
Soundboard (PC) Skill on Synthiam
And don’t forget to check out ARC’s downloads and resources if you need additional tools:
ARC Downloads and Info
Example JavaScript Snippet (Conceptual)
Here’s a conceptual example using ARC’s JavaScript API to trigger a sound file. (Remember that this uses the built-in Audio.playAudioFile - so this will work for one stream at a time unless supplemented with a custom solution.)
In a custom setup, you’d need to interface with an audio API that handles multiple streams concurrently.
I hope this helps clarify what’s possible with the current capabilities of ARC and points you in the right direction for implementing your desired audio functionality. Would you like to explore more details on developing a custom robot skill for advanced audio control, or do you have any other questions?
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.
OK, thanks for helping me to think this through.
What if I placed the background sound file in an EZB soundboard and ran this file through the EZB speaker? Could I get separate control from the PC soundboard voice files and turn the background sounds on and off and also control it's volume that way? I know the EZB soundboard has a volume control built into it.
Below is an explanation and some guidance based on your updated scenario.
Using Separate Soundboards
EZB Soundboard for Background Audio:
If you place your continuously playing background sound file in the EZB Soundboard, you benefit from having its builtin volume control and on/off capability. When triggered, the EZB soundboard will output the background sound via the EZB speaker port.
PC Soundboard for Voice Audio:
Your interrupt-driven voice files played via the PC Soundboard will continue using the PC’s audio output. These two soundboards run from separate sources within ARC.
Considerations for Your Setup
Independent Volume Control:
Simultaneous Playback:
Stereo Channel Considerations:
Implementing Control via JavaScript Scripts
Triggering EZB Soundboard:
You can use ARC’s built-in ControlCommand() or JavaScript calls to start or stop the EZB background sound. For instance, you might use:
And then later, to stop it:
Adjusting Volume:
If you need to adjust the background sound’s volume via scripts, the EZB Soundboard typically provides volume controls. Check the skill’s properties for any available methods or script commands to adjust its volume. You might also inspect the volume setting property in the skill control.
Triggering PC Soundboard Voice File:
Likewise, you would trigger the voice file on the PC Soundboard using a similar script command:
Summary
Yes, by placing the background sound file in an EZB Soundboard, you can achieve separate control over that sound using its built-in volume and on/off functionality. Meanwhile, your PC Soundboard can handle the intermittently triggered voice files. Just keep in mind:
I hope this clarifies how you can separate control over the background and voice audio. Do you need further details on any of these steps or more help with JavaScript scripting in ARC? Feel free to ask!
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.
EZB can only stream one audio at a time
Using the Audio.playAudioFile() command is good but uses the pc speaker
In order to play two or more audio files from sound boards, there must be multiple sound boards. A soundboard can only play one file. This is PC audio only as mentioned in #1 the EZB can only stream one audio at a time
Below is some additional clarification based on DJ_Sures's points:
EZB Audio Streaming Limitation:
The EZB firmware supports streaming only one audio file at a time. This means that if you’re using the EZB Soundboard, it can only output one audio stream at any given moment.
PC Audio Streaming via Audio.playAudioFile():
The command Audio.playAudioFile() plays audio using the computer’s speaker. While this works well, it is limited to one audio stream per instance of that command. If you want multiple audio files playing concurrently from the PC side, you would need to work with separate instances (or separate sound boards) so that each one handles its own audio stream.
Soundboard Limitations:
As noted, each sound board-whether it's the PC Soundboard or an EZB Soundboard-is designed to play one file at a time. If simultaneous playback is required, you must have multiple sound boards. For example, if you want one sound board handling a continuous background audio and another to handle intermittent voice files, you would need to route those through separate sound boards. However, keep in mind that:
Overall Implications for Your Setup:
This means that if you need simultaneous playback of two different audio files (for instance, background audio and triggerable voice), you will have to spread them across different sound board instances and potentially mix the outputs externally. For example:
I hope this further clarifies the limitations and helps you plan your audio strategy more effectively. Do you have any additional questions or need further guidance on configuring or setting up these sound boards in your project?
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.