Is there a way to play sounds?

Started by gcanyon, September 27, 2006, 10:42:44 PM

Previous topic - Next topic

gcanyon

I looked in the documentation and didn't see anything related to playing sounds, either resources or external files. Is there a way to do this?



thanks,



Geoff

HPW

#1
Depends on what you understand for sound?

And what platform?



When you search on http://mini.net/tcl/">http://mini.net/tcl/ for 'sound' there are various option based on TCL/TK.

Other solution maybe possible on your target platform using DLL's via import.
Hans-Peter

pjot

#2
Hi gcanyon,



I created a demo with libMikMod. Please look here:



http://www.turtle.dds.nl/newlisp/">http://www.turtle.dds.nl/newlisp/



If you are running windows, you need the mikmod DLL as well (hosted at same site).





There is also a demo with SDL from camperman:



http://www.alh.net/newlisp/phpbb/viewtopic.php?t=1135">http://www.alh.net/newlisp/phpbb/viewtopic.php?t=1135



Regards

Peter

cormullion

#3
And on MacOS, it's a frequently asked question, since even AppleScript doesn't have a play sound command any more, I think.



But an easy solution is to install http://rainbowflight.googlepages.com/#qtplay">//http://rainbowflight.googlepages.com/#qtplay, a free 64K binary that plays sound files. Then you can call it from newLISP depending on how you want to run it.



Use (exec ... ) to wait until sound finishes before continuing, or (fork (exec ... )) to start the sound without interrupting program flow.



For simultaneous play of more than one sound, use fork and exec more than once:


(fork (exec "/Users/.../bin/qtplay '/Users/.../Library/Sounds/MystMenuClose.aiff'"))
(fork (exec "/Users/.../bin/qtplay '/Users/.../Library/Sounds/MystSliderTrackPress.aiff'"))
(fork (exec "/Users/.../bin/qtplay '/Users/.../Library/Sounds/MystWindowOpen.aiff'"))

Lutz

#4
instead of (fork (exec "...")) have you tried (process "...") ? It also does not block, but returns immediately using less resources.



Lutz

cormullion

#5
Yes, that makes sense!



I suppose I got the mistaken impression that 'process' was for interacting with processes and that 'exec' was for running single commands. If 'process' just runs a command without blocking and then exits it's certainly easier to type and remember than (fork (exec ...)). And if it's more economical with resources as well - even Greenpeace would approve...!