I have a database where I want to play certain songs. Here’s how I’ve been doing it with one permanent variable and some file global variables.
pvMyPath = "/Users/Larry/Music/iTunes/ShortSongs/"
fgTheSong = "ShortTheGambler.m4a"
fgTheSongToPlay = pvMyPath + fgTheSong
playsound fgTheSongToPlay
That has been working great. But now I want to make sure that when the song is played, it doesn’t blast out too loud. For a song I name in the code, the following line works.
playsound "/Users/Larry/Music/iTunes/ShortSongs/ShortTheGambler.m4a","VOLUME",0.5
I tried putting the above line in a variable, by building the variable by adding the parts together -
pvMyPath = """/Users/Larry/Music/iTunes/ShortSongs/"
fgTheSong = "ShortTheGambler.m4a" + {"}
fgThePathSongVolume = pvMyPath + fgTheSong + "," + {"VOLUME"} + "," + "0.5"
Which gives the content of the variable - “/Users/Larry/Music/iTunes/ShortSongs/ShortTheGambler.m4a”,“VOLUME”,0.5
When I output the variable with a message statement, it looks correct—exactly like the path, song, volume that works when it’s not in a variable. But when I put this variable after the playsound statement,
playsound fgThePathSongVolume
I get the error:
Cannot play sound (“/Users/Larry/Music/iTunes/ShortSongs/ShortTheGambler.m4a”,“VOLUME”,0.5).
Can the volume option be used in or with a variable? What am I doing wrong? Any help would be appreciated.