A Sound object can be programmatically played using EmitSound. Example:
snd = ExampleData[{"Sound", "AltoFlute"}];
Button["Play!", EmitSound[snd]]
What about an Audio object?
The following resulted from a lot of spelunking and reading the code of Audio`Play.
au = ExampleData[{"Audio", "Bird"}];
Audio`Internals`Execute[
Audio`Internals`GetAudioManager[
Audio`AudioInformation[au, "AudioID"]],
"Play"
]
Audio`Play does the same thing except it gets the "AudioID" in a different way which appears to fail.
There are many other commands that can be executed, e.g. "Stop", "Pause", etc. See the definition of Audio`Internals`Execute.
If the audio object is being displayed in the notebook, the seekbar will start moving on playback.
Warning: This is undocumented functionality. I was doing spelunking in M11.0.1 and Audio was introduced in 11.0.0. I expect that the Audio stuff is still under heavy development. I won't be surprised at all if the above stops working in the next version of Mathematica.
Audio`AudioInformation[au, "AudioID"] it does "AudioID" /. Options[au], which fails.
– Szabolcs
Oct 07 '16 at 18:29
Audio`Internals`Execute[ Audio`Internals`GetAudioManager[id], "GetDataPosition"] but no luck.
– M.R.
Oct 12 '16 at 20:53
You can also use Sound`AudioToSound[] to convert the Audio[] object to a Sound[] object that can then be passed to EmitSound[]:
ExampleData[{"Audio", "Bird"}] // Sound`AudioToSound // EmitSound
Of course, this is only recommended for modestly-sized Audio[] objects.
AudioandSoundin v11? Is this a case of oops, we didn't plan well withSoundso let's try again withAudioor is there a completely different application that requires a different container? – Mr.Wizard Oct 07 '16 at 14:26Audio[]can do out-of-core stuff, e.g.Audio["http://exampledata.wolfram.com/bach.mp3"], WhySound[]was not modified to have that ability as well, I dunno... – J. M.'s missing motivation Oct 07 '16 at 14:28Audiois supposed to be more likeImage. It is highly optimized and atomic.Soundcan't really be made atomic as it is meant to hold either wave or midi data and it is meant to be dissected by users. More importantly, Audio supports out-of-core processing. We can haveAudio[File[...]]which won't load all the data into memory. Applying a filter to it produces another file-backed object. – Szabolcs Oct 07 '16 at 14:29Audiobut not refine the oldSound?And it's seem the Mathematica process theAudiofile which have a same size withImageis lower efficiency. – yode Oct 09 '16 at 18:51