OGG File Rendering
Moderator: Moderators
OGG File Rendering
Um, I've started to assemble some music and stuff for P.U.R.E., and I can get it to play as WAV, but whenever I try to play it via OGG, I get an error message, saying that it cannot open the OGG file.
Is there a specific compression, etc., that I need to use? I mean, when it comes down to it, the WAVs can get zipped or 7zipped, so it's not really a big deal insofar as size is concerned, but I'm a little worried about memory usage, given that uncompressed WAVs of 3-5 minute tracks are fricking huge....
Is there a specific compression, etc., that I need to use? I mean, when it comes down to it, the WAVs can get zipped or 7zipped, so it's not really a big deal insofar as size is concerned, but I'm a little worried about memory usage, given that uncompressed WAVs of 3-5 minute tracks are fricking huge....
Re: OGG File Rendering
Well, I'm proceeding on the assumption that it's a weird soundfile issue. OGG supports mono and stereo, and variable bitrate, as well as compression... this should be fun. I don't suppose anybody has an OGG file that you know works, to compare against?
Re: OGG File Rendering
Damnit, I think somebody posted that a certain encoder borks the endianness of the oggs.... can't find the thread. The search functionality of the forum no longer works. (edit: doesn't work on the word "ogg" presumably it filters out 3-letter-words).
Iirc though, the endianness issue just made it sound crappy, but still play.
Iirc though, the endianness issue just made it sound crappy, but still play.
Re: OGG File Rendering
Um, I get a response from Spring, saying: "Could not open Ogg file." And that's all it tells me, so I'm kind've stuck. If it's an endianess problem, well... that's going to be a real pain to figure out, given that I've just used both Audacity and WavePad, and several different options, and nothing happened.
I can make WAVs play just fine, on a randomized list, so long as they're under 70 or so megabytes in size (yikes, I know!).
Also, there was all of that stuff about how Trepan's Linux-only... so do the SVN builds contain OpenAL, or DirectSound? I thought they contained OpenAL, so that I was at least comparing apples to apples.
Maybe I should just go look at how to differentiate OS, so that I can open the default music-player in the background, or something...
I can make WAVs play just fine, on a randomized list, so long as they're under 70 or so megabytes in size (yikes, I know!).
Also, there was all of that stuff about how Trepan's Linux-only... so do the SVN builds contain OpenAL, or DirectSound? I thought they contained OpenAL, so that I was at least comparing apples to apples.
Maybe I should just go look at how to differentiate OS, so that I can open the default music-player in the background, or something...
Re: OGG File Rendering
I know this open-sourced game uses .ogg's to play sounds for sure, I think using OpenAL: http://sourceforge.net/projects/openastromenace
It works on both Windows and Linux, so if you want, poke and see how they do it.
It works on both Windows and Linux, so if you want, poke and see how they do it.
Re: OGG File Rendering
Not worth the time investment, at present. I know jack squat about soundfile rendering, it'd just be an exercise in frustration.
I've just taken the really huge songs and made them mono, since stereo sounds give Spring serious problems most of the time, unless they're at 44kHz... so, mono-channel 44kHz music it shall be.
It's so easy to write a music-player that actually works.
The only problem being that since it will not render OGG, until I know what I need to do with the music, I cannot make it event-driven... ah well...
[EDIT] Removed my snarky commentary. I just thought it was bizarre that somebody would not just use the playing time of the track... sometimes, the obvious just... isn't. [/EDIT]
I've just taken the really huge songs and made them mono, since stereo sounds give Spring serious problems most of the time, unless they're at 44kHz... so, mono-channel 44kHz music it shall be.
It's so easy to write a music-player that actually works.
The only problem being that since it will not render OGG, until I know what I need to do with the music, I cannot make it event-driven... ah well...
[EDIT] Removed my snarky commentary. I just thought it was bizarre that somebody would not just use the playing time of the track... sometimes, the obvious just... isn't. [/EDIT]
Re: OGG File Rendering
1. You only get the "could not open Ogg file" error if you specified a
wrong path or don't have the right permissions, the filename string
gets passed straight to fopen().
2. The sound library used by Spring depends on the OS it runs on
(OpenAL on Linux, DSound on Windows), but the error has nothing
to do with either.
wrong path or don't have the right permissions, the filename string
gets passed straight to fopen().
2. The sound library used by Spring depends on the OS it runs on
(OpenAL on Linux, DSound on Windows), but the error has nothing
to do with either.
Re: OGG File Rendering
But the path is the same path I'm using for the WAVs... that doesn't make any sense...
I'm just using a line like:
Spring.PlaySoundFile('Sounds/MyWav.wav',1.0)
To play the WAVs, and it's working perfectly. Change "wav" to "ogg" (er, and use the PlaySoundStream, of course), and suddenly it cannot find the file. Are OGGs supposed to go in a special directory, or something?
I'm just using a line like:
Spring.PlaySoundFile('Sounds/MyWav.wav',1.0)
To play the WAVs, and it's working perfectly. Change "wav" to "ogg" (er, and use the PlaySoundStream, of course), and suddenly it cannot find the file. Are OGGs supposed to go in a special directory, or something?
Re: OGG File Rendering
Hrmm. Looked at the sound code... looks like it goes straight to the OpenAL / DX code, pretty much. Maybe it's because DX doesn't support OGG natively? Meh... lemme go look at Trepan's stuff. I hate a mystery, but if it's a file-path thing, surely I can figure this out. And I just tested the 44kHz mono... sounds really awesome, people are going to really, really like what Spring feels like, when we actually have music that goes with the game, I think...
- Stealth870
- Posts: 166
- Joined: 13 Sep 2004, 00:25
Re: OGG File Rendering
Well, not that I know a lot about this but:
Here is an OGG file that I used and worked in a music player I was trying to build.
All I know is that I had a widget that read from the LuaUI/music folder like this:
local SOUND_DIRNAME = LUAUI_DIRNAME .. 'music/'
and
Spring.PlaySoundStream(SOUND_DIRNAME .. "09.ogg", 1)
Here is an OGG file that I used and worked in a music player I was trying to build.
All I know is that I had a widget that read from the LuaUI/music folder like this:
local SOUND_DIRNAME = LUAUI_DIRNAME .. 'music/'
and
Spring.PlaySoundStream(SOUND_DIRNAME .. "09.ogg", 1)
Re: OGG File Rendering
Hrmm... ok... lemme try that. I read the OGG stuff, and Kloot's entirely right, it just tries to go where it needs to. Maybe it needs a "Music" folder...
Re: OGG File Rendering
For Ogg's the path needs to be the true relative or absolute pathArgh wrote:But the path is the same path I'm using for the WAVs... that doesn't make any sense...
I'm just using a line like:
Spring.PlaySoundFile('Sounds/MyWav.wav',1.0)
to a file. Your example will only work if "Sounds" is a directory next
to maps/, mods/, etc, not if it's inside your mod archive (Ogg's are
not mapped into the VFS).
ps. Trepan did not write the Ogg decoders

