• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Play sounds via script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Play sounds via script


  • Subject: Re: Play sounds via script
  • From: "koenig.yvan" <email@hidden>
  • Date: Sun, 03 Mar 2013 17:44:52 +0100


Le 03/03/2013 à 17:24, Robert Poland <email@hidden> a écrit :

Thanks Luther,

if I run;

set soundPath to (path to documents folder as string) & "clutter:Sounds:mantel.aiff" as alias
do shell script "afplay " & soundPath & " &> /dev/null & echo $!" -- start the music

I get a console "60641" and no sound.

When we speak to shell we can't use alias but POSIX path.

(path to documents folder as string) & "clutter:Sounds:mantel.aiff"
set soundPath to quoted form of POSIX path of result
do shell script "afplay " & soundPath & " &> /dev/null & echo $!" -- start the music

I made tests with a stripped version :


(path to documents folder as string) & "clutter:Sounds:mantel.aiff"
set soundPath to quoted form of POSIX path of result
do shell script "afplay " & soundPath

afplay is supposed to be able to play any audio file that QuickTime supports (including mp3, aiff, wav, etc.).

I ran a short script to learn the available options :

do shell script "afplay -h"
(*
error "Usage:
afplay [option...] audio_file

Options: (may appear before or after arguments)
  {-v | --volume} VOLUME
    set the volume for playback of the file
  {-h | --help}
    print help
  { --leaks}
    run leaks analysis
  {-t | --time} TIME
    play for TIME seconds
  {-r | --rate} RATE
    play at playback rate
  {-q | --rQuality} QUALITY
    set the quality used for rate-scaled playback (default is 0 - low quality, 1 - high quality)
  {-d | --debug}
    debug print output" number 1
*)


Yvan KOENIG (VALLAURIS, France) dimanche 3 mars 2013 17:44:48


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Play sounds via script (From: Robert Poland <email@hidden>)
 >Re: Play sounds via script (From: Luther Fuller <email@hidden>)
 >Re: Play sounds via script (From: Robert Poland <email@hidden>)

  • Prev by Date: Re: Play sounds via script
  • Next by Date: Re: Play sounds via script
  • Previous by thread: Re: Play sounds via script
  • Next by thread: Re: Play sounds via script
  • Index(es):
    • Date
    • Thread