Author Topic: LOADSOUND with compressed Soundfiles  (Read 7645 times)

Offline S. P. Gardebiter

  • Mr. Polyvector
  • ***
  • Posts: 245
    • View Profile
    • Tile 44 Interactive
LOADSOUND with compressed Soundfiles
« 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 :/
~ Cave Story rules! ~

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4097
  • On the shoulders of giants.
    • View Profile
    • My Apps
Re: LOADSOUND with compressed Soundfiles
« Reply #1 on: 2010-Jun-05 »
Can you not convert them to .ogg or .mp3?
I came. I saw. I played.

Offline S. P. Gardebiter

  • Mr. Polyvector
  • ***
  • Posts: 245
    • View Profile
    • Tile 44 Interactive
Re: LOADSOUND with compressed Soundfiles
« Reply #2 on: 2010-Jun-06 »
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.)
~ Cave Story rules! ~

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4097
  • On the shoulders of giants.
    • View Profile
    • My Apps
Re: LOADSOUND with compressed Soundfiles
« Reply #3 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.
I came. I saw. I played.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10651
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: LOADSOUND with compressed Soundfiles
« Reply #4 on: 2010-Jun-07 »
what program did you use to convert to ogg, Ian?

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4097
  • On the shoulders of giants.
    • View Profile
    • My Apps
Re: LOADSOUND with compressed Soundfiles
« Reply #5 on: 2010-Jun-07 »
Quote
what 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.
I came. I saw. I played.

Offline S. P. Gardebiter

  • Mr. Polyvector
  • ***
  • Posts: 245
    • View Profile
    • Tile 44 Interactive
Re: LOADSOUND with compressed Soundfiles
« Reply #6 on: 2010-Jun-07 »
So what about playing compressed soundfiles with LOADSOUND? o:
Is it atleast on the todo list?
~ Cave Story rules! ~

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10651
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: LOADSOUND with compressed Soundfiles
« Reply #7 on: 2010-Jun-08 »
no. I don't see any need for that and it's definitely not doable x-platform for me.

Offline S. P. Gardebiter

  • Mr. Polyvector
  • ***
  • Posts: 245
    • View Profile
    • Tile 44 Interactive
Re: LOADSOUND with compressed Soundfiles
« Reply #8 on: 2010-Jun-09 »
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?

and 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.
« Last Edit: 2010-Jun-09 by S. P. Gardebiter »
~ Cave Story rules! ~

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4097
  • On the shoulders of giants.
    • View Profile
    • My Apps
Re: LOADSOUND with compressed Soundfiles
« Reply #9 on: 2010-Jun-09 »
Can't you just play them as music using the PLAYMUSIC command,  or is there music playing as well?
I came. I saw. I played.

Offline S. P. Gardebiter

  • Mr. Polyvector
  • ***
  • Posts: 245
    • View Profile
    • Tile 44 Interactive
Re: LOADSOUND with compressed Soundfiles
« Reply #10 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:

Why? 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.
~ Cave Story rules! ~

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4097
  • On the shoulders of giants.
    • View Profile
    • My Apps
Re: LOADSOUND with compressed Soundfiles
« Reply #11 on: 2010-Jun-09 »
Sorry. I did read that when you first posted - but I've worked and slept a little since then :/
I came. I saw. I played.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10651
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: LOADSOUND with compressed Soundfiles
« Reply #12 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.

Offline S. P. Gardebiter

  • Mr. Polyvector
  • ***
  • Posts: 245
    • View Profile
    • Tile 44 Interactive
Re: LOADSOUND with compressed Soundfiles
« Reply #13 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.

You might try the fmod or bass dll if it's windows/linux/mac only.

The problem with 3rd party libaries is usually the license.
~ Cave Story rules! ~

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10651
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: LOADSOUND with compressed Soundfiles
« Reply #14 on: 2010-Jun-15 »
Don't uncompress in real time - make that at the start of the game or so...