Play iTunes soundtrack under Keynote with Applescript

OK, so this isn't a question, more of a solution to a question I was struggling with: how to play multiple songs in the background of a Keynote presentation. What's more, I needed that soundtrack to fade out for certain important slides that had their own audio, but then fade back in (without starting over) when that slide was done.
I'm creating a standalone presentatoin that will run unattended, looped, during an event. It must be completely automated. It's mostly text slides, which is why I wanted general music underneath. But there are also some slides with videos of their own. I wanted a way to drop the soundtrack at the right time, and then restore the soundtrack afterward.
My solution is to set up my playlist in iTunes, play it, then run an applescript, and then start the slideshow. The script first sets the iTunes volume to whatever "MAX" volume is in the script. You can edit this to be a MAX volume of 10, 40, 100, etc. The script constantly monitors the slideshow, and when the slideshow gets to any slide with the command "itunesdown" anyhwere in the text of the presenter notes, it triggers an incremental drop of iTunes' volume by 10 units every .1 second until the volume is zero. If you want a slower fade, look for all of the delay values of .1 and make them .2, .3, whatever. It also keeps a lookout for any slide with the text "itunesup" and does exactly the reverse, raising the volume incrementally up to the MAX value.
I have not explored the possibility of also having the script monitor other text variables to perhaps trigger different playlists. I think that's possible, but for someone else to work out.
I'm sure there's a more elegant way to code this; I have certain lines of code literally repeated ten times to cover the full range of volume from 0 to 100 and back. I know there's a counter function that could do that in less space. But, again, I'll leave that to y'all.
Hope this helps someone!
-Scott
#ENTER YOUR OWN MAXVOL VALUE ON THE NEXT LINE
set MAXvol to 80
tell application "iTunes"
     if it is running then
          set the sound volume to MAXvol
     end if
