I have some Problems with the Sound under Digital Unix
Here a example:
I create a sound object (s1)first:
s1 = Play[Sin[880 Pi t], {t, 0, 10}];
Play and "Friends" do'nt work on my Unix OS (Why ???)
so I'm going to export the sound object into a file:
Export["/myhome/tmp/mysound.wav", Show[s1], "WAV"]
and play it with the decsound command line executable:
! "/usr/bin/mme/decsound -play /myhome/tmp/mysound.wav"
Ok it works - I can here the sound (-:
Now I created a module:
MySound[sound_] := Module[{},
Export["/myhome/tmp/mysound.wav", Show[sound], "WAV"];
! "/usr/bin/mme/decsound -play /myhome/andre/tmp/mysound.wav"
]
MySound[s1]
where the two lines are taken from above, but it doesn't work.
And I can't see the reason, so please help me.
I am also intrested in the reason, why I had to make all these
thinks for listening a simple Sound.
PS I tested some "work arounds" with sound.m from the mathematica FAQ's
but it doesn't work.
MFG
Andre
--
+-----------------------------------+-----------------------------+
| mobil tel. -------------- | Andre Heinemann |
| priv. tel. (0351) 25 23 574 | Institut fuer Festkoerper- |
| Tel.: (++49) (351) 4659 - 686 | und Werkstofforschung |
| Fax: (++49) (351) 4659 - 452 | Helmholtzstr. 20, R2.140 |
| email: a.hei...@ifw-dresden.de | Postfach 27 00 16 |
| | D-01171 Dresden (Germany) |
+-----------------------------------+-----------------------------+
> I have some Problems with the Sound under Digital Unix
>
> Here a example:
>
> I create a sound object (s1)first:
>
> s1 = Play[Sin[880 Pi t], {t, 0, 10}];
>
> Play and "Friends" do'nt work on my Unix OS (Why ???)
In Mathematica, the playing of sounds is done normally through the front
end. The Play[] returns a Sound object and also results in a PostScript
string being sent to the front end. This PostScript string contains a
waveform of the sound. Under MacOS and Windows, the front end can then
play the sound by hooking into the operating system interfaces for sound
generation. The X Window front end does not have this feature.
http://support.wolfram.com/Systems/Unix/FE/Sound.html
Part of the reason this is so is because many of the Unices do not have a
uniform interface for playing sound. Compaq's Tru64 UNIX on Alpha is one
of these cases. See this page for further reading:
http://www.unix.digital.com/demos/freekit/html/audio.htm
> so I'm going to export the sound object into a file:
>
> Export["/myhome/tmp/mysound.wav", Show[s1], "WAV"]
>
> and play it with the decsound command line executable:
>
> ! "/usr/bin/mme/decsound -play /myhome/tmp/mysound.wav"
>
> Ok it works - I can here the sound (-:
>
> Now I created a module:
>
> MySound[sound_] := Module[{},
>
> Export["/myhome/tmp/mysound.wav", Show[sound], "WAV"];
>
> ! "/usr/bin/mme/decsound -play /myhome/andre/tmp/mysound.wav"
>
> ]
>
> MySound[s1]
>
> where the two lines are taken from above, but it doesn't work.
I suspect that it is because the "!" is being interpreted as the prefix
form of Not[] in the module. A more elegant way to get at what you
describe might be one of the following.
If decsound supports receiving input on stdin, you can do a pipe operation
like so:
mySound[snd_Sound] :=
(
Export["!/usr/bin/mme/decsound -play", snd, "WAV"];
Return[snd]
)
Here, the exclamation point tells Export[] that the output should be piped
through the command that follows.
If stdin is not supported, the proper way to do a scratchfile approach
would be:
mySound[snd_Sound] :=
Module[
{tmpnam = Close[OpenTemporary[]]},
Export[tmpnam, sound, "WAV"];
Run["/usr/bin/mme/decsound -play", tmpnam];
DeleteFile[tmpnam];
Return[snd]
]
--
P.J. Hinton
Mathematica Programming Group pa...@wolfram.com
Wolfram Research, Inc.
Disclaimer: Opinions expressed herein are those of the author alone.
This is a correction to this code snippet in my prior posting:
> mySound[snd_Sound] :=
> Module[
> {tmpnam = Close[OpenTemporary[]]},
> Export[tmpnam, sound, "WAV"];
> Run["/usr/bin/mme/decsound -play", tmpnam];
> DeleteFile[tmpnam];
> Return[snd]
> ]
The second argument to export should be snd, not sound.
mySound[snd_Sound] :=
Module[
{tmpnam = Close[OpenTemporary[]]},
Export[tmpnam, snd, "WAV"];
Run["/usr/bin/mme/decsound -play", tmpnam];
DeleteFile[tmpnam];
Return[snd]
]
I apologize for the confusion.
Thanks for the tip.
I tried implementing the sound.m files as outlined on the Wolfram
support web site, but it did not work. The "sound" window would pop
up, but then nothing happened. The kernel just kept chewing away at
it. I did notice the the sound menu in the window was "grayed out".
My system came preinstalled with Red Hat Linux 6.0, so I do not know if
something was left out of the installation that motifps needs. If
anyone has any ideas on the fix, please let me know. I am new to Linux
and have no idea what to look at to try and fix it.
However the procedure below worked beatuifully if I changed the Run
command to "esdplay". Just thought others might like to know.
Adam Smith
In article <8jc6tb$d...@smc.vnet.net>,
Sent via Deja.com http://www.deja.com/
Before you buy.