Can't 'Beep' on iPhone (Solved)

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
simon.schvartzman
Posts: 638
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Can't 'Beep' on iPhone (Solved)

Post by simon.schvartzman » Mon Oct 15, 2018 12:06 am

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
Last edited by simon.schvartzman on Wed Oct 17, 2018 4:24 pm, edited 1 time in total.
Simon
________________________________________
To ";" or not to ";" that is the question

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: Can't 'Beep' on iPhone

Post by LiveCode_Panos » Mon Oct 15, 2018 9:25 am

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

simon.schvartzman
Posts: 638
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: Can't 'Beep' on iPhone

Post by simon.schvartzman » Mon Oct 15, 2018 2:27 pm

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,
screen1.jpeg
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
screen2.jpeg (17.98 KiB) Viewed 8556 times
What am I missing (part II) ? Thanks
Attachments
0758.mp3.zip
(52.55 KiB) Downloaded 224 times
Simon
________________________________________
To ";" or not to ";" that is the question

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: Can't 'Beep' on iPhone

Post by LiveCode_Panos » Mon Oct 15, 2018 3:18 pm

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
--

simon.schvartzman
Posts: 638
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: Can't 'Beep' on iPhone

Post by simon.schvartzman » Mon Oct 15, 2018 8:34 pm

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:
screen3.jpeg
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
Simon
________________________________________
To ";" or not to ";" that is the question

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: Can't 'Beep' on iPhone

Post by LiveCode_Panos » Tue Oct 16, 2018 8:36 am

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
--

simon.schvartzman
Posts: 638
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: Can't 'Beep' on iPhone

Post by simon.schvartzman » Tue Oct 16, 2018 10:14 am

Hi Panos, I was already using LC 9.0.1
screen4.jpeg
I decided to close everything and start again and the good news is that now the .mp3 file is included in the standalone:
screen5.jpeg
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

Code: Select all

on mouseUp
    beep 5
end mouseUp
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
Simon
________________________________________
To ";" or not to ";" that is the question

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: Can't 'Beep' on iPhone

Post by LiveCode_Panos » Tue Oct 16, 2018 10:38 am

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
--

simon.schvartzman
Posts: 638
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: Can't 'Beep' on iPhone

Post by simon.schvartzman » Tue Oct 16, 2018 11:18 am

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.
Simon
________________________________________
To ";" or not to ";" that is the question

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: Can't 'Beep' on iPhone

Post by LiveCode_Panos » Tue Oct 16, 2018 3:42 pm

You're welcome :)

Best,
Panos
--

simon.schvartzman
Posts: 638
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: Can't 'Beep' on iPhone (Solved)

Post by simon.schvartzman » Wed Oct 17, 2018 4:27 pm

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!
Simon
________________________________________
To ";" or not to ";" that is the question

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Can't 'Beep' on iPhone (Solved)

Post by Klaus » Wed Oct 17, 2018 4:31 pm

Just to be sure:
We can play MP3 files on iOS, but the BEEPSOUND has to be m4a, is that correct?

simon.schvartzman
Posts: 638
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: Can't 'Beep' on iPhone (Solved)

Post by simon.schvartzman » Wed Oct 17, 2018 4:36 pm

@klaus to me you are 100% correct (unless @Panos has a different opinion)

Best.
Simon
________________________________________
To ";" or not to ";" that is the question

ClipArtGuy
Posts: 253
Joined: Wed Aug 19, 2015 4:29 pm

Re: Can't 'Beep' on iPhone (Solved)

Post by ClipArtGuy » Wed Oct 17, 2018 5:58 pm

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.

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Can't 'Beep' on iPhone (Solved)

Post by bogs » Wed Oct 17, 2018 10:39 pm

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) :mrgreen:
Image

Post Reply

Return to “Talking LiveCode”