spongman
Posts: 11
Joined: Wed Aug 22, 2012 9:04 pm

audio?

Wed Nov 27, 2013 7:55 pm

has anyone managed to get the 'Play[]' function to work on the pi?

User avatar
DougieLawson
Posts: 40123
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: audio?

Wed Nov 27, 2013 8:25 pm

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"]
Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

User avatar
DougieLawson
Posts: 40123
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: audio?

Wed Nov 27, 2013 8:28 pm

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.
Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

alexatwri
Posts: 12
Joined: Fri Nov 29, 2013 1:59 am

Re: audio?

Fri Nov 29, 2013 2:09 am

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.

User avatar
VitaliyKaurov
Posts: 2
Joined: Tue Nov 26, 2013 11:04 pm
Contact: Website

Re: audio?

Fri Nov 29, 2013 4:20 am

Hello,

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

Does sound work on the Raspberry Pi?

Return to “Mathematica”