end tell
repeat
  #LOOK FOR VOLUME DOWN SLIDE
     tell application "Keynote"
          set slideNotes to get notes of current slide of first slideshow
          if text of slideNotes contains "itunesdown" then
  #Decrease iTunes Volume
               tell application "iTunes"
                    if it is running then
                         set curVol to the sound volume
                         if curVol > 10 then
                              set sound volume to curVol - 10
                         else
                              set sound volume to 0
                         end if
                    end if
                    delay 0.1
               end tell
  #Decrease iTunes Volume
               tell application "iTunes"
                    if it is running then
                         set curVol to the sound volume
                         if curVol > 10 then
                              set sound volume to curVol - 10
                         else
                              set sound volume to 0
                         end if
                    end if
                    delay 0.1
               end tell
  #Decrease iTunes Volume
               tell application "iTunes"
                    if it is running then
                         set curVol to the sound volume
                         if curVol > 10 then
                              set sound volume to curVol - 10
                         else
                              set sound volume to 0
                         end if
                    end if
                    delay 0.1
               end tell
  #Decrease iTunes Volume
               tell application "iTunes"
                    if it is running then
                         set curVol to the sound volume
                         if curVol > 10 then
                              set sound volume to curVol - 10
                         else
                              set sound volume to 0
                         end if
                    end if
                    delay 0.1
               end tell
  #Decrease iTunes Volume
               tell application "iTunes"
                    if it is running then
                         set curVol to the sound volume
                         if curVol > 10 then
                              set sound volume to curVol - 10
                         else
                              set sound volume to 0
                         end if
                    end if
                    delay 0.1
               end tell
  #Decrease iTunes Volume
               tell application "iTunes"
                    if it is running then
                         set curVol to the sound volume
                         if curVol > 10 then
                              set sound volume to curVol - 10
                         else
                              set sound volume to 0
                         end if
                    end if
                    delay 0.1
               end tell
  #Decrease iTunes Volume
               tell application "iTunes"
                    if it is running then
                         set curVol to the sound volume
                         if curVol > 10 then
                              set sound volume to curVol - 10
                         else
                              set sound volume to 0
                         end if
                    end if
                    delay 0.1
               end tell
  #Decrease iTunes Volume
               tell application "iTunes"
                    if it is running then
                         set curVol to the sound volume
                         if curVol > 10 then
                              set sound volume to curVol - 10
                         else
                              set sound volume to 0
                         end if
                    end if
                    delay 0.1
               end tell
  #Decrease iTunes Volume
               tell application "iTunes"
                    if it is running then
                         set curVol to the sound volume
                         if curVol > 10 then
                              set sound volume to curVol - 10
                         else
                              set sound volume to 0
                         end if
                    end if
                    delay 0.1
               end tell
  #Decrease iTunes Volume
               tell application "iTunes"
                    if it is running then
                         set curVol to the sound volume
                         if curVol > 10 then
                              set sound volume to curVol - 10
                         else
                              set sound volume to 0
                         end if
                    end if
                    delay 0.1
               end tell
          else
  #LOOK FOR VOLUME UP SLIDE
               if text of slideNotes contains "itunesup" then
  #Increase iTunes Volume
                    tell application "iTunes"
                         if it is running then
                              set curVol to the sound volume
                              if curVol < MAXvol then
                                   set sound volume to curVol + 10
                              else
                                   set sound volume to MAXvol
                              end if
                         end if
                         delay 0.1
                    end tell
  #Increase iTunes Volume
                    tell application "iTunes"
                         if it is running then
                              set curVol to the sound volume
                              if curVol < MAXvol then
                                   set sound volume to curVol + 10
                              else
                                   set sound volume to MAXvol
                              end if
                         end if
                         delay 0.1
                    end tell
  #Increase iTunes Volume
                    tell application "iTunes"
                         if it is running then
                              set curVol to the sound volume
                              if curVol < MAXvol then
                                   set sound volume to curVol + 10
                              else
                                   set sound volume to MAXvol
                              end if
                         end if
                         delay 0.1
                    end tell
  #Increase iTunes Volume
                    tell application "iTunes"
                         if it is running then
                              set curVol to the sound volume
                              if curVol < MAXvol then
                                   set sound volume to curVol + 10
                              else
                                   set sound volume to MAXvol
                              end if
                         end if
                         delay 0.1
                    end tell
  #Increase iTunes Volume
                    tell application "iTunes"
                         if it is running then
                              set curVol to the sound volume
                              if curVol < MAXvol then
                                   set sound volume to curVol + 10
                              else
                                   set sound volume to MAXvol
                              end if
                         end if
                         delay 0.1
                    end tell
  #Increase iTunes Volume
                    tell application "iTunes"
                         if it is running then
                              set curVol to the sound volume
                              if curVol < MAXvol then
                                   set sound volume to curVol + 10
                              else
                                   set sound volume to MAXvol
                              end if
                         end if
                         delay 0.1
                    end tell
  #Increase iTunes Volume
                    tell application "iTunes"
                         if it is running then
                              set curVol to the sound volume
                              if curVol < MAXvol then
                                   set sound volume to curVol + 10
                              else
                                   set sound volume to MAXvol
                              end if
                         end if
                         delay 0.1
                    end tell
  #Increase iTunes Volume
                    tell application "iTunes"
                         if it is running then
                              set curVol to the sound volume
                              if curVol < MAXvol then
                                   set sound volume to curVol + 10
                              else
                                   set sound volume to MAXvol
                              end if
                         end if
                         delay 0.1
                    end tell
  #Increase iTunes Volume
                    tell application "iTunes"
                         if it is running then
                              set curVol to the sound volume
                              if curVol < MAXvol then
                                   set sound volume to curVol + 10
                              else
                                   set sound volume to MAXvol
                              end if
                         end if
                         delay 0.1
                    end tell
  #Increase iTunes Volume
                    tell application "iTunes"
                         if it is running then
                              set curVol to the sound volume
                              if curVol < MAXvol then
                                   set sound volume to curVol + 10
                              else
                                   set sound volume to MAXvol
                              end if
                         end if
                         delay 0.1
                    end tell
               end if
          end if
     end tell
end repeat

Oh - I forgot to cite my work. Thanks to these sites for the inspiration and some of the code
http://alxndrmlr.biz/2011/06/itunes-increase-decrease-volume-script/
http://stackoverflow.com/questions/8710892/applescript-detect-what-slide-is-show ing-in-keynote

