class GameWindow < Gosu::Window
self.caption = $system.title
@music = Gosu::Song.new(self, "Resources/Despondent.mp3")
And throws this error:
initialize': File contains data in an unknown format. (RuntimeError)initialize'
>Exit code: 1
It is a .mp3 file, and I believe the path is correct (I have my images in that Resources folder too, and they load fine).
I am running through SciTe script editor.
Gosu can play only .wav or .ogg.
MP3's decryption has a copy-write to pay for and since Gosu is a free-to-use library, using MP3's didn't end up being a feature.
However, to get around this, download and use Audacity. You can convert your .mp3 file to either .wav or .ogg. :)
I see. Is the quality kept the same or is it affected by the conversion?
More or less, yes. You can alter the quality under preferences. The higher the conversion quality for .ogg, the bigger the file. The smaller the quality, the smaller the file (but most people may not notice the differences!)
OggVorbis is usually regarded as a better format for audio than MP3, but converting between them will result in some loss of quality because they both chuck out some data to keep file sizes down.
OGG uses compression, just like MP3. The difference in quality (compared to say, FLAC) comes from which portion of the spectrum the compression chooses to favor. IIRC, OGG tends to favor pitches in the range of human voices, while MP3 is equally compressed throughout.
I could be totally wrong though. I remember reading an article online about it a while back, but I can't seem to find it right now.
By the way, how come other free libraries like cocos2d-iphone can run .mp3 files anyway?
Gosu can play MP3 on iOS (just like Cocos2D) because it uses the iOS system APIs. (Using OGG on the iPhone is a very bad idea, because OGG decoding is not hardware-accelerated.)
I honestly don't understand the exact licensing scheme for MP3. If I could get each operating system's APIs to decode MP3 files for me, I would support it for development purposes alone. (Just like Gosu supports loading from PSD files and it makes prototyping nicer - probably - I haven't tried it a lot yet)
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill