Page 1 of 1

audio?

Posted: Wed Nov 27, 2013 7:55 pm
by spongman
has anyone managed to get the 'Play[]' function to work on the pi?

Re: audio?

Posted: Wed Nov 27, 2013 8:25 pm
by DougieLawson
I found http://reference.wolfram.com/mathematica/ref/Play.html
So I tried

Code: Select all

Play[Sin[440 2 Pi t], {t, 0, 1}]
and it chose to give me the 52 definitions of WordData["play"]

Re: audio?

Posted: Wed Nov 27, 2013 8:28 pm
by DougieLawson
When I tried it in a command window I got this:

Code: Select all

pi@pi ~/python $ wolfram
Wolfram Language (Raspberry Pi Pilot Release)
Copyright 1988-2013 Wolfram Research
Information & help: wolfram.com/raspi

In[1]:=  Play[Sin[440 2 Pi t], {t, 0, 1}]

Out[1]= Sound[SampledSoundFunction[CompiledFunction[{Play`Time3},

>      Block[{t = 0. + 0.000125 Play`Time3}, (Sin[440 2 Pi t] + 0.) 1.],

>      -CompiledCode-], 8000, 8000]]

In[2]:=
I've not tried transcribing that back into Mathematica.

Re: audio?

Posted: Fri Nov 29, 2013 2:09 am
by alexatwri
DougieLawson wrote:When I tried it in a command window I got this:

Code: Select all

pi@pi ~/python $ wolfram
Wolfram Language (Raspberry Pi Pilot Release)
Copyright 1988-2013 Wolfram Research
Information & help: wolfram.com/raspi

In[1]:=  Play[Sin[440 2 Pi t], {t, 0, 1}]

Out[1]= Sound[SampledSoundFunction[CompiledFunction[{Play`Time3},

>      Block[{t = 0. + 0.000125 Play`Time3}, (Sin[440 2 Pi t] + 0.) 1.],

>      -CompiledCode-], 8000, 8000]]

In[2]:=
I've not tried transcribing that back into Mathematica.
What you have here is a sound object. Play produces a sound object in Mathematica but EmitSound[] actually plays the sound. Sound is under very active development right now so the playback of waveform audio does not currently function as documented in the initial release. In its current incarnation, it should be able to play certain types of sound if there is a FrontEnd available (i.e. X is running). If you use Speak[] (http://reference.wolfram.com/language/ref/Speak.html) with speakers connected, you should hear speech, for instance. Also, SoundNote[] objects should be able to play from the FrontEnd (MIDI sounds). You should expect waveform audio (EmitSound applied to sound objects produced with Play[]) to work as documented in an update soon.

Re: audio?

Posted: Fri Nov 29, 2013 4:20 am
by VitaliyKaurov
Hello,

you may want to take a look at the following post at Wolfram Community:

Does sound work on the Raspberry Pi?