Audio Playback Misery
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Audio Playback Misery
First of all, I have checked forums all over the net on this issue, read the instructions, and have tried EVERYTHING so far. Here are my specs:
LiveCode Community 7.1.0
Mac OXS 10.9.5
Problem:
Cannot get audio to play at all. The file is 16bit, 44.1K stereo and plays fine using the system or ANY other sound app.
I have tried by accessing via file path and directly importing.
In both examples, I have created a button that SHOULD be playing the audio file...
Filepath attempt: (FYI, the file path is perfect since I used the script to check)
on mouseup
unlock screen
set cursor to busy
#answer file "Choose audio:" commented out now, but used before so as to get file path perfect
#put it commented out now, but used before so as to get file path perfect
play "/Volumes/1TB/LiveCode Stacks/audio_16bit/spotlight_vas_large_sus_lv.01.wav"
answer the result
end mouseup
No sound, no result.
Imported attempt:
on mouseup
unlock screen
set cursor to busy
#answer file "Choose audio:" commented out now, but used before so as to get file path perfect
#put it commented out now, but used before so as to get file path perfect
#play "/Volumes/1TB/LiveCode Stacks/audio_16bit/spotlight_vas_large_sus_lv.01.wav"
play "spotlight_vas_large_sus_lv.01.wav"
answer the result
end mouseup
Again, no sound, no result.
I prefer the file path method since I may develop for mobile, and I understand that imported sounds do not work this way. However, and just FYI, in the project browser in the imported version, I DO see the file. However, it shows the file size as "0". And when I attempt to PLAY the sound from there, nothing happens.
Also, I tried using the system sounds in both cases above and NOTHING. No matter what kind of soundfile, wav, aif, etc. NOTHING works at all. It's as if this engine just won't play a sound at all. VERY discouraging so far. I would have been happy to upgrade to a paid version of this engine, but NO WAY with trouble like this!
LiveCode Community 7.1.0
Mac OXS 10.9.5
Problem:
Cannot get audio to play at all. The file is 16bit, 44.1K stereo and plays fine using the system or ANY other sound app.
I have tried by accessing via file path and directly importing.
In both examples, I have created a button that SHOULD be playing the audio file...
Filepath attempt: (FYI, the file path is perfect since I used the script to check)
on mouseup
unlock screen
set cursor to busy
#answer file "Choose audio:" commented out now, but used before so as to get file path perfect
#put it commented out now, but used before so as to get file path perfect
play "/Volumes/1TB/LiveCode Stacks/audio_16bit/spotlight_vas_large_sus_lv.01.wav"
answer the result
end mouseup
No sound, no result.
Imported attempt:
on mouseup
unlock screen
set cursor to busy
#answer file "Choose audio:" commented out now, but used before so as to get file path perfect
#put it commented out now, but used before so as to get file path perfect
#play "/Volumes/1TB/LiveCode Stacks/audio_16bit/spotlight_vas_large_sus_lv.01.wav"
play "spotlight_vas_large_sus_lv.01.wav"
answer the result
end mouseup
Again, no sound, no result.
I prefer the file path method since I may develop for mobile, and I understand that imported sounds do not work this way. However, and just FYI, in the project browser in the imported version, I DO see the file. However, it shows the file size as "0". And when I attempt to PLAY the sound from there, nothing happens.
Also, I tried using the system sounds in both cases above and NOTHING. No matter what kind of soundfile, wav, aif, etc. NOTHING works at all. It's as if this engine just won't play a sound at all. VERY discouraging so far. I would have been happy to upgrade to a paid version of this engine, but NO WAY with trouble like this!
Re: Audio Playback Misery
Hi MuzkGuy,
1. welcome to the forum!
2. the problem is the old and and outdated "play" command!
It is extremely "picky" and only supports a small amount of file formats,
although a WAV file should play!?
Anyway, since you are on the Mac, you better go with a (hidden) player object!
Create a player object on your card, in the inspector clear the example movies filepath,
hide it, unless you want to display a controller to the user, and set it to your sound filepath.
Can of course also be done via script:
...
set the filename of player "your player here" to "path/to/soundfile.wav"
start player "your player here"
...
Hope that helps!
Best
Klaus
1. welcome to the forum!

