Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Audio works perfect on the simulator, but not with the device APK.
Started by endorphinum Mar 07 2018 07:10 AM

10 replies to this topic

Best Answer endorphinum , 07 March 2018 - 03:17 PM

My friends, i found the problem and i am absolutely sorry that i wasted your time!

What i had in a part of my code is a Accelerometer checking if an audio was played as soon as it changes its values,

otherwise: audio.stop();

 

That's why my sound was not playing, as i was ignoring that part of my code. I am absolutely sorry.

Thanks again for your time and support everyone!

 

Greetings and have a great night or start into the day!

[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

endorphinum

[GLOBAL: userInfoPane.html]
endorphinum
  • Observer

  • 10 posts
  • Corona SDK

Hi everyone,

i think that i have read approx. 20 stackoverflow and more than 30 webpages concerning the problem

that audio plays well on the Corona SDK but not once that it is deployed on the device.

 

My situation

i have a timer that after 10 seconds plays an alarm in a loop.

 

Testing this on the simulator, everything works fine. I hit a button and after 10 seconds

the alarm sounds in a loop

 

Testing this on the device, i hit a button and after 10 seconds i hear like a tenth of a second of that audio file.

 

Steps i have tried so far:

- check that case-sensitive file name is not the case.

- exchanged the WAV with a MP3 file.

- exchanged the WAV with a OGG file.

- checked that the WAV file is 16bit

- tried to call that file from the root, the assets and a new sub-folder.

 

Nothing worked out.

 

My setup:

wind10 and building via the Corona Simulator build function

 

Can anyone offer a hint on how to log what happens with the file on the phone

to the Corona Simulator Console ?

 

Thanks in advance and greetings from this corner of the planet!

Carlos

 

 



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 24,308 posts
  • Corona Staff

What version of Corona are you using?

 

Can you post the code where you are loading the audio track and where you are playing it?

 

What Android device are you testing on and what version of Android is it running?

 

Thanks

Rob


  • endorphinum likes this

[TOPIC: post.html]
#3

endorphinum

[GLOBAL: userInfoPane.html]
endorphinum
  • Observer

  • 10 posts
  • Corona SDK

What version of Corona are you using?

 

Can you post the code where you are loading the audio track and where you are playing it?

 

What Android device are you testing on and what version of Android is it running?

 

Thanks

Rob

 

Thanks for your time and support Rob!

My Corona Simulator version is: 2017.3184

 

Inside the function scene:create (event) i have defined an object with two audio files:

    local soundTable = {
        soundAlarmBPM = audio.loadSound("assets/sounds/dashboard-alarm-bpm.wav"),
        soundAlarmPipiKaka = audio.loadSound("assets/sounds/dashboard-alarm-pipikaka.wav")
    }

 

and inside the same scene:create i have a function with this part:

            playAlarmSound = audio.play( soundTable['soundAlarmBPM'],{
                channel = 1,
                loops = -1,
                fadein = 100
            } )

I am very new to Corona and LUA but for me this looks like more a "deploy" or building error.

Some people mentioned on pages that they had to put the sound file in the root, but i do not know

if the root is the apps root or the root of the device.

 

I was hoping that with some kind of phone-log results i would get an error but i do not know

how to show my USB-connected phone actions inside the Corona Simulator Log.

 

Greetings and thanks again!

Carlos



[TOPIC: post.html]
#4

agramonte

[GLOBAL: userInfoPane.html]
agramonte
  • Contributor

  • 681 posts
  • Corona SDK

Are you sure that the file name and path is correct for the audio files?

 

 

To see the logs of an Android device that is attached

1. Before you start the build open up the console. Window -> Console.

2. After the build and push to device do not click on the done button. The console should have the device log running.


  • endorphinum likes this

[TOPIC: post.html]
#5

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 6,917 posts
  • Corona SDK

Share one of the problem sound files here in a zip file.

 

click 'more reply options below' to attach the zip file.



[TOPIC: post.html]
#6

endorphinum

[GLOBAL: userInfoPane.html]
endorphinum
  • Observer

  • 10 posts
  • Corona SDK

Attached to this entry are the two sound files inside a ZIP.

What i did with those before was that apart of converting them to 16bit via Audacity,

 

i also used one online audio converter webpage to convert the file to the proper 16bit that i read

on several pages with a similiar problem like mine.

 

Thanks again for your support!

Attached Files



[TOPIC: post.html]
#7

endorphinum

[GLOBAL: userInfoPane.html]
endorphinum
  • Observer

  • 10 posts
  • Corona SDK

Are you sure that the file name and path is correct for the audio files?

 

 

To see the logs of an Android device that is attached

1. Before you start the build open up the console. Window -> Console.

2. After the build and push to device do not click on the done button. The console should have the device log running.

 

Yes i am absolutely sure that the path is correct as within the simulator everything works fine.

I changed the path to a wrong path and after the update on my phone pops up an alert saying that a file does not exist.

So i am sure that the path is correct.

 

The only error i am getting is:

The signer's certificate is self-signed.
And that three icon files are being ignored.


[TOPIC: post.html]
#8

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 6,917 posts
  • Corona SDK

Hi.  I converted your sounds directly to MP3s using Audacity, then tested them on my old Tab 4 Android device. 

 

They are working fine.  

 

Here is my project, w/ your sounds: https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2018/03/sounds.zip

 

Here is the APK: https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2018/03/sounds_apk.zip

(built with 2018.3226)

 

Note: You keep mentioning 16-bit.  I left them at 32-bit.  In fact I never convert to 16-bit.  Not sure if that is the issue/solution.  Anyways, you now have more data points.  Hope you get this resolved soon.

 

PS - I see the docs say WAV files should be 16-bit, but I always ignore this.  :wacko:


Edited by roaminggamer, 07 March 2018 - 01:52 PM.

  • endorphinum likes this

[TOPIC: post.html]
#9

endorphinum

[GLOBAL: userInfoPane.html]
endorphinum
  • Observer

  • 10 posts
  • Corona SDK

Hi.  I converted your sounds directly to MP3s using Audacity, then tested them on my old Tab 4 Android device. 

 

They are working fine.  

 

Here is my project, w/ your sounds: https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2018/03/sounds.zip

 

Here is the APK: https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2018/03/sounds_apk.zip

(built with 2018.3226)

 

Note: You keep mentioning 16-bit.  I left them at 32-bit.  In fact I never convert to 16-bit.  Not sure if that is the issue/solution.  Anyways, you now have more data points.  Hope you get this resolved soon.

 

PS - I see the docs say WAV files should be 16-bit, but I always ignore this.  :wacko:

 

I added your mp3 to my asset but the problem stays the same - they are not played.

Then i tried your apk and within your apk, both buttons work perfectly. Thanks for your work creating this small demo.

 

So, still no success. :(

I will now try out the nightly build of Corona that you mention (2018.3226)



[TOPIC: post.html]
#10

endorphinum

[GLOBAL: userInfoPane.html]
endorphinum
  • Observer

  • 10 posts
  • Corona SDK

  Best Answer

My friends, i found the problem and i am absolutely sorry that i wasted your time!

What i had in a part of my code is a Accelerometer checking if an audio was played as soon as it changes its values,

otherwise: audio.stop();

 

That's why my sound was not playing, as i was ignoring that part of my code. I am absolutely sorry.

Thanks again for your time and support everyone!

 

Greetings and have a great night or start into the day!


  • sieler2 likes this

[TOPIC: post.html]
#11

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 6,917 posts
  • Corona SDK

Tip:  This is why I always suggest making a test bench to examine the problem you are debugging.  Often you'll find something like what you did today. i.e. You thought you had a sound problem, but the problem was something else entirely.




[topic_controls]
[/topic_controls]