GLBasic forum

Main forum => GLBasic - en => Topic started by: Kyo on 2013-Oct-05

Title: Version 11.414 the the audio is not played
Post by: Kyo on 2013-Oct-05
I have compiled the apk with all the internal Media, and the sound does not play.

With the Media external at APK, audio sounds!

I use for Music, file OGG ( but i Tested the MP3)
and for SFX files WAV at 8 Bit (22050 HZ).

But don't work .....

Why?  :rant:

Thanks for reply  :good:
Title: Re: Version 11.414 the the audio is not played
Post by: Kyo on 2013-Oct-05
I looked in the file: _logview.bat  in folder (GLBasic_v11\Compiler\platform\android\bin)

Code (glbasic) Select

@ECHO OFF

:: install Android SDK, Android NDK
:: install JDK


set HERE=%~dp0

set ANDROIDSDK=%HERE%..\android-sdk-windows
set JAVA_HOME=C:\Program Files (x86)\Java\jdk1.6.0_24


set PATH=%JAVA_HOME%\bin;%PATH%

"%ANDROIDSDK%\platform-tools\adb.exe" shell logcat glbasic:I SDL:I DEBUG:I AndroidRuntime:E *:S
::

IF "%NOPAUSE%"=="" PAUSE


But my version of jdk is: jdk1.7.0_05 (folders: C:\Program Files (x86)\Java\jdk1.7.0_05)