Re: OGG File Rendering
Aha... man, that should really be in VFS, imo. Of course, I have no idea how that works, so I should probably shut up. I'm at the loopy point of being tired, I think I'd better get a nap today.For Ogg's the path needs to be the true relative or absolute path
to a file.
I got it to work, on a literal path:
Spring.PlaySoundStream("mods/PURE.sdd/music/myOgg.ogg",1.0)
So, all I've gotta do is remember to change that from ".sdd" to ".sdz" upon release... great, another little detail to remember... at least now the music works...
Re: OGG File Rendering
Haven't looked, but perhaps there's a constant available that will let you fetch the current mod's folder so you can concat it in right there.Argh wrote:Aha... man, that should really be in VFS, imo. Of course, I have no idea how that works, so I should probably shut up. I'm at the loopy point of being tired, I think I'd better get a nap today.For Ogg's the path needs to be the true relative or absolute path
to a file.
I got it to work, on a literal path:
Spring.PlaySoundStream("mods/PURE.sdd/music/myOgg.ogg",1.0)
So, all I've gotta do is remember to change that from ".sdd" to ".sdz" upon release... great, another little detail to remember... at least now the music works...
Re: OGG File Rendering
Ooh, that'd be nice, save me a lot of trouble... where are those constants... I can hardly even see straight, I spent pretty much all night getting sounds and death animations done for the Resistance, so that the cute little guys can scream and flop around when they die, and then I thought, "gee, I should do something about the whole music situation", so I wrote a simple, bulletproof player (which now I'll have to make a little fancier, since I can interrupt the stream based on events...)... found some music I can use, without getting sued, etc., etc., etc...
<goes to take a nap before work>
<goes to take a nap before work>
Re: OGG File Rendering
Will blahblah.sdz/ actually work, or does somebody need to hack at the code a bit?
Re: OGG File Rendering
Um, is there any way for LUA to get the value of where the music is in the stream, in the track, and start / stop it or modify it where appropriate?
Basically, I have a repeating, bug-free music app- that was the "easy part", except for the file-system stuff. The CPU load isn't bad at all, I'm ready to use it, and I have some awesome music that I've dug up, that I can use legally with P.U.R.E.
However, even if I have event-detection code to detect a "battle status", it cannot operate without just cutting the main theme immediately, via Spring.StopSoundStream(). I think there may be a way to make it fade out sharply, or have it fade in, after the "battle status" is over, but for that to work, and not be a sudden, jarring transition, I need to be able to manipulate the stream. I guess I could do a hack-around, with some special "normal" music that fades in, or something...
The other problem is volume controls. I can write a volume control UI element, but if the user selects it, it'll have to restart the stream from the start. If the stream could be interrupted and re-started at the same spot (probably just needs to store the current location, and make this available via a parameter to StopSoundStream), then it'd be possible to introduce volume sliders or push-button UI elements (given my current weak state of UI prowess, I probably have stick with music ON/OFF for now, but meh... maybe at some point).
At any rate, none of this is exactly do-or-die. These are all just polishing things. At the moment, I'm just happy that I finally have a Spring game with background music, that works and is very straightforward code
Basically, I have a repeating, bug-free music app- that was the "easy part", except for the file-system stuff. The CPU load isn't bad at all, I'm ready to use it, and I have some awesome music that I've dug up, that I can use legally with P.U.R.E.
However, even if I have event-detection code to detect a "battle status", it cannot operate without just cutting the main theme immediately, via Spring.StopSoundStream(). I think there may be a way to make it fade out sharply, or have it fade in, after the "battle status" is over, but for that to work, and not be a sudden, jarring transition, I need to be able to manipulate the stream. I guess I could do a hack-around, with some special "normal" music that fades in, or something...
The other problem is volume controls. I can write a volume control UI element, but if the user selects it, it'll have to restart the stream from the start. If the stream could be interrupted and re-started at the same spot (probably just needs to store the current location, and make this available via a parameter to StopSoundStream), then it'd be possible to introduce volume sliders or push-button UI elements (given my current weak state of UI prowess, I probably have stick with music ON/OFF for now, but meh... maybe at some point).
At any rate, none of this is exactly do-or-die. These are all just polishing things. At the moment, I'm just happy that I finally have a Spring game with background music, that works and is very straightforward code

Re: OGG File Rendering
Don't think it will work; IMHO ogg file loading should just be made to use the VFS instead of adding another layer of functionality to current VFS (treating archives as disk folders).
Re: OGG File Rendering
That'd be excellent, and would sure make life easier. If anybody finds time to do this, please let me know, I would not want to be caught out by not updating my LUA before release, and having this feature DOA...Don't think it will work; IMHO ogg file loading should just be made to use the VFS instead of adding another layer of functionality to current VFS (treating archives as disk folders).
- Stealth870
- Posts: 166
- Joined: 13 Sep 2004, 00:25
Re: OGG File Rendering
As far as I know, no. That was the same problem I ran into when coding my music player, and it seems others have as well. No volume control or seeking is currently crippled in the current OGG implentation it seems.Argh wrote:Um, is there any way for LUA to get the value of where the music is in the stream, in the track, and start / stop it or modify it where appropriate?
The other problem is volume controls.