2. the problem is the old and and outdated "play" command!
It is extremely "picky" and only supports a small amount of file formats,
although a WAV file should play!?
Anyway, since you are on the Mac, you better go with a (hidden) player object!
Create a player object on your card, in the inspector clear the example movies filepath,
hide it, unless you want to display a controller to the user, and set it to your sound filepath.
Can of course also be done via script:
...
set the filename of player "your player here" to "path/to/soundfile.wav"
start player "your player here"
...
Hope that helps!
Best
Klaus
Re: Audio Playback Misery
Thank you Klaus,
But I'm told that to develop for mobile devices, players can't be used. I thought about creating a button that would "send" to a hidden player or something like that. Would that work?
But I'm told that to develop for mobile devices, players can't be used. I thought about creating a button that would "send" to a hidden player or something like that. Would that work?
Re: Audio Playback Misery
So what I'm asking is that if I use a button to "play" the player (named "Player" in this case) would that work with a mobile development? Here is an example script:
on mouseup
set the filename of player "Player" to "/Volumes/1TB/LiveCode Stacks/audio_16bit/spotlight_vas_large_sus_lv.01.wav"
start player "Player"
end mouseup
on mouseup
set the filename of player "Player" to "/Volumes/1TB/LiveCode Stacks/audio_16bit/spotlight_vas_large_sus_lv.01.wav"
start player "Player"
end mouseup
Re: Audio Playback Misery
just checked this for desktop with a .wav, aiff and an mp3 file...
for mobile on iOS anyway
play soundFile or iphonePlaySoundOnChannel sound, channel, type or build a MoviePlayer controller
read about these in the dictionary...
This example below is using a MoviePlayer controller in an iPhone app...
Code: Select all
on mouseUp
answer file ""
set the filename of player 1 to it
play player 1
end mouseUp
play soundFile or iphonePlaySoundOnChannel sound, channel, type or build a MoviePlayer controller
read about these in the dictionary...
This example below is using a MoviePlayer controller in an iPhone app...
Re: Audio Playback Misery
Hi MuzkGuy,
What Dixie says!
Best
Klaus
true, but you did not mention "mobile" in your intitial posting!MuzkGuy wrote:But I'm told that to develop for mobile devices, players can't be used.
What Dixie says!

Best
Klaus
Re: Audio Playback Misery
Well, I got everything working perfectly. But now, when I go to save as standalone, (OSX - have not even tested Windows yet) the audio is once again simply refusing to work. I made sure to structure the files and folders EXACTLY as the working pre-standalone version. So what's wrong?
The following code works in the pre-standalone, but doesn't in the standalone:
put "Audio/" into audioFolder
set the filename of player "Player" to audioFolder & "Tink.aiff"
start player "Player"
The folder structure in both standalone and pre-standalone is identical. I have searched high and low and can't find a solution as it seems from all instructions this should work.
The following code works in the pre-standalone, but doesn't in the standalone:
put "Audio/" into audioFolder
set the filename of player "Player" to audioFolder & "Tink.aiff"
start player "Player"
The folder structure in both standalone and pre-standalone is identical. I have searched high and low and can't find a solution as it seems from all instructions this should work.
Re: Audio Playback Misery
UPDATE:
I tested the Windows standalone (created at the same time as the OSX) and it works PERFECTLY. HUH??
I tested the Windows standalone (created at the same time as the OSX) and it works PERFECTLY. HUH??
Re: Audio Playback Misery
Hi MuzkGuy,
"the defaultfolder" is different on Mac and Win!
In a standalone on Windows that is the folder where the EXE resides.
On the Mac it is somewhere deep in the app package.
Are you using the standalone builder's "Copy files" card to add your files
and folders to the standalone?
In that case you should use
-> specialfolderpath("resources")
to have crossplatform comaptibilty.
Try this in that case:
...
put specialfolderpath("resources") & "/Audio/Tink.aiff" into audioFile
set the filename of player "Player" to audioFile
start player "Player"
...
Should work on Mac and Win if you use the standalone builder as described above.
Best
Klaus
"the defaultfolder" is different on Mac and Win!
In a standalone on Windows that is the folder where the EXE resides.
On the Mac it is somewhere deep in the app package.

