(Many of the Audio*
symbols and functionality are still mostly experimental, so I understand that not all the kinks might be worked out yet. Still, I'd like to try to make this work!)
As far as I know, there are two ways to play and loop audio, but each either 1) isn't able to be looped automatically (via evaluation) in an obvious way, or 2) doesn't loop samples well (by inserting a small gap between each playback), respectively:
Audio
When you create an Audio
object as output, you have the option to click to expand the output, then click on the "loop" symbol, and play it back looped. E.g.
AudioGenerator[{"Sin", Quantity[110, "Hz"], 0}]
(Apologies for the large images; feel free to shrink them if you know how.)
This loops seamlessly. However, the only way I know to get this behavior is by clicking on the output manually.
AudioStream
On the other hand, if you create an AudioStream
via e.g. AudioPlay
, and set Looping -> True
, it plays and loops automatically upon evaluation, but the audio features an unpleasant skip when it loops back to the beginning.
AudioPlay[AudioGenerator[{"Sin", Quantity[110, "Hz"], 0}], Looping -> True]
(I still haven't updated from 12.3.0 to 12.3.1, so if this happens to have been fixed in the 0.0.1 difference, let me know :) )
I'd like a way to loop audio automatically without clicking and free of skipping (in particular, for dynamic purposes). So, I'd like either
a way to interface with
Audio
output objects without mouse inputs that lets me trigger playback and enable looping automatically, preferably while hiding the output form visually as wella way to eliminate the skip heard in looped
AudioStream
s, so that (when possible) it loops seamlesslya totally separate workaround that lets me play back and loop audio programmatically and seamlessly.
(It would also be great to be able to manipulate the audio as its playing—e.g. to change the frequency—so if pursuing one of these directions over another is more amenable to that end goal, I'd appreciate any insight. But that's not strictly necessary.)
Thanks!
AudioStream
objects fail to do even that, whileAudio
output objects succeed, but require manual operation. $\endgroup$