is it important?
Title: Re: Version 11.414 the the audio is not played
Post by: Kyo on 2013-Oct-05
No help?  :whistle:
Title: Re: Version 11.414 the the audio is not played
Post by: erico on 2013-Oct-05
Haven´t got the chance to try the newer beta yet.
I will be more useful when I have it running, it was just released. :-[
Title: Re: Version 11.414 the the audio is not played
Post by: kanonet on 2013-Oct-05
Did you try to use full path for audio files? Use GETCURRENTDIR$ to create full paths. There maybe still the bug that you need full paths.
Title: Re: Version 11.414 the the audio is not played
Post by: MrTAToad on 2013-Oct-05
Music in 11.556 does work fine!
Title: Re: Version 11.414 the the audio is not played
Post by: spicypixel on 2013-Oct-06
Quote from: kanonet on 2013-Oct-05
Did you try to use full path for audio files? Use GETCURRENTDIR$ to create full paths. There maybe still the bug that you need full paths.

If this bug is still present, I can't imagine it difficult to fix but it certainly is a priority one if it's still there.
Title: Re: Version 11.414 the the audio is not played
Post by: Kyo on 2013-Oct-06
I installed the 11.556 but it not work!

I have ANdroid 4.0.4 (and I can not update it)...

On win the music and sfx work fine, and on android with external media work fine, but if i compile the sound on APK it don't work .....

I checked the path (the same system that I use to load the sprite) and everything is ok!

I do not know how to do ....  :(
Title: Re: Version 11.414 the the audio is not played
Post by: kanonet on 2013-Oct-06
Could you create a simple 5 lines project that only loads and plays a sound? So we can test this and if we get it working, you can fix your project.
Title: Re: Version 11.414 the the audio is not played
Post by: Kyo on 2013-Oct-06
Ok it's great idea ....  :good:
Title: Re: Version 11.414 the the audio is not played
Post by: spacefractal on 2013-Oct-06
you still need doing full path to the sound, then its should work. using a relative might not work. Its a well known issue. But giving the code example could also help..
Title: Re: Version 11.414 the the audio is not played
Post by: Kyo on 2013-Oct-07
This is Sample code ....

if I put the audio on the MicroSD and use the code:
ext_sd$ = PLATFORMINFO $ ("DOCUMENTS")
new_path  = ext_sd $ + "/ Audio /"

it works fine...


Title: Re: Version 11.414 the the audio is not played
Post by: Kyo on 2013-Oct-07
help ....   :nw:
Title: Re: Version 11.414 the the audio is not played
Post by: erico on 2013-Oct-07
It could be the format of your sound files.

Music on my android only works in OGG, sfx goes fine in WAV.

My working OGG file is stereo, 44100hz, 499kb/s, 16bit. VORB.
Working WAV files are mono, 44100hz, 705kb/s, 16bit. PCM S16 (araw).

You may also want to be aware of case sensitive naming of files and extensions.

That is all I can thing at the moment.
Title: Re: Version 11.414 the the audio is not played
Post by: Kyo on 2013-Oct-07
If you download the Audio.rar you will see that the music is in ogg and sfx are wav mono, 44100hz, 705kb/s, 16bit.

And then, because if I read them from the micro SD (media external APK) works. and inside the APK not??

It's my smartphone?????  :S
Title: Re: Version 11.414 the the audio is not played
Post by: erico on 2013-Oct-07
Quote from: diego on 2013-Oct-07
...
It's my smartphone?????  :S

hmmm, could it be?

You are running the glbasic-debug.apk file right?
Is your phone set to usb-debug and developer mode?
Title: Re: Version 11.414 the the audio is not played
Post by: Kyo on 2013-Oct-07
Yes and yes ... the game run fine ... without bug ... but the audio not work ...
With external media it work fine!

at this point I just have to use the media folder as external.
Can anyone tell me if there is an example in GLBasic, Download (a large file) from web site with a progress bar???

:giveup:
Title: Re: Version 11.414 the the audio is not played
Post by: erico on 2013-Oct-08
Not bug. I mean did you copy that apk file from bin and installed that one? It is the one i use here and it works.
Also what about the phone settings? No dev mode usb debugg might block an unsigned file to access internal files?
Title: Re: Version 11.414 the the audio is not played
Post by: Kyo on 2013-Oct-08
But the game run fine ....
Only the music and the sound don't work ....

Please download my attachment file on page 1 and test it on your smartphone and tell me if it works!  :good:
Title: Re: Version 11.414 the the audio is not played
Post by: erico on 2013-Oct-08
Oh i see what you mean. Sorry.
Im off home now but will be back soon and i give it a go. :good:
Title: Re: Version 11.414 the the audio is not played
Post by: MrTAToad on 2013-Oct-08
Instead of using SetCurrentDir, use LOADMUSIC "Music/Music_0.0.ogg"
Title: Re: Version 11.414 the the audio is not played
Post by: spacefractal on 2013-Oct-08
LOADMUSIC GETCURRENTDIR$()+"Music/Music_0.0.ogg" is t he correct way. There is a bug, which mean you need send the full path to it.
Title: Re: Version 11.414 the the audio is not played
Post by: Kyo on 2013-Oct-08
LOADMUSIC Command does not exist or PlayMusic or LoadSound ....  =D

I've tried so:
Code (glbasic) Select

LOADSOUND GETCURRENTDIR$() + "Sound/Hit_0.wav", 1, 4
PLAYMUSIC GETCURRENTDIR$() + "Music/Music_0_0.ogg", TRUE //mp3 for win // ogg for Android
MUSICVOLUME 1


and now the sfx works but not the music!

Can anyone post a file download function from php website, maybe with progress bar?

I prefer to use an external file and I have less problems!  :booze:
Title: Re: Version 11.414 the the audio is not played
Post by: erico on 2013-Oct-08
Tested your program.

The ogg file you have there does not play on my android.
I converted the mp3 to wav  and that wav to ogg just to test formats and my ogg file now works fine on android.

Here is the music file, can you substitute that and test on your device?
Title: Re: Version 11.414 the the audio is not played
Post by: erico on 2013-Oct-08
Quote from: erico on 2013-Oct-07
...
My working OGG file is stereo, 44100hz, 499kb/s, 16bit. VORB.
...

Now just checked the OGG you have there and it seems incorrect.
It uses ogg as encapsulator but the codec going is FLAC, not VORB and GLB does not work with FLAC.

Make sure your OGG files are using the vorbis audio(vorb) codec and you should be fine.
Using sound editors like AUDACITY should be a simple matter of exporting to ogg vorbis file.

edit: I ran your code with bits of modification on GLB10.283, should be fine on newer versions too.
edit2: your ability to run that file from external sd might be related to having FLAC codec installed on your android device, maybe the system bridges things outside GLB apk when dealing music playing stuff. I heard before that GLB will play any codec as long as it is installed on the system. For android, you might want to stick to vorb as you can be sure all android systems carries that one.
Title: Re: Version 11.414 the the audio is not played
Post by: Kyo on 2013-Oct-08
oooh thanks erico, I use Audiacity and now the music works fine!

Thank you to all comunity for help!  :booze:  :booze:
Title: Re: Version 11.414 the the audio is not played
Post by: erico on 2013-Oct-08
gotta read the fine prints  :nana: :D  :good:


edit: let us know if you need full path or not for android on the new GLB.
Title: Re: Version 11.414 the the audio is not played
Post by: Kyo on 2013-Oct-08
oh Yes I use fullpath ..... 

Now I am interested to understand how the command NETWEBGET, to make downloading a large file from a website.
should read my file size and have a progress bar, you think I can do?

Hopefully I open another topic :D
Title: Re: Version 11.414 the the audio is not played
Post by: erico on 2013-Oct-08
Quote from: diego on 2013-Oct-08
oh Yes I use fullpath ..... 
...

Does it work without fullpath? Just so that we know the newer GLB needs it or not. By the discussion here, it seems it still needs it, but I don´t have the latest beta installed to check it myself.

Yep, the netwebget will get better visibility on a new thread. I have no idea how to use it though.
I also suspect that was asked before, specially about the progress bar.
Title: Re: Version 11.414 the the audio is not played
Post by: Kyo on 2013-Oct-08
I noticed that the sound on android have a small delay in the start...  :S
this happens to you?
Title: Re: Version 11.414 the the audio is not played
Post by: erico on 2013-Oct-08
Calling repeated sounds on android, like your code do, and I get an uneven result. I have that situation in my game and it seems to be an android ´feature´.
There are code and techniks to help solve that and ´android extras´ is a fine one.

In my case, I minimized the need to repeat a sound and that fitted my game.
Title: Re: Version 11.414 the the audio is not played
Post by: Kyo on 2013-Oct-08
you write me the link of "code and techniks to help solve that and ´android extras´"
Title: Re: Version 11.414 the the audio is not played
Post by: erico on 2013-Oct-08
Here the android extras:
http://www.glbasic.com/forum/index.php?topic=9166.0

You may want to search the forum for keywords like ANDROID SOUND REPEATING it can lead you to a few discussions about that subject. It is a bit scattered and I don´t recall of mind where were the last ones I read about.

Did the latest GLB version work without the need of full path?
Title: Re: Version 11.414 the the audio is not played
Post by: Kyo on 2013-Oct-09
Thanks for the help Erico.  :booze:

To me it only works with the full path...
Title: Re: Version 11.414 the the audio is not played
Post by: Kyo on 2013-Oct-09
For remove sound and music from memory I have to use the same system that is used for sprites?

LOADSOUND  "noname",1, 4
Title: Re: Version 11.414 the the audio is not played
Post by: kanonet on 2013-Oct-10
Yes.
BTW I recommend to just call 'LOADSOUND "", 1, 4' cuz if you input something that does not exist, it might 1st check if it exist - you get it unloaded this way too, but its slower then just inputting an empty string.