GLBasic forum

Feature request => music/sound => Topic started by: S. P. Gardebiter on 2010-Jun-05

Title: LOADSOUND with compressed Soundfiles
Post by: S. P. Gardebiter on 2010-Jun-05
I really need this. Having a bunch of 2 MB wav files, just because I would like to play some ambient sounds for the atmosphere isn't funny guys :/
Title: Re: LOADSOUND with compressed Soundfiles
Post by: Ian Price on 2010-Jun-05
Can you not convert them to .ogg or .mp3?
Title: Re: LOADSOUND with compressed Soundfiles
Post by: S. P. Gardebiter on 2010-Jun-06
Quote from: Ian Price on 2010-Jun-05
Can you not convert them to .ogg or .mp3?

That's what I want to do but I read in the help file that GLBasic is not able to use .mp3's for sounds. (Only for music.)
Title: Re: LOADSOUND with compressed Soundfiles
Post by: Ian Price on 2010-Jun-06
Ah, right. You want them to literally play as sounds - that'll teach me for not reading the title properly.

I can't test .ogg on my laptop (they don't play with GLB), but you appear to be correct - you can't play .MP3s with PLAYSOUND.

I could have sworn .OGG files worked for sound (on my Wiz & GP2X), but I'm not so sure now. :S


GLB's sound really is a pain at times. Perhaps it's time Gernot looked at alternative sound systems.
Title: Re: LOADSOUND with compressed Soundfiles
Post by: Kitty Hello on 2010-Jun-07
what program did you use to convert to ogg, Ian?
Title: Re: LOADSOUND with compressed Soundfiles
Post by: Ian Price on 2010-Jun-07
Quotewhat program did you use to convert to ogg, Ian?
Audacity for the most part,  although I have tried other converters.

I used to be able to play .ogg files on my main desktop (but I don;t use that anymore due to reliability issues), but both my laptops fail to play .ogg files from GLB - and this has been repeated by others too.

.ogg files work (with PLAYMUSIC) with GP2X and Wiz though, which tbh is where I need them to work anyway.
Title: Re: LOADSOUND with compressed Soundfiles
Post by: S. P. Gardebiter on 2010-Jun-07
So what about playing compressed soundfiles with LOADSOUND? o:
Is it atleast on the todo list?
Title: Re: LOADSOUND with compressed Soundfiles
Post by: Kitty Hello on 2010-Jun-08
no. I don't see any need for that and it's definitely not doable x-platform for me.
Title: Re: LOADSOUND with compressed Soundfiles
Post by: S. P. Gardebiter on 2010-Jun-09
Quote from: Kitty Hello on 2010-Jun-08
no. I don't see any need for that

Why? I already explained it o: I want to play some ambient sounds and they may overlap. Games need atmosphere. If I use wavs they are 2 MB big but if I use MP3s they are only 200 kB big. It would be insane if I only would use 15 of them (30 MB versus 3 MB and 15 wouldn't be much soundfiles). My internet connection will die and my beta testers will complain about the huge download.
Also MP3 is a very common format, more common than wav. Why is there no need for this and why does PLAYMUSIC support MP3s and PLAYSOUND does not?

Quote from: Kitty Hello on 2010-Jun-08and it's definitely not doable x-platform for me.

There are several ways to implement this:
You could decode the MP3 and save it as a wav on the harddisk and then you could play it. Or you could decode it and load it into the ram. Should work for any platform. Decoding MP3s shouldn't be that hard. I would even code it, if you want.
Title: Re: LOADSOUND with compressed Soundfiles
Post by: Ian Price on 2010-Jun-09
Can't you just play them as music using the PLAYMUSIC command,  or is there music playing as well?
Title: Re: LOADSOUND with compressed Soundfiles
Post by: S. P. Gardebiter on 2010-Jun-09
Quote from: Ian Price on 2010-Jun-09
Can't you just play them as music using the PLAYMUSIC command,  or is there music playing as well?

Please read my posts:

Quote from: S. P. Gardebiter on 2010-Jun-09Why? I already explained it o: I want to play some ambient sounds and they may overlap.

But sometimes there is music playing as well.

I don't get whats so hard to get MP3 support working for Sounds. It's working with music too.
Title: Re: LOADSOUND with compressed Soundfiles
Post by: Ian Price on 2010-Jun-09
Sorry. I did read that when you first posted - but I've worked and slept a little since then :/
Title: Re: LOADSOUND with compressed Soundfiles
Post by: Kitty Hello on 2010-Jun-09
If it's about compression, uncompress them yourself from mp3 to wav at first start.
Really, I wish I could help you, but I don't see a x-platform way to do it. And I don't have a week holidays just for this. You might try the fmod or bass dll if it's windows/linux/mac only.
Title: Re: LOADSOUND with compressed Soundfiles
Post by: S. P. Gardebiter on 2010-Jun-10
I just thought that it should be in GLBasic, since I it's so common, I can't even believe that it's not supported. The problem with uncompression is always the file format. I will see what I can do, I just hope that it's not too slow if I uncompress them with GLBasic rather than INLINE C. If I'm able to uncompress them, I will make the functions to do so public.

Quote from: Kitty Hello on 2010-Jun-09You might try the fmod or bass dll if it's windows/linux/mac only.

The problem with 3rd party libaries is usually the license.
Title: Re: LOADSOUND with compressed Soundfiles
Post by: Kitty Hello on 2010-Jun-15
Don't uncompress in real time - make that at the start of the game or so...
Title: Re: LOADSOUND with compressed Soundfiles
Post by: Kuron on 2010-Jun-17
QuoteAlso MP3 is a very common format, more common than wav. Why is there no need for this and why does PLAYMUSIC support MP3s and PLAYSOUND does not?
It is not more common than WAV.  The MP3 format is a patented format.  It would cost Gernot a lot of money to license it for GLBasic.  Given the small community, it would probably knock up the price of GLBasic to around $500 or more.

Even then, GLB users still could not use the MP3 support as Gernot's license would only cover him.  For game developers the license goes by distributed copies and not sold copies so this affects even freeware developers, the license for having MP3s with your games is $2500 per title (http://www.mp3licensing.com/royalty/games.html).  Since the vast majority of GLB users can't legally use MP3s with their games due to being unable to afford the license, it is rather pointless to implement the feature even if Gernot was in a position to be able to afford it.
Title: Re: LOADSOUND with compressed Soundfiles
Post by: kaotiklabs on 2010-Jun-17

So, as far as I can undestand anybody of you are using MP3s in your iphone games??
Title: Re: LOADSOUND with compressed Soundfiles
Post by: S. P. Gardebiter on 2010-Jun-18
@Kuron:

Oh really?
Why does PLAYMUSIC support MP3's then? ::)
Title: Re: LOADSOUND with compressed Soundfiles
Post by: Kuron on 2010-Jun-20
Quote from: S. P. Gardebiter on 2010-Jun-18
@Kuron:

Oh really?
Why does PLAYMUSIC support MP3's then? ::)
Because the API that Gernot uses supports it ;)  Still that API's license doesn't cover you.  If you use MP3s in your game, you have to pay the $2,500 license fee.
Title: Re: LOADSOUND with compressed Soundfiles
Post by: Kitty Hello on 2010-Jun-22
/me converts al his music to ... OGG now. Blimey, I hope noone finds out...
Title: Re: LOADSOUND with compressed Soundfiles
Post by: Kuron on 2010-Jun-22
Quote from: Kitty Hello on 2010-Jun-22
/me converts al his music to ... OGG now. Blimey, I hope noone finds out...
That is about the only thing you can do with MP3s and not have to pay license fees for ;) 

I got a C&D from Thomson a couple of years ago because I put a couple of free MP3s on my music site where I was selling my music CDs.   :(
Title: Re: LOADSOUND with compressed Soundfiles
Post by: S. P. Gardebiter on 2010-Jun-29
I would be fine with using OGGs for PLAYMUSIC/PLAYSOUND too.
I have googled about the OGG file format too, but I can't find anything aside from C/C++ Source Codes >_>;
And I don't know any C/C++ :/

All I ask for is compression, a own file format would be fine too :/
Title: Re: LOADSOUND with compressed Soundfiles
Post by: Kitty Hello on 2010-Jun-30
shoeboxxed wav files? I would not be able to stream them, but they are about the size of a lossless ogg container.
Title: Re: LOADSOUND with compressed Soundfiles
Post by: S. P. Gardebiter on 2010-Jun-30
Quote from: Kitty Hello on 2010-Jun-30
shoeboxxed wav files? I would not be able to stream them, but they are about the size of a lossless ogg container.

You sure? :/
My wave file: 2,84 MB
My wave file in a showbox: 2,37 MB
My wave file as a ogg: 255 KB
Title: Re: LOADSOUND with compressed Soundfiles
Post by: Kitty Hello on 2010-Jun-30
that's not lossless then. Well, suggest what I should do now. I don't see a way to play corss platform OGG files. Do Linux and Mac platforms already support OGG with PLAYMUSIC? (can someone test, please) In that case I'd only have to cover Win32 and WinCE. The first of them might be doable, but WinCE is definitely bad.
Title: Re: LOADSOUND with compressed Soundfiles
Post by: S. P. Gardebiter on 2010-Jun-30
Quote from: Kitty Hello on 2010-Jun-30
that's not lossless then. Well, suggest what I should do now. I don't see a way to play corss platform OGG files. Do Linux and Mac platforms already support OGG with PLAYMUSIC? (can someone test, please) In that case I'd only have to cover Win32 and WinCE. The first of them might be doable, but WinCE is definitely bad.

I'm not sure. If uncompressing at game start is no solution, then I don't know o: Perhaps there is a LPGL OGG Vobis libary. A long time Linux user told me, that Linux does support OGG Vobis (as a codec), while a native Windows version does not. (Not sure about Mac though) I can't play OGG's with PLAYMUSIC, so it seems that umcompressing is the only solution D:
Or a own file format. But I don't know anything about compression :/