Similar Messages

  • How to set the transition duration of a slide in keynote with applescript

    hi
    how to set the transition duration of a slide in keynote with applescript
    i made an applescript script which converts a numbers file to a keynote presentation
    figured out how to set the transitions but cant find how to set the time
    +set appTransition of slideTransition of current slide to "apple:dissolve"+
    anyone?

    you can send keystrokes to invoke menu commands via shortcuts but as for transition time not sure. You've check the dictionary right? Scripting support is very limited in KN.

  • Move Soundtrack Pro Playhead with Applescript?

    I've opened an audio file in Soundtrack Pro with Applescript and would like to move the playhead to the end of the file to insert silence. Seems simple but I've struggled a lot. How might I do this?
    Unlike Microsoft Word, Excel etc. there is relatively little discussion out there on Soundtrack Pro with Applescript. I'd love to just utilize terms from the Soundtrack Pro Applescript dictionary, but the truth is that I'm incapable of using the dictionary effectively. Just like the English language, if you don't know how to put the words together, the dictionary doesn't help you make a sentence; any advice on where/how to learn to put Applescript dictionary terms to use?
    I read an entire beginner's book ("A Beginner's Guide: Applescript") but it didn't discuss dictionaries : (.
    Thank you so much for your help!

    I've opened an audio file in Soundtrack Pro with Applescript and would like to move the playhead to the end of the file to insert silence. Seems simple but I've struggled a lot. How might I do this?
    Unlike Microsoft Word, Excel etc. there is relatively little discussion out there on Soundtrack Pro with Applescript. I'd love to just utilize terms from the Soundtrack Pro Applescript dictionary, but the truth is that I'm incapable of using the dictionary effectively. Just like the English language, if you don't know how to put the words together, the dictionary doesn't help you make a sentence; any advice on where/how to learn to put Applescript dictionary terms to use?
    I read an entire beginner's book ("A Beginner's Guide: Applescript") but it didn't discuss dictionaries : (.
    Thank you so much for your help!

  • HDCP error: can't play iTunes movies or netflix with yosemite

    I get this error message: This movie can be played only on displays that support HDCP (High-bandwidth Digital Content Protection).
    The movies won't play through Quicktime either.
    I get a similar error from Netflix and I've tried switching to Silverlight which work for a couple weeks but now it won't work again.
    I do not have my computer connected to any other device or second screen. 
    This is a brand new retina Macbook Pro 2.8 GHz Intel Core i7, Memory 16GB, 1TB Solid-state, Graphics Intel Iris Pro 1536 MB. 
    Everything is up-to-date.
    I have called Apple twice and they could not find a solution.  I hoped it would be resolved when the first update (10.10.1) came out...but nothing has changed.

    Apple doesn’t routinely monitor the discussions. These are mostly user to user discussions.
    Send Apple feedback. They won't answer, but at least will know there is a problem. If enough people send feedback, it may get the problem solved sooner.
    Feedback
    Or you can use your Apple ID to register with this site and go the Apple BugReporter. Supposedly you will get an answer if you submit feedback.
    Feedback via Apple Developer

  • TS2278 Error Occured when trying to play iTunes on Apple TV with PC

    15000 when streaming to AirPort Express base stations using iTunes with a PC

    Are you only having trouble streaming from this particular PC or any network client to the Apple TV? How is the PC connected to the network, specifically by wire or wireless? What is the make and model of your wireless router? I assume that the Apple TV is connected by wireless to this same router ... correct? What operating system is your PC running?

  • Will I need to purchase iWork for my iPad if I purchase an iPhone 5s? Everybody knows the iPhone 5s with IOS7 gives iWork for free. Then iWork would be listed as purchased app in my itunes store under my account. My iPad retina is in the same account...

    Will I need to purchase iWork for my iPad if I purchase an iPhone 5s? Everybody knows the iPhone 5s with IOS7 gives iWork for free. I assume that if I buy an iPhone 5s (or 5c) then iWork would be listed as a "purchased" app in my itunes store under my account. My iPad retina is in the same account... or are keynote, pages, and numbers completely seperate between ipad and iphone? I know they would be a seperate purchase for my Powerbook. Thanks so much for your help!

    Hi,
    I was able to load the Productivity Suite / Free !!  on both my iPad mini and my iPhone 5s with no problems and at no cost.

  • ITunes Radio/Music Randomly Playing on My iPhone 5 with iOS7

    Hello,
    I apparently do not understand how iTunes Radio/Music operates as I am noticing what I think is strange behavior on my iPhone 5 running iOS 7.  I am noticing that under "artists" in the music app there are suddenly 49 songs that are appearing that I did not download to my iPhone and I can never seem to really get rid of them. There will be times when I wake up my iPhone and presented with one of these songs playing making it appear as if music has been running constantly in the background.  Other times, I will just get my normal lockscreen.  Our others experiencing this?  I have also noticed that the songs that are showing
    I have started listing to iTumes Radio as well but I don;t think the music that is playing is actually iTunes radio but instead these 49 songs that randomly synced to my iPhone without my knowledge.  I would like to delete them and stop having songs randomly appear at times when I wake up my phone.  Also, I do not subscribe to iTunes Match.
    Thanks in advance for any help.
    epie

    I'm having the same trouble.  Sometimes restarting both the mac and the iDevice will help, but not always.
    I restarted in OS X Recovery System mode and rand the Disk Utility and dozens of permissions problems were discovered!  THe trouble is Disk Utility can not seem to fix them and when I reinstalled iTunes 11.1.1 from the Apple site there was no improvement.
    My music library is close to 400gb and I get VERY nervous updating or working on iTunes for fear of losing something.  Most is on CD somewhere though there is not time enough in this life to to re-rip everything.
    What is worse is I just bought Capo 3 and when I drag my songs from iTunes to Capo 3 it says all my files are bad.  It does work if I move the songs directly from the iTunes folder under Music.

  • Itunes plays my TV shows covered with little green dots

    Please help,
    After upgrading to the new version of Itunes my TV shows play with thousands of little green dots all over the screen? Anyone have any ideas to clear up my picture??
    Thanks to all who reply, Dave

    Dave,
    Could you provide some additional details - such as,
    where is your iTunes library located - is it on the
    hard drive of the computer you are using? What
    computer? What version of OS?
    Hi, I´m using a PowerBook G4 1.67ghz 15ïnch with 2 gigs of ram. My TV shows and movies are in my powerbooks internal 80gig hard drive, located in my itunes folder under my user name.

  • Possible to Play iTunes movie/TV clips in Keynote?

    I'm assuming the answer to my question is 'no', but I was surprised that I could find no discussion of this topic.
    I have some TV shows that I have purchased from the iTunes store; they play fine in iTunes, Quicktime, and Front Row, but neither iMovie HD nor Keynote will let me import them. I can import DRM protected audio files.
    It seems logical that since I have the rights to play the files on my machine that I could play a clip of them in a Keynote presentation run from my machine. But perhaps the Keynote export feature would create a 'hole' through which one could crack the DRM.
    Can anyone verify that it is impossible to do this?
    And what are the best workarounds? Use expose to switch to the clip loaded up in Quicktime, perhaps?
    Intel iMac 20"   Mac OS X (10.4.8)  

    You're right, Keynote and iMovie can't play those videos for the same reason. However, here's a workaround for using Keynote with Front Row (if you have a computer that comes with a remote).
    http://www.keynoteuser.com/news/?p=144

  • All my purchased song from iTunes are not playing complete (iPod and computer with Windows Vista), unexpectedly stops and continues with next song. What am I doing wrong?

    All my purchased song from iTunes are not playing complete (iPod and computer with Windows Vista), unexpectedly stops and continues with next song. What am I doing wrong?

    Are the songs playing whole in iTunes? if not download them again.
    else read this Apple Support Article on your problem
    Have a nice day!

  • I am using a mini display to hdmi with my macbook and the display works fine. However, the sound will only play iTunes such as music and movies but when i go online to watch movies on youtube it will not play any sound. Please help

    I am using a mini display to hdmi with my macbook and the display works fine. However, the sound will only play iTunes such as music and movies but when i go online to watch movies on youtube it will not play any sound. Please help

    HDCP maybe? Read this http://www.macnn.com/articles/08/11/26/displayport.drm.conflict/

  • HT4314 I have a game under one account, now I have an Itunes card under a different account, how can I use the $$$ in the card for the game I'm playing, I need to purchase different items for my game.

    I have been playing a game for a while under an account, now I have an Itunes card under a different account and would like to use that $$$ to purchase items for my game, but it doesn't let me because the game was downloaded under the original account. How can I use the $$$ in my new account?

    same here but i cant purchase a movie or anything

  • I transferred my iTunes library from Window PC to MacBook pro and now I cant play songs that I purchased with an earlier ID and Password.  How can I get around this problem?'t

    I transferred my iTunes library from Window PC to MacBook pro and now I cant play songs that I purchased with an earlier ID and Password.  How can I get around this problem?

    Authorize the computer.
    iTunes Store: About authorization and deauthorization - http://support.apple.com/kb/HT1420 - and another helpful post: https://discussions.apple.com/message/17828050

  • My wife had an iPad for a year and synced to our computer with no problem.  I recently received an ipad2 and when I tried to sync using separate apple and iTunes passwords, under her computer user name, it appears I over-road her account and synced all he

    My wife had an iPad for a year and synced to our computer with no problem.  I recently received an ipad2 and when I tried to sync using separate apple and iTunes passwords, under her computer user name, it appears I over-road her account and synced all her apps with my apps on my iPad.  I then set myself up as a new user on our computer and tried to sync.  I now get the error that my iPad is synced to another library.  How can I start over without erasing all my data on the iPad?

    Go back to her login.  Unless you deliberately erased apps, they should all be there, both yours and hers!  Then, you need to set up each iPad separately.  You will notice that they have separate names for that very purpose.
    There is no problem with multiple Apple IDs on the same iTunes on the same computer except...  Apps are permanently associated with the ID that was originally used to obtain them.  If you choose to update an app from inside iTunes and you're logged into the "wrong" ID, you must log out and back in again.
    On the bright side, you can configure either or both iPads to sync with apps and music and movies, etc. from either or both IDs.  Further, if you choose to update the apps from the iPads themselves, there is no need to log out/in.  The device handles that.  All you need is the correct password.  In my case, I use the same password for both IDs to make things easier.

  • I plug my iPhone 3gs into my laptop and it no longer syncs with my iTunes.  Ive tried all the trouble shooting methods and nothing works.  My iPhone doesnt appear on iTunes or under "my computer." Does anyone know how to fix this?

    I plug my iphone 3gs into my laptop and it no longer syncs with my iTunes.  I've tried all the trouble shooting methods and nothing works.  My iPhone doesn't appear on iTunes or under "My Computer." Does anyone know how to fix this?

    If AMDS is running, you are using a USB port directly on the computer and not a hub, you have disconnected other USB devices except keyboard and mouse, you have completely uninstalled and reinstalled iTunes as described in http://support.apple.com/kb/HT1925, You have tried cleaning the connector on the bottom of the phone, you have tried a different cable, you have installed the latest USB drivers for your computer, you have disabled your antivirus and firewall, you are running as an Administrator account and you have tried creating a new user on your computer and connected when logged in as that user then you have exhausted my knowledge. The only other thing to try is a different computer. If it isn't recognized on a different computer you have a hardware problem. Good luck!

