Page 1 of 1
Can't 'Beep' on iPhone (Solved)
Posted: Mon Oct 15, 2018 12:06 am
by simon.schvartzman
I'm sure this should be a basic error from my side but I can't find it.
The code below works fine on Mac OS but I can't hear anything when running on iPhone (which is not in silent mode, with max volume and good enough to listen anything on Spotify..)
Code: Select all
on mouseUp
set the beepSound to "internal"
wait 2 seconds
beep 5
end mouseUP
Please show me what am I doing wrong...thanks
Re: Can't 'Beep' on iPhone
Posted: Mon Oct 15, 2018 9:25 am
by LiveCode_Panos
Hi Simon,
On iOS, there is no default beep sound, so you have to set one. The sound file has to be included in the 'Copy Files' section of the standalone application settings. Also make sure that you use a valid path to the sound file. A working example would be:
1. Put your sound file (i.e. myBeepSound.m4a) file in the same folder with your main stack
2. Go to Standalone Application Settings --> Copy Files --> Add File and select myBeepSound.m4a
3. Add the following code in your card:
Code: Select all
on preopencard
set the beepsound to getBeepSound()
end preopencard
function getBeepSound
return specialFolderPath("resources") & slash & "myBeepSound.m4a"
end getBeepSound
Now, calling 'beep' on iPhone --> vibration + sound
iPad/iPod --> sound
Moreover, if you want to adjust the volume of the beep sound, go to:
Settings -> Sounds -> "Change with Buttons"
if enabled : The volume of the ringer and alerts (i.e the 'beep' sound) can be adjusted using the volume buttons
if disabled : The volume of the ringer and alerts will not be affected by the volume buttons
Hope this helps.
Best regards,
Panos
Re: Can't 'Beep' on iPhone
Posted: Mon Oct 15, 2018 2:27 pm
by simon.schvartzman
Hi Panos, many thanks for your customary prompt and helpful answer.
I followed your instructions but still no joy.
I downloaded a free beep file (0768.mp3 attached) but I'm only getting vibrations and no sounds in spite of the iPhone being on silent mode or not.
I did copy the file,
this is my code
Code: Select all
on preopencard
set the beepsound to getBeepSound()
end preopencard
function getBeepSound
return specialFolderPath("resources") & slash & "0758.mp3"
end getBeepSound
and this is how my directory looks like

- screen2.jpeg (17.98 KiB) Viewed 11547 times
What am I missing (part II) ? Thanks
Re: Can't 'Beep' on iPhone
Posted: Mon Oct 15, 2018 3:18 pm
by LiveCode_Panos
Hello Simon,
Does the mp3 file also exist in the standalone app bundle? (Right click on SafeDrive.app and choose "Show Package Contents).
In a first glance the code and the file structure looks correct to me. I will have access to an iPhone tomorrow so I will have a look. Do you hear anything if instead of "beep" you do:
Code: Select all
play specialFolderPath("resources") & slash & "0758.mp3"
?
Best,
Panos
--
Re: Can't 'Beep' on iPhone
Posted: Mon Oct 15, 2018 8:34 pm
by simon.schvartzman
Hi Panos, answers below:
Does the mp3 file also exist in the standalone app bundle? (Right click on SafeDrive.app and choose "Show Package Contents).
It seems it does not as can be seen in the following image:
Do you hear anything if instead of "beep" you do
I do not.
I guess my error is related with how to attach the mp3 file. Looking forward for your next hint.
Regards
Re: Can't 'Beep' on iPhone
Posted: Tue Oct 16, 2018 8:36 am
by LiveCode_Panos
Hello Simon,
Ok, the problem is that the .mp3 file is not included in the standalone. The question is why
Which version of LC did you use to build the standalone? I just tried with LC 9.0.1, added this file in the Copy Files and then built a standalone. The file does exist in the standalone app bundle for me.
Could you try again with LC 9.0.1?
Kind regards,
Panos
--
Re: Can't 'Beep' on iPhone
Posted: Tue Oct 16, 2018 10:14 am
by simon.schvartzman
Hi Panos, I was already using LC 9.0.1
I decided to close everything and start again and the good news is that now the .mp3 file is included in the standalone:
The bad news is the behaviour is not as I would expect (may be my expectations are wrong):
When I use:
Code: Select all
on mouseUp
play specialFolderPath("resources") & slash & "0758.mp3"
end mouseUp
I can hear the beeps OK when iPhone is in not silent mode
but when I use
it vibrates in spite of how the silent mode is set on there is not sound...
Sorry for bothering you with such a basic issue
Re: Can't 'Beep' on iPhone
Posted: Tue Oct 16, 2018 10:38 am
by LiveCode_Panos
Hello Simon,
Ok, good news that the inclusion of the sound file works fine now.
Regarding the "beep" command resulting in vibration only instead of vibration+sound, I am wondering if this is a bug in LC. I suggest you doublecheck that the volume is not too low (or muted), and if you still see the problem then file a bug report at quality.livecode.com so as we investigate further.
Note that if you want to adjust the volume of the beep sound, go to:
Settings -> Sounds -> "Change with Buttons"
if enabled : The volume of the ringer and alerts (i.e the 'beep' sound) can be adjusted using the volume buttons
if disabled : The volume of the ringer and alerts will not be affected by the volume buttons
Kind regards,
Panos
--
Re: Can't 'Beep' on iPhone
Posted: Tue Oct 16, 2018 11:18 am
by simon.schvartzman
OK Panos, I did as instructed.
Bug report can be found
https://quality.livecode.com/show_bug.cgi?id=21644
Many thanks for your support.
Re: Can't 'Beep' on iPhone
Posted: Tue Oct 16, 2018 3:42 pm
by LiveCode_Panos
You're welcome
Best,
Panos
--
Re: Can't 'Beep' on iPhone (Solved)
Posted: Wed Oct 17, 2018 4:27 pm
by simon.schvartzman
Just to close the subject.
Panos found the problem and the solution: the file can't be "mp3" it has to be in the "m4a" format. Once this is done it works as expected.
There are some free conversion tools that do the trick I used this one
https://www.apowersoft.com/free-online-video-converter
that worked fine.
Cheers!
Re: Can't 'Beep' on iPhone (Solved)
Posted: Wed Oct 17, 2018 4:31 pm
by Klaus
Just to be sure:
We can play MP3 files on iOS, but the BEEPSOUND has to be m4a, is that correct?
Re: Can't 'Beep' on iPhone (Solved)
Posted: Wed Oct 17, 2018 4:36 pm
by simon.schvartzman
@klaus to me you are 100% correct (unless @Panos has a different opinion)
Best.
Re: Can't 'Beep' on iPhone (Solved)
Posted: Wed Oct 17, 2018 5:58 pm
by ClipArtGuy
If anyone is looking for an open source option for converting media files, I would recommend 'Audacity' and 'VLC media player'. Both are free, open source, and can convert most media files easily.
Re: Can't 'Beep' on iPhone (Solved)
Posted: Wed Oct 17, 2018 10:39 pm
by bogs
ClipArtGuy wrote: ↑Wed Oct 17, 2018 5:58 pm
Both are free, open source, and can convert most media files easily.
And don't forget to add that both are cross platform (but I guess you don't have to add it now)
