Thanks, Bill. I've made a note of that in case I find it's needed. For now, try/catch is doing everything I want. It hides the error message and lets me try a series of file-extensions: mp3, wav, etc. before giving up. Is there something I'm overlooking?
Ian On Wed, Jan 12, 2011 at 9:05 AM, bill lam <bbill....@gmail.com> wrote: > Ian, > > You can redirect output to null and use adverse conjunction :: to hide > error. > > 2!:1 ::0: 'afplay ~/tee.mp3 >/dev/null 2>&1 &' > > the last & may be needed because 2!:1 has a bug that is does not return > immediately calling commands. untested. > > Срд, 12 Янв 2011, Ian Clark писал(а): >> Thanks, Bill -- I didn't know of a good utility for the Mac. However I >> couldn't find a satisfactory Mac build of mpg123, having downloaded >> tarballs and all. I didn't have time to muck around so I turned to >> Google for help: >> http://www.google.co.uk/search?q=quicktime+bash+script >> which is worth serious study (when I've got time). For example: >> >> Introduction to Open Source Scripting on Mac OS X >> http://developer.apple.com/internet/opensource/opensourcescripting.html >> helps you get started with utility "Terminal". >> >> To debug suitable string args for (2!:1) -- launch "Terminal", and >> copy/paste whatever works. >> >> To cut a long story short, in the end it was so simple. Here for Gian, >> and any wannabe Mac hackers like me, is the recipe... >> >> Procure a very short mp3, or other format such as wav or aiff. Using >> "Audacity" I created a test file: tee.mp3 (the letter 't' from >> recorded speech). Place it in your "root directory" (mine is called >> /Users/ianclark/ --the Mac facility "Spotlight" finds it). You can >> place it in any folder, but then you have to get the path right. You >> don't want too many unknowns first go. >> >> Then the following works in J: >> >> 2!:1 'afplay ~/tee.mp3' >> <...plays sound> >> >> 2!:1 'afplay ~/txe.mp3' NB. (no such file) >> |interface error >> | 2!:1'afplay ~/txe.mp3' >> >> So you need (try./catch.) in case the file's not found. >> >> As an alternative to afplay (Audio File Play) try: >> >> 2!:1 'open -a QuickTime\ Player ~/tee.mp3' >> >> So you don't have to write out a txtfile and execute it as a BASH >> script, like I'd feared. >> >> Playing sounds in J isn't for entertainment. I need them as a >> debugging aid while experimenting with timer events. If the timer >> callback goes wrong the J session locks solid with smoutputs -- and >> the yellow J won't stop it. >> >> So I'm avoiding smoutput in favour of auditory cues. I think I'll give >> my duty-cycle a heartbeat. :) >> >> Ian >> >> >> On Wed, Jan 12, 2011 at 4:50 AM, bill lam <bbill....@gmail.com> wrote: >> > In Linux I would just command utilities when possible, eg >> > 2!:1 'mpg123 carmen.mp3' >> > >> > btw wd commands documentation does not include isipicture because that >> > command had been decommitted. >> > >> > jgtk supports i18n via gettext verb but one needs to provide separate >> > translation file for each languages. >> > >> > Срд, 12 Янв 2011, Ian Clark писал(а): >> >> Trouble is, this is Win-only, using PlaySound / PlaySoundA. >> >> >> >> Has anyone done something comparable on the Mac or Linux? Or must I >> >> generate and execute a Bash script? >> >> >> >> >> >> On Tue, Jan 11, 2011 at 4:23 PM, David Mitchell <davidmitch...@att.net> >> >> wrote: >> >> > For wav's this worked for me: >> >> > >> >> > load'media/wav' >> >> > wavplay'K:\Program Files\Microsoft >> >> > SDKs\Windows\v7.1\Samples\winui\speech\engines\samplettsengine\makevoice\blah.wav' >> >> > >> >> > http://www.jsoftware.com/jwiki/Addons/media/wav?highlight=(wav) >> >> > >> >> > I suggest that you check on the J wiki for many helpful hints. >> >> > -- >> >> > Cheers, >> >> > David >> >> > >> >> > On 1/11/2011 5:45, Gian Medri wrote: >> >> >> *I am very new at J, but I have used APL many years. I develop >> >> >> programs as >> >> >> a help to dyslectic pupils as well as to those who have difficulties in >> >> >> learning mathematics. In this contest pictures and sound are >> >> >> essential. >> >> >> >> >> >> 1) How do I get a picture (bmp or others) as a background in a form or >> >> >> as an >> >> >> image? I tried with (wd ' set isipicture filename'), without success . >> >> >> wd >> >> >> commands documentation is not complete and there is not example in >> >> >> the Labs >> >> >> or Demos. >> >> >> >> >> >> 2)**How do I get a sound from a wav file or others format? >> >> >> >> >> >> 3)Normally I have programs that works with 2 or 3 languages. >> >> >> I can change the language in buttons and other controls but not in the >> >> >> menus. >> >> >> >> >> >> >> >> >> Many thanks in advance. >> >> >> >> >> >> Gian* >> >> > ---------------------------------------------------------------------- >> >> > For information about J forums see http://www.jsoftware.com/forums.htm >> >> > >> >> ---------------------------------------------------------------------- >> >> For information about J forums see http://www.jsoftware.com/forums.htm >> > >> > -- >> > regards, >> > ==================================================== >> > GPG key 1024D/4434BAB3 2008-08-24 >> > gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 >> > ---------------------------------------------------------------------- >> > For information about J forums see http://www.jsoftware.com/forums.htm >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm > > -- > regards, > ==================================================== > GPG key 1024D/4434BAB3 2008-08-24 > gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm