Game Development Community

Playing very long ambient soundtracks

by Clint S. Brewer · in Torque Game Engine · 10/27/2004 (8:27 am) · 25 replies

To put it in perspective, I just purchased my license on the 22'nd, but have gotten a lot of things working so far. Thank to all the docs, and helpful forum posts.

One problem I haven't solved yet has to do with my ingame ambient sound track.

I have it working just fine as long as the ogg file is relatively small, but when I try to play a large ogg file, say about 8 megs (It's a 10 minute loop, wich I would really just like to stream) the engine seems to freeze on load. I don't see anything interesting in the console log and no errors pop up.

At first I thought that perhaps it was just loading the entire thing before it would play it, but I let it run for a long time last night, and now I think it's just frozen.


Any advice would be greatly appreciated.


Here are some of the details of what I'm doing:

in client/scripts/audioProfiles.cs
new AudioProfile(InGameMusic)
 {
   //Clint
   //ingame.ogg is a hunge 8 meg ogg that seems to have trouble loading
   //ingame2 is a shorter, but still long 2 meg ogg that seems to load fine
   //investigating..
   
   //filename    = "~/data/sound/music/ingame.ogg";
   filename    = "~/data/sound/music/ingame2.ogg";
   description = "AudioMusic";
   preload = false;
 };

and in client/scripts/playGui.cs
function PlayGui::onWake(%this)
{
   // Turn off any shell sounds...
   // alxStop( ... );
   alxStop($MusicMenuMain);
   alxPlay(InGameMusic);   
.....


again thanks for any advice, I'll debug the code, but was hoping someone else might have a quick answer.
Page «Previous 1 2
#1
10/27/2004 (8:39 am)
No help here...
I haven't been able to get long ogg files to play either, or any ogg that isn't 8-bit.
#2
10/27/2004 (8:48 am)
Hmm, my ogg files aren't 8-bit and play fine...as long as they aren't huge :)
I'm using the most recent stable release...1.3 I think it was.
I happen to have both a vorbis.dll and a OpenAL32.dll in my game directory. not sure if that vorbis dll is necessary. actually I don't think it is since it's not in the example directory and those oggs play fine.
#3
10/27/2004 (10:25 am)
What does your AudioDescription(AudioMusic) look like?
#4
10/27/2004 (10:58 am)
Ah yes forgot to post that
//at the top
$SimAudioType     = 2;


// lots in between then

new AudioDescription(AudioMusic)
 {
   volume   = 1.0;
   isLooping = true;
   is3D     = false;
   type     = $SimAudioType;
};
#5
10/27/2004 (2:23 pm)
Try this:

new AudioDescription(AudioMusic)
{
   volume   = 1.0;
   isLooping = true;
   isStreaming = true;
   is3D     = false;
   type     = $SimAudioType;
};

If isStreaming is true, the file will be streamed from disk instead of loading it all into memory.
#6
10/27/2004 (2:50 pm)
Ye try Kurtis example i tested this, i converted a 110 mb wav and got a 8.2 mb ogg file and it streams fine .
And tested it on one of my maps with over 30 emitters and other effect sounds .
#7
10/27/2004 (2:57 pm)
I don't have any lengthy ogg's so i cannot say, but I have seen, or rather heard a problem almost opposite of what your seeing. I have several very short ogg files which play no problem. I have mood music, so when all is well, you hear one song, then if you get shot at or whatever the music changes. They are looping tracks that are very nice and loop perfectly in the editor program I use, and as wav files, but when I use oggs, I get a little pause so they become useless. So I left with using wavs until I dig further.
#8
10/27/2004 (4:00 pm)
Nope, no go for me, still has the same problem, app just seems to freeze when the mission loads.

hmm lets see.
here's the file info as shown in winamp for my big file that doesn't work.
-------------
Length : 9:59
Average bitrate : 114 kbps
File size : 8,579,861 bytes
Nominal bitrate : 128 kbps
Channels : 2
Sampling rate: 44100 Hz
Serial number: 10073
Version : 0
Vendor :
Xiph.Org libVorbis I 20040629
---------------


here's the file info for my shortened down one that works just fine.
----------------
Length : 2:46
Average bitrate : 116 kbps
File size : 2,422,886 bytes
Nominal bitrate : 128 kbps
Channels : 2
Sampling rate: 44100 Hz
Serial number: 18208
Version : 0
Vendor :
Xiph.Org libVorbis I 20040629
---------------


I wonder if this could be some difference between head and the last stable release? Which are you folks using?
#9
10/27/2004 (5:24 pm)
Debugging it now, seems to never return from

vf.ov_open

going deeper...

it seems to never make it out of the while loop in this function

long OggVorbisFile::_get_next_page(ogg_page *og,int boundary){
  if(boundary>0)boundary+=vf->offset;
  while(1){
    long more;

    if(boundary>0 && vf->offset>=boundary)return(OV_FALSE);
    more=ogg_sync_pageseek(&vf->oy,og);
    
    if(more<0){
      /* skipped n bytes */
      vf->offset-=more;
    }else{
      if(more==0){
	/* send more paramedics */
	if(!boundary)return(OV_FALSE);
	{
	  long ret=_get_data();
	  if(ret==0)return(OV_EOF);
	  if(ret<0)return(OV_EREAD);
	}
      }else{
	/* got a page.  Return the offset at the page beginning,
           advance the internal offset past the page end */
	long ret=vf->offset;
	vf->offset+=more;
	return(ret);
	
      }
    }
  }
}
#10
10/27/2004 (11:56 pm)
Try another converter i use ogg vorbis tools !
#11
10/28/2004 (3:36 am)
On a sidenote: are these ogg files really streamed? Or are they loaded into memory?

streaming would be great, of course.
#12
10/28/2004 (4:21 am)
My files streaming really good.
I don't preload the files.
#13
10/28/2004 (5:01 am)
Did you ever try a really long file, like say, 100MB (which would be something like an hour)?
#14
10/28/2004 (7:21 am)
Is a 479 mb wav file enoth ?
i converted it to ogg and got a 36 mb ogg it plays without any problems !
#15
10/28/2004 (7:26 am)
I meant a hundred mb ogg, but 36 is quite sufficient, thank you :-).

I was under the impression that all this takes your memory away - glad to hear that it doesn't due to streaming.
#16
10/28/2004 (7:28 am)
I meant a hundred mb ogg, but 36 is quite sufficient, thank you :-).

I was under the impression that all this takes your memory away - glad to hear that it doesn't due to streaming.
#17
10/28/2004 (9:33 am)
Quote:Try another converter i use ogg vorbis tools !

and like magic... it works juuuuuuust fine. Thanks Billy, and thanks for the pointer to the vorbis tools.

so in summary:
problem: my ogg files work fine, but if I have a large one the game just seems to freeze up when I try and play it. I've tried streaming it with the "isStreaming = true;" and it still doesn't work, just freezes when the game starts.

solution: and the real problem, I was using an old ogg encoder. I saved my old ogg out as a wav, then used the vorbis tools oggenc.exe to re-encode that wav as an ogg and everything works fine now. The huge ambient sounds stream from disk as expected. You can find the vorbis tools precompiled here: www.vorbis.com/download.psp

here are the audio description and profile that I am sucsesfully using
new AudioDescription(AudioMusic)
 {
   volume   = 1.0;
   isLooping = true;
   isStreaming = true;
   is3D     = false;
   type     = $SimAudioType;
};

new AudioProfile(InGameMusic)
 {
   
   filename    = "~/data/sound/music/ingame.ogg";
   description = "AudioMusic";
   preload = false;
 };

I play it simply using the alxPlay function like so in PlayGui::onWake(%this)
alxPlay(InGameMusic);
#18
10/28/2004 (9:36 am)
And on another side note, do you know of another good encoder that can take mp3 files also?
I suppose I can batch *.mp3->*.wav->*.ogg, but it'd be nice to just go *.mp3->*.ogg since I have a few mp3 files I'd like to use.
#19
10/29/2004 (12:31 pm)
I know winamp can do that kind of thing, though I don't know whether the ogg encoder produces good files. All you do is set the output plugin to whatever format (so you'll have to find an OGG format writer plugin for winamp), then whatever plays in winamp is written to disk. Rather nice, actually. Note that MIDI is a pain to get working this way, but it is possible.
#20
10/29/2004 (12:48 pm)
@Clint
I haven't looked around much for the programs that convert mp3 - ogg .
One program that i know do this is soundforge6 , i use a older wavelab for my sounds so i must use your way ,but i don't have so much mp3 so it doens't matter :)
Page «Previous 1 2