Maybe you are looking for

  • Vixia HF10 no longer recognized by iMac

    I've had my Canon HF10 for about a year now and I used to be able to connect it via usb and iMovie would automatically open and I could import my HD movies. I haven't touched the HF10 since at least Thanksgiving '08 and decided to load the movies int

  • Why do I have to set the PrincipalName property on my discovered ApplicationComponent instances?

    In the simple example below I define three classes: MyComputerRoleClass (with base Microsoft.Windows.ComputerRole) MyLocalApplicationClass (with base Microsoft.Windows.LocalApplication) MyApplicationComponentClass (with base Microsoft.Windows.Applica

  • PDF (Designer7) forms not shown in Acrobat 6 or 5

    I have created a simple PDF form with Designer 7, look at: http://www2.fht-esslingen.de/info/11.pdf This form can only be shown on Windows PC with Acrobat 7 Prof. not in Adobe Reader 7 or Acrobat 6 or 5. Can anybody explain me who to create a form wi

  • HT201303 payment method i do not have credit card any more

    hi i do not have credit card any more so when i want to update my apps in my iphone it say (((tap continue and sign in to view billing information)) so i taped continue  it take me to payment method so i do not have credit card any more so what is sh

  • Barcode printing in dotmatrix

    Hi, I have been successful in printing barcode labels onto a laser printer. Also the laser printer has a codepage defined which can understand horizontal tab. The barcode is created by defining the code in se73 and then using it in smartstyles and fi