• 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
Solver: Play sounds via script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Solver: Play sounds via script


  • Subject: Solver: Play sounds via script
  • From: Robert Poland <email@hidden>
  • Date: Sat, 23 Mar 2013 21:07:39 -0600

At last I solved  the problem.

It occurred to me  that the version of Smile was far from new. The Migration Assistant probably installed an over three year old version. No, I didn't think to find out what version.

I installed the latest version of Smile and the afplay script works as it should.

I hope, someday, the Smile people will be more forthcoming about upgrades, among other things.


On Mar 5, 2013, at 7:53 AM, Robert Poland <email@hidden> wrote:

>
> On Mar 5, 2013, at 7:35 AM, Luther Fuller <email@hidden> wrote:
>
>> On Mar 4, 2013, at 10:03 PM, Robert Poland wrote:
>>
>> You seem to want a sound file to play to completion, so your use of ...
>>
>>> 	set cmd to "afplay -v " & scaleValue & " " & mantelSound
>>> 	do shell script cmd
>>
>> is correct. You should NOT use ...
>>
>>> 	set soundpid to do shell script "afplay " & soundPath & " &> /dev/null & echo $!" -- start the music
>>
>> This was extracted from one of my scripts where I DID want to get the soundpid so I could use 'kill soundpid' to end the sound when appropriate. You don't need this.
>
>
> Luther,
>
> Below is my current script.
>
> It works well on all the computers I have tried it on EXCEPT the 2013 27" iMac. Nothing seems to work on this machine.
>
> -->
> set nominalValue to 40 -- nominal 27" iMac setting
>
> set mantelSound to alias ((path to documents folder as text) & "clutter:Sounds:mantel.aiff")
> set mantelSound to quoted form of POSIX path of mantelSound
>
> tell (get volume settings)
> 	-- set {outputVolume, b, c, d} to {output volume, input volume, alert volume, output muted}
> 	set outputVolume to {output volume}
> end tell --> {40, 50, 100, false}
>
> set outputVolume to outputVolume as integer
> if outputVolume < 3 then set outputVolume to 3 -- don't go to zero
>
> if outputVolume ≥ 3 then -- skip it if the sound is too low
> 	set scaleValue to nominalValue / outputVolume -- percent of current output of nominal level
> 	set scaleValue to scaleValue * (1 / (scaleValue ^ -2)) -- correct afplay -v non linearity
> 	if scaleValue > 3 then set scaleValue to 3 -- limit maximum multiplier
> 	-- display dialog "scaleValue " & scaleValue & return & "nominalValue " & nominalValue & return & "outputVolume " & outputVolume
>
> 	# the "-v" option scales the current ouput level
> 	set cmd to "afplay -v " & scaleValue & " " & mantelSound
> 	do shell script cmd
> end if
> -->
>
> Robert Poland - Fort Collins, CO
>
>
>

Robert Poland - Fort Collins, CO




 _______________________________________________
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


  • Follow-Ups:
    • Re: Solver: Play sounds via script
      • From: Christopher Stone <email@hidden>
References: 
 >Play sounds via script (From: Robert Poland <email@hidden>)
 >Re: Play sounds via script (From: Christopher Stone <email@hidden>)
 >Re: Play sounds via script (From: Robert Poland <email@hidden>)
 >Re: Play sounds via script (From: Christopher Stone <email@hidden>)
 >Re: Play sounds via script (From: Robert Poland <email@hidden>)
 >Re: Play sounds via script (From: Christopher Stone <email@hidden>)
 >Re: Play sounds via script (From: Robert Poland <email@hidden>)
 >Re: Play sounds via script (From: Robert Poland <email@hidden>)
 >Re: Play sounds via script (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: Strings as list items don't always compare as strings
  • Next by Date: Re: Solver: Play sounds via script
  • Previous by thread: Re: Play sounds via script
  • Next by thread: Re: Solver: Play sounds via script
  • Index(es):
    • Date
    • Thread