User Submitted CoyoteScript

Soundboard

Author: Sander

Script Version: 1

Minimum CoyoteMIDI Build: 560

This script will let you play sound files from translations, allowing you to use translations as a kind of soundboard that is triggered from midi.

This script will add the following translation parameters:

Audio File: The full path to the audio file that should be played when the translation is triggered.

Volume From Input: Whether the volume that the audio file is played at should automatically be determined by the MIDI value that triggered the translation, like the velocity value when the input is a note.

Volume: The volume that the audio file will be played at, if ‘Volume From Input’ is not applicable.
				
					// Make sure the script is ran with the correct parameters and a valid audio file is specified.
if $parameters !contains AudioFile || !(fileexists ($parameters AudioFile))
    messagebox "The specified audio file could not be found!" "Audio Not Found!" ok
    return

$volume = 100
// If specified, calculate the volume based on the MIDI value from the input midi event
if ($parameters VolumeFromMIDI) && $trigger contains rawvalue
    $volume = ($trigger rawvalue) / 127 * 100
// otherwise, read volume from the volume parameter
else
    $volume = ($parameters Volume)

// Play the sound
playsound ($parameters AudioFile) $volume

// Add the UI script parameters
event uirefreshed
    translationparameter AudioFile (textbox "Audio File" "The full path to the audio file to play." default 0.65)
    translationparameter VolumeFromMIDI (checkbox "Volume From Input" "Whether the volume should be taken from the input of the translation, e.g. the velocity or control value." false)
    translationparameter Volume (numberbox "Volume" "The volume to play the audio at." 100 default false 0 100 1)
				
			

9 downloads