Help with simple sound button
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Help with simple sound button
Dear Team,
You always manage to sort me out!!
I am at a complete loss!!
And I am sure I am doing something really silly here!!
I have read the forum and the dictionary and am still not succeeding!!
I just want a sound file to play when a button is pressed.
In the card I have this...
put getLoc("11sounds") & item 11 of tData into tAudioPath
put item 11 of tData into tSound
put tSound into tAudio
and in the button I have this...
on mouseUp
if the environment is mobile then
play audioClip (specialFolderPath ("cache") & "/theContent/11sounds/" & tAudio)
else
play audioClip "/Users/jessamy99/Desktop/soundApp/theContent/11sounds/" & tAudio
end if
end mouseUp
The correct audio clip plays on the mac, and in the simulator.
But it will not play on my iPhone 5 at all.
What am I doing wrong?
Thanking you all in advance for your hard work and help!
With best wishes,
Jessamy
PS Using Mac 10.9 Mountain Lion
LiveCode 6.1.2
iPhone 5 version 6.1.3
You always manage to sort me out!!
I am at a complete loss!!
And I am sure I am doing something really silly here!!
I have read the forum and the dictionary and am still not succeeding!!
I just want a sound file to play when a button is pressed.
In the card I have this...
put getLoc("11sounds") & item 11 of tData into tAudioPath
put item 11 of tData into tSound
put tSound into tAudio
and in the button I have this...
on mouseUp
if the environment is mobile then
play audioClip (specialFolderPath ("cache") & "/theContent/11sounds/" & tAudio)
else
play audioClip "/Users/jessamy99/Desktop/soundApp/theContent/11sounds/" & tAudio
end if
end mouseUp
The correct audio clip plays on the mac, and in the simulator.
But it will not play on my iPhone 5 at all.
What am I doing wrong?
Thanking you all in advance for your hard work and help!
With best wishes,
Jessamy
PS Using Mac 10.9 Mountain Lion
LiveCode 6.1.2
iPhone 5 version 6.1.3
Re: Help with simple sound button
Hi jessamy99,
AudioClip is not supported in mobile.
Just use "play".
Simon
AudioClip is not supported in mobile.
Just use "play".
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Help with simple sound button
Dear Simon,
Thankyou so much! That was a really quick reply!!
And so simple!!
Now I have sound!
But only through the headphones!
Is there a way to make it come out of the speakers except when the headphones are plugged in?
The dictionary says to set it as external, but not on ios!!
This is the first time I have attempted to insert sound, so please bear with me if I am being daft!!
Many thanks for the help in advance and for the above!
It is much appreciated,
Best wishes,
Jessamy
Thankyou so much! That was a really quick reply!!
And so simple!!
Now I have sound!
But only through the headphones!
Is there a way to make it come out of the speakers except when the headphones are plugged in?
The dictionary says to set it as external, but not on ios!!
This is the first time I have attempted to insert sound, so please bear with me if I am being daft!!
Many thanks for the help in advance and for the above!
It is much appreciated,
Best wishes,
Jessamy
Re: Help with simple sound button
Sorry Jessamy,
The command is "play file" not just "play", look that up in the dictionary.
But in saying that it looks like your code should work with just play. Maybe you should try it the dictionary way and load the path into a variable and play that.
Now why it's headphones only is another matter entirely.
The hip way these days is to use "mobilePlaySoundOnChannel" pretty much the same as you are doing not much to learn but it may work better for you.
Simon
The command is "play file" not just "play", look that up in the dictionary.
But in saying that it looks like your code should work with just play. Maybe you should try it the dictionary way and load the path into a variable and play that.
Now why it's headphones only is another matter entirely.
The hip way these days is to use "mobilePlaySoundOnChannel" pretty much the same as you are doing not much to learn but it may work better for you.
Don't worry about that "current" it can be any name you like.put specialFolderPath("engine") & "/sounds/applause.mp4" into tSoundFile
mobilePlaySoundOnChannel tSoundFile, "current", "now"
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Help with simple sound button
Dear Simon,
Thankyou so much for all your help!
Actually the sound files are working perfectly and stoppng with a stop button.
However, while I have sound externally and internally on the old ipad, running 5.1.1,
on my iPhone 5 I only have intrnal sound.
That is fine as I shall put in the instructions that one needs headphones!!
I would like to know how to turn on the external sound for the future though!
Once again, your help is much appreciated!!
Best wishes,
Jessamy.
Thankyou so much for all your help!
Actually the sound files are working perfectly and stoppng with a stop button.
However, while I have sound externally and internally on the old ipad, running 5.1.1,
on my iPhone 5 I only have intrnal sound.
That is fine as I shall put in the instructions that one needs headphones!!