Are you using the standalone builder's "Copy files" card to add your files
and folders to the standalone?
In that case you should use
-> specialfolderpath("resources")
to have crossplatform comaptibilty.
Try this in that case:
...
put specialfolderpath("resources") & "/Audio/Tink.aiff" into audioFile
set the filename of player "Player" to audioFile
start player "Player"
...
Should work on Mac and Win if you use the standalone builder as described above.
Best
Klaus
Re: Audio Playback Misery
Nope. No luck. I did exactly as you describe, but still nothing. Again, changing the code WORKS in the .livecode file, but NOT in the standalone. I notice that the files were copied into the Windows folder only, and not the Mac OS folder. I then tried it from where the .app was place. Nothing. Moved it all over the place, and no matter what, it still won't work.
Re: Audio Playback Misery
FYI, I develop on Mac, not Windows. So when I say it's working, I mean it's working on my Mac, but only in the .livecode environment. But as stated before, the standalone does NOT work on the mac, but DOES on Windows.
Re: Audio Playback Misery
And to add, (not a sound issue) the app icon for mac does not work, but the one for PC does. I'm using proper .icns files for the mac and .ico files for windows as instructed. Why is there such inconsistency?
Re: Audio Playback Misery
Please post your script(s) again!
And make sure to "construct" pathnames with parens () or you may encounter problems!
Not so good:
-> set the filename of player "Player" to audioFolder & "Tink.aiff"
Good:
-> set the filename of player "Player" to (audioFolder & "Tink.aiff")
And make sure to "construct" pathnames with parens () or you may encounter problems!
Not so good:
-> set the filename of player "Player" to audioFolder & "Tink.aiff"
Good:
-> set the filename of player "Player" to (audioFolder & "Tink.aiff")
Re: Audio Playback Misery
Setting the name using parentheses worked on all fronts. Thank you for that. I do appreciate it. However, I can't find this fact in the documentation or anywhere on the forums. Also, you didn't mention it in your first suggestion.
Here is the original code that did not work in the Mac standalone:
put specialfolderpath("resources") & "/Audio/Tink.aiff" into audioFile
set the filename of player "Player" to audioFolder
start player "Player"
Here is the revised code that worked on all fronts:
put specialfolderpath("resources") & "/Audio/Tink.aiff" into audioFile
set the filename of player "Player" to (audioFolder)
start player "Player"
I used the copy files pane as you suggested. However, the result is a bit puzzling. I see that after I created the standalone that the references audio files (.mp3) were all copied over into the new "Windows" folder, but not the Mac OS folder. Doing some experimenting, I tried removing that folder of audio files completely. The result was that BOTH standalones (Mac and Win) worked fine. Then, I renamed the original folder of audio files (the ones used by the pre-standalone during development) to prevent the standalones from "seeing" it. Again, the standalones worked fine. Do I NEED the folder of audio files? If so, where are the standalones looking for playback after I removed the new folder of audio files? Obviously, I can test this by trying on another machine, but I don't have any available immediately.
Here is the original code that did not work in the Mac standalone:
put specialfolderpath("resources") & "/Audio/Tink.aiff" into audioFile
set the filename of player "Player" to audioFolder
start player "Player"
Here is the revised code that worked on all fronts:
put specialfolderpath("resources") & "/Audio/Tink.aiff" into audioFile
set the filename of player "Player" to (audioFolder)
start player "Player"
I used the copy files pane as you suggested. However, the result is a bit puzzling. I see that after I created the standalone that the references audio files (.mp3) were all copied over into the new "Windows" folder, but not the Mac OS folder. Doing some experimenting, I tried removing that folder of audio files completely. The result was that BOTH standalones (Mac and Win) worked fine. Then, I renamed the original folder of audio files (the ones used by the pre-standalone during development) to prevent the standalones from "seeing" it. Again, the standalones worked fine. Do I NEED the folder of audio files? If so, where are the standalones looking for playback after I removed the new folder of audio files? Obviously, I can test this by trying on another machine, but I don't have any available immediately.
Re: Audio Playback Misery
Hi MuzkGuy,
In this example thery are mandatory:
...
set the filename of player "Player" to (specialfolderpath("resources") & "/Audio/Tink.aiff")
## See the difference?
...
If you use -> specialfolderpath("resources") everything should work fine, with or without subfolders!
But obviously the "anatomy" of an OS X application package is new to you?
Richt-Click your OS X standalone and select "Show contents" in the popup menu, then you will
see where all your files and folder have gone
And the standalones look for files of any kind where you point them to!
Best
Klaus
Here I create a complete pathname and supply a "ready made" variable to the filename, no parens neccessary!MuzkGuy wrote:Setting the name using parentheses worked on all fronts. Thank you for that. I do appreciate it. However, I can't find this fact in the documentation or anywhere on the forums. Also, you didn't mention it in your first suggestion.
Here is the original code that did not work in the Mac standalone:
put specialfolderpath("resources") & "/Audio/Tink.aiff" into audioFile
set the filename of player "Player" to audioFile
start player "Player"
In this example thery are mandatory:
...
set the filename of player "Player" to (specialfolderpath("resources") & "/Audio/Tink.aiff")
## See the difference?
...
The parens do not make any sense here and the script should really work without them!MuzkGuy wrote: Here is the revised code that worked on all fronts:
put specialfolderpath("resources") & "/Audio/Tink.aiff" into audioFile
set the filename of player "Player" to (audioFile)
start player "Player"
Yo do not need any subfolder for your media at all, but looks cleaner when you doMuzkGuy wrote:I used the copy files pane as you suggested. However, the result is a bit puzzling. I see that after I created the standalone that the references audio files (.mp3) were all copied over into the new "Windows" folder, but not the Mac OS folder. Doing some experimenting, I tried removing that folder of audio files completely. The result was that BOTH standalones (Mac and Win) worked fine. Then, I renamed the original folder of audio files (the ones used by the pre-standalone during development) to prevent the standalones from "seeing" it. Again, the standalones worked fine. Do I NEED the folder of audio files? If so, where are the standalones looking for playback after I removed the new folder of audio files? Obviously, I can test this by trying on another machine, but I don't have any available immediately.

If you use -> specialfolderpath("resources") everything should work fine, with or without subfolders!
But obviously the "anatomy" of an OS X application package is new to you?
Richt-Click your OS X standalone and select "Show contents" in the popup menu, then you will
see where all your files and folder have gone

And the standalones look for files of any kind where you point them to!

Best
Klaus