Author Topic: PLAYMUSIC behaviour I can't understand  (Read 2953 times)

Offline dbots

  • Mc. Print
  • *
  • Posts: 16
    • View Profile
Hi all,

I 've written a small sample game and use some mp3 sounds (with playsound) and all is fine.
My problem starts when I use playmusic, in order to add a continuous background music in the game.

What I do in code, is to call :
PLAYMUSIC "bgmusic.wav", TRUE
MUSICVOLUME 1
at the beginning of the project, having enabled :
SETCURRENTDIR("Media")
also at first line just before everything

The strange thing is that when I test the project on windows background music plays just fine but when I transfer the game on my Android device then I don't background music. My Android's version is 2.3.
I have tried both with mp3 and wav sound for background, the result is always negative.
Also, I have all graphics and sounds in the Media folder under the .app folder generated for the project and when I build the apk I see that all multimedia files are placed correctly under assets/Media, so it's not that files are missing.
Thank you in advance

Offline Marmor

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 936
  • 96A285CC
    • View Profile
    • my youtube channel
Re: PLAYMUSIC behaviour I can't understand
« Reply #1 on: 2013-Jan-14 »
u need the right samplerate !  44100 /stereo

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3375
  • Integrated Brain
    • View Profile
Re: PLAYMUSIC behaviour I can't understand
« Reply #2 on: 2013-Jan-14 »
Hi dbtos Welcome to the Community, try to change the format to .ogg, In android the extensions of audio changes , I think not it's equal in all Android Versions...

This info I think you can find in Internals of the Help, or in the Book of Mrtatoad, on you will learn all about Glbasic, tricks and tips...  It's in Lulu books, but in UK Market (Find something GLbasic, you can find some books, but it's programmig guide or something like this). * Very cheaper

Offline dbots

  • Mc. Print
  • *
  • Posts: 16
    • View Profile
Re: PLAYMUSIC behaviour I can't understand
« Reply #3 on: 2013-Jan-14 »
Thank you mentalthink, I will try that and post the results.

Offline dbots

  • Mc. Print
  • *
  • Posts: 16
    • View Profile
Re: PLAYMUSIC behaviour I can't understand
« Reply #4 on: 2013-Jan-14 »
Well, I replaced the music file with an OGG type format, now I hear something but it's not the music, it has too much noise.
Probably I must change the sampling rate or something else or maybe the Android version is old ?
Where can I find detailed information about all these ?
Thank you

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4450
    • View Profile
    • FUED
Re: PLAYMUSIC behaviour I can't understand
« Reply #5 on: 2013-Jan-14 »
You could use audacity to change format on your music.
http://audacity.sourceforge.net/

16bit 44100 stereo OGG, is what I think is needed.


Offline dbots

  • Mc. Print
  • *
  • Posts: 16
    • View Profile
Re: PLAYMUSIC behaviour I can't understand
« Reply #6 on: 2013-Jan-14 »
Yes my friend, that's what was needed. I setup OGG to 44100 and background music is crystal quality without noise.
Thank you all for your help.

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3375
  • Integrated Brain
    • View Profile
Re: PLAYMUSIC behaviour I can't understand
« Reply #7 on: 2013-Jan-14 »
Hi dbots, if need a very usefull and free tool, and batch converter for change the files of audio, try this...

http://www.freemake.com/es/free_audio_converter/

This program works very fine, I change about 1500 audio files in only one click for my projects... Only you have take in mind the Sample Rate, I always forget wich it's...  :S

For image you have similar tools... I think in the Spaninsh forum you can find some post i put sometime ago, whit some usefull and free converters and another simple tools...

Regards, and happy for you can hear you android  :good:

Offline dbots

  • Mc. Print
  • *
  • Posts: 16
    • View Profile
Re: PLAYMUSIC behaviour I can't understand
« Reply #8 on: 2013-Jan-14 »
Thank you mentalthink, I have been using Audacity and tools like GIMP and Paint.NET but for batch conversions I will have in mind what you suggest. BTW, I don't know Spanish at all :)

Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3375
  • Integrated Brain
    • View Profile
Re: PLAYMUSIC behaviour I can't understand
« Reply #9 on: 2013-Jan-14 »
Don't care if you need commnet me, and I pass the post...  :good: