EmitSound
EmitSound[_Audio | _Sound, opts___]emits (without output or any widgets) a Sound or plays Audio object.
Options
"Window"
The same as in FrontSubmit. By the default is CurrentWindow
Examples
Use EmitSound in a button action to play a note without producing an output widget:
Button["Beep", EmitSound[Sound[SoundNote["C4"]]]]It also accepts imported or generated Audio objects:
EmitSound[Audio["sound.wav"]]
sfx = Audio[
Table[Sin[Sqrt[10000.0 t]], {t, 0, 4 Pi, 0.001}],
"Real32"
];
EmitSound[sfx]UI events such as button clicks provide the current window implicitly. Timers lose that evaluation context, so capture the window before creating the timer and pass it through the "Window" option:
win = CurrentWindow[];
SetTimeout[
EmitSound[Sound[SoundNote["C4"]], "Window" -> win],
Quantity[2, "Seconds"]
];If you want to continuously stream raw sound data, consider to use a low-level streamer PCMPlayer