Play Sound From Folder

Play a random audio file from a folder
Preview
Preview

Parameters

Audio Devicerequired
Select
default:Application Default

Select an audio device to use for output

Application Default will use the device configured in the Settings tab in Streamer.bot

Folder containing...required
Folder

Select the folder containing the audio files for playback.

Click ... to open a file browser.

Supported formats: mp3, wav

Finish playing before continuing
Toggle
default:true

Wait for playback to complete before continuing to the next sub-action.

When disabled, the sound will play immediately and the next sub-action will begin to execute with no delay.

Recursive
Toggle
default:false

Include all subdirectories within the selected folder

Volume
Range
default:100

Adjust the output volume

This is a simple volume control. It can often be useful to instead adjust the volume with a tool like Audacity.

Sound Name
string
Use Filename As Name
Toggle

Enabling this will use the filename of the sound as the sound name

Variables

The following variables will be populated after executing this sub-action:

Description
randomSoundFilestring

Full path of the audio file that was randomly selected for playback

Example: C:\ScaryNoises\chad.mp3
randomSoundFileNamestring

File name of the audio file that was randomly selected for playback

Example: chad.mp3

C# Usage

public double PlaySoundFromFolder(string path, Single volume = 1, bool recursive = false, bool finishBeforeContinuing = false, string name, bool useFileName = true)