Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A more natural version of the script...' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A more natural version of the script...
Authored by: simX on Feb 27, '03 06:24:16PM
Here's a more natural version of this script: you just have to say "play", wait for confirmation, and then the name of the track, bypassing the artist step. This is much more natural, IMHO. Note that if there are 2 tracks with the same name, you can THEN say the artist and it will choose that one. Furthermore, if the artist and track of two songs are the same, it will select a random one, not just play the first it finds.

tell application "iTunes"
set myList to (get name of every track of playlist 1) as list
set myFinishedList to myList & "Cancel"
end tell
tell application "SpeechRecognitionServer"
set myTrack to (listen for myFinishedList with prompt myFinishedList)
end tell
if myTrack is not "Cancel" then
tell application "iTunes"
set myTrackList to (get every track of playlist 1 where name is myTrack)
if number of items of myTrackList is 1 then
play (get first item of myTrackList)
else
set myArtistNames to {"Cancel"} & (get artist of every track of playlist 1 where name is myTrack)
tell application "SpeechRecognitionServer"
set myArtist to (listen for myArtistNames with prompt myArtistNames)
end tell
if myArtist is not "Cancel" then
set myFocusedTrackList to (get every track of playlist 1 where name is myTrack and artist is myArtist)
set randnum to (random number ((number of items of myFocusedTrackList) - 1)) + 1
play (get item randnum of myTrackList)
end if
set randnum to ((random number (numitems - 1)) + 1)
play (get item randnum of myTrackList)
end if
end tell
end if


[ Reply to This | # ]
A more natural version of the script...
Authored by: kawcat on Jul 18, '03 08:23:37AM

Sounds like a wondrful script but...
exactly where should the script be put on the hard disk?

my speech recognition floater recognizes the word "play" but nothing happens when I continue with a artist's or song's name.


I have a rather large music library - is it just because I have to wait a long time for the script to work?



[ Reply to This | # ]
A more natural version of the script...
Authored by: ccsccs7 on Dec 21, '03 07:22:57AM

AppleScript can be slow (and Speech Recognition can also slow down if it has to sort through a large number of words). you'll be searching through a large number of possible matches with an iTunes library.

Another possiblity is that your song titles are hard to pronounce or aren't recognized in the way that you would say it (as opposed to how the computer would expect to "hear" it).

The script should be added to your Speakable Items folder: Library -> Speech -> Speakable Items. You can also get it there by selecting the script in the Finder and saying "make this speakable."



[ Reply to This | # ]
A more natural version of the script...
Authored by: boopeep on Mar 20, '05 11:43:41PM

Wait.. im a gimp. In order for the sript to work, do I need to use the SpeechRecognitionServer file? I'm having the same problem as the other guy. All it does is recognize "play" then nothing else. THX!



[ Reply to This | # ]
A more natural version of the script...
Authored by: apechette on Mar 15, '06 04:08:57PM

Thanks for the script. I copied it into ScriptEditor and then compiled and saved it in the Speakable Items folder. It recognizes the 'play' command but it does not recognize track names. A little help maybe? I have over 5,000 songs, will this make a difference?



[ Reply to This | # ]
A more natural version of the script...
Authored by: rob94 on Dec 31, '08 03:02:22PM

when you use this script you have to say what you named it when you saved it. i named it play originally and it just played a song from itunes. so i decided to try and rename it itunes play and it worked. you have to name it something else such as itunes play instead of play and when you use it you say "itunes play" instead of just "play" and then continue with the artist name or the track name depending on which script you used and it will work. it may take a while for songs with more than one word as the title.



[ Reply to This | # ]