I would like to know how to turn on the external sound for the future though!
Once again, your help is much appreciated!!
Best wishes,
Jessamy.
Re: Help with simple sound button
Hi Jessamy,
I do not think that Livecode can control the internal/external output of an iPhone,
so I am sure the problem lies somewhere in your iPhone settings!
Best
Klaus
I do not think that Livecode can control the internal/external output of an iPhone,
so I am sure the problem lies somewhere in your iPhone settings!

Best
Klaus
Re: Help with simple sound button
Dear Simon and Klaus,
It was me being totally daft!!
It was my settings!!
Thankyou for your patience and help!
It works now!! Very pleased!!
Best wishes,
Jessamy.
UPDATE
For anyone who is trying to get sounds, the script above worked perfectly on my iPhone and iPad, and on the Mac using aiff files.
But, for Android, I just needed to change the sound files to mp3 files at 128 bit rate.
I used audacity for both.
Hope it helps others!!
Best wishes,
jessamy.
It was me being totally daft!!
It was my settings!!
Thankyou for your patience and help!
It works now!! Very pleased!!
Best wishes,
Jessamy.
UPDATE
For anyone who is trying to get sounds, the script above worked perfectly on my iPhone and iPad, and on the Mac using aiff files.
But, for Android, I just needed to change the sound files to mp3 files at 128 bit rate.
I used audacity for both.
Hope it helps others!!
Best wishes,
jessamy.
Re: Help with simple sound button
Jessamyjessamy99 wrote:Dear Team,
You always manage to sort me out!!
I am at a complete loss!!
And I am sure I am doing something really silly here!!
I have read the forum and the dictionary and am still not succeeding!!
I just want a sound file to play when a button is pressed.
In the card I have this...
put getLoc("11sounds") & item 11 of tData into tAudioPath
put item 11 of tData into tSound
put tSound into tAudio
and in the button I have this...
on mouseUp
if the environment is mobile then
play audioClip (specialFolderPath ("cache") & "/theContent/11sounds/" & tAudio)
else
play audioClip "/Users/jessamy99/Desktop/soundApp/theContent/11sounds/" & tAudio
end if
end mouseUp
The correct audio clip plays on the mac, and in the simulator.
But it will not play on my iPhone 5 at all.
What am I doing wrong?
Thanking you all in advance for your hard work and help!
With best wishes,
Jessamy
PS Using Mac 10.9 Mountain Lion
LiveCode 6.1.2
iPhone 5 version 6.1.3
I am starting an app that requires the same kind of sound playing that you did last year.
I just have a couple of questions.
what kind of storage are your audio files in?
are they separate files in a folder named "11sounds" ? If so are there 11 separate files?
Thanks for your help.
Tom
Re: Help with simple sound button
Dear Tom,
I have attached a zip file with a simple program that uses sound files for you.
You must copy the folder "sounds" to desktop.
Then, the program should run on a mac.
In the content folder are the sounds to run on an iPhone or iPad.
You will need to change the setting in application settings to your own profile first.
To run it on android you need to change the aiff files to mp3 files in both sound folders.
I hope this help.
Let me know.
All the best,
Jessamy
I have attached a zip file with a simple program that uses sound files for you.
You must copy the folder "sounds" to desktop.
Then, the program should run on a mac.
In the content folder are the sounds to run on an iPhone or iPad.
You will need to change the setting in application settings to your own profile first.
To run it on android you need to change the aiff files to mp3 files in both sound folders.
I hope this help.
Let me know.
All the best,
Jessamy
- Attachments
-
- music test 1.zip
- (68.79 KiB) Downloaded 259 times
Re: Help with simple sound button
Jessamy,
Thank You so much for the quick response. I will check this out. I'm sure it will help me understand what I am not doing correctly.
Tom
Thank You so much for the quick response. I will check this out. I'm sure it will help me understand what I am not doing correctly.
Tom
Re: Help with simple sound button
Dear Tom,
You are welcome!
This is a half built one!
But I hope you will follow it.
If not, get back to me and I will simplify it.
Bear in mind that I am a beginner!
All the best,
Jessamy
You are welcome!
This is a half built one!
But I hope you will follow it.
If not, get back to me and I will simplify it.
Bear in mind that I am a beginner!
All the best,
Jessamy