Play Sound: Difference between revisions

From Fancade Wiki
(Created page with "File:Play_Sound.png Plays a sound effect with optional volume and pitch inputs and outputs the channel the sound is played on. Use the settings to change which sound effect is played. Inputs: * Volume: ranges from 0 to 1 (inclusive). * Pitch: ranges from 0 to 4 (inclusive). Output: * Channel: When all channels are occupied or sounds are turned off in fancade settings, it outputs -1. Otherwise, it outputs a non-negative integer where the sound is occupied from 0...")
 
m (Use Image template)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
[[File:Play_Sound.png]]
{{Block
|image=Play Sound.png
|type=s
|folder=Sound
|input1={{Port|e|Before}}
|input2={{Port|n|Volume}}
|input3={{Port|n|Pitch}}
|output1={{Port|n|Channel}}
|output2={{Port|e|After}}
}}


Plays a sound effect with optional volume and pitch inputs and outputs the channel the sound is played on. Use the settings to change which sound effect is played.
Plays a sound effect with optional volume and pitch inputs and outputs the channel the sound is played on.
 
Inputs:
 
* Volume: ranges from 0 to 1 (inclusive).
* Pitch: ranges from 0 to 4 (inclusive).
 
Output:
 
* Channel: When all channels are occupied or sounds are turned off in fancade settings, it outputs -1. Otherwise, it outputs a non-negative integer where the sound is occupied from 0 to 9 (inclusive). Used in conjunction with [[Volume Pitch]].


== Notes ==
== Notes ==


* Unlike most other blocks, a wire connected to Before is *required* for it to do anything, it does not run automatically.
* The volume ranges from 0 to 1 (inclusive). Any value exceeding this range is clipped.
 
* Similarly, Pitch ranges from 0 to 4 (inclusive).
* [[/uploads/Playsound_contextmenu.png]]
* When all channels are occupied or sounds are turned off in Fancade settings, this block outputs -1. Otherwise, it outputs a non-negative integer where the sound is occupied from 0 to 9 (inclusive). Used in conjunction with [[Volume Pitch]].
 
* Unlike most other blocks, a wire connected to Before is ''required'' for it to do anything, it does not run automatically.
  The rightmost setting displays which sound effect is played. Tap to change.
* {{Image|Play_Sound_settings.png}}
 
: The rightmost setting displays which sound effect is played. Tap to change.
  Checking Loop will make the sound repeat on the chosen channel until stopped with [[Stop Sound]]. A looping channel becomes occupied until it is stopped, meaning other Play Sound blocks will not choose that channel.  
:* Checking Loop will make the sound repeat on the chosen channel until stopped with [[Stop Sound]].
:* A looping channel becomes occupied until it is stopped, meaning other Play Sound blocks will not choose that channel.  


== Related ==
== Related ==
Line 26: Line 27:
* [[Stop Sound]]
* [[Stop Sound]]
* [[Volume Pitch]]
* [[Volume Pitch]]


[[Category:Blocks]]
[[Category:Blocks]]

Latest revision as of 08:06, 26 May 2024

Play Sound
Play Sound.png
TypeScript block
ColliderNone
FolderSound
Ports
Inputs Before
Volume
Pitch
Outputs Channel
After

Plays a sound effect with optional volume and pitch inputs and outputs the channel the sound is played on.

Notes

  • The volume ranges from 0 to 1 (inclusive). Any value exceeding this range is clipped.
  • Similarly, Pitch ranges from 0 to 4 (inclusive).
  • When all channels are occupied or sounds are turned off in Fancade settings, this block outputs -1. Otherwise, it outputs a non-negative integer where the sound is occupied from 0 to 9 (inclusive). Used in conjunction with Volume Pitch.
  • Unlike most other blocks, a wire connected to Before is required for it to do anything, it does not run automatically.
  • Play_Sound_settings.png
The rightmost setting displays which sound effect is played. Tap to change.
  • Checking Loop will make the sound repeat on the chosen channel until stopped with Stop Sound.
  • A looping channel becomes occupied until it is stopped, meaning other Play Sound blocks will not choose that channel.

Related