Game Development Community

Audio Question

by Tim Heldna · in Torque Game Engine · 04/29/2005 (8:17 am) · 9 replies

In my experience i've noticed that if you want to play an audio file in Torque, if it's too long in length it won't play.

File size doesn't seem to solve this i might add. For instance, i tried playing a *.wav file in my menu screen that was about 10mb in size and 1 minute long, it wouldn't play (i know 10mb is probably way too big i was just seeing if i could do it).

If i took the same file, converted it to an *.ogg file thus reducing it down too about 950kb, but still about 1 minute in length, it still wouldn't play.

If i took the same file, left it in *.wav format but chopped it down to about 10 seconds in length which reduced it down to just over 2mb it worked. Same result doing the same thing with the *.ogg file.

Well this is what leads me to believe it's the length that's causing the problem and not the size of the file. So what's going on? I mean we want songs in our game and it would suck to be limited to short looping sounds.

N.B. I should mention something pretty important. This problem only happens in the GUI screens and not in game. At a guess i'm figuring it has something to do with the client audio profile 'vs' the server audio profile.

Can you make audio files on the client side stream like you can with an in game audio emitter? If so would this work? I've tried setting preload to true in my audioprofile in the client/scripts/audioprofiles.cs script but still nothing plays. I've also tried adding the field isStreaming = 1; and isStreaming = true; but once again nothing.

Can anybody shed some light on this matter???

#1
04/29/2005 (8:20 am)
If you are on Windows, I would be very curious if the steps I took in this thread help.
#2
04/29/2005 (8:48 am)
@Josh Ritter

Yes im on windows and i can't tell if what you suggest will help. I have put in a resource which you can find here. As a result my audioBuffer.cc file is quite different to the sections of code you posted in that thread.

My sound was a stereo file and trust me i've made every modification to it possible (i'm using sound forge 7 by the way). I've even tried using different audio editing programs to no avail. The only way i can get my sounds to play in the GUI is to make sure they're not over a minute or so in length.

?????????????????????????????????????????????????????????????
#3
04/29/2005 (9:14 am)
Are you sure you use streaming audio ?
I made a test with huge audio files sometime ago i think it was a 400 mb wave file and converted to ogg around 40 mb if i remember correct.
And it played really nice.
Have you tried the a command line wave to ogg converter ?
#4
04/29/2005 (9:23 am)
Billy, i have no problem using large streaming audio files in game. My problem is playing these sounds in the GUI. I wasn't sure if you could stream audio in the GUI section and if you can i don't know how.

Haven't tried the command line wave to ogg converter cos i didn't know it existed. Mind you i don't feel i have a need for it cos i have adequate software for doing this...
#5
04/29/2005 (10:40 am)
Have you tried using alxPlay or similar? The demo app plays a sound when it starts up, might look into how that was done.
#6
04/29/2005 (11:02 am)
Ben, i have this in mainMenu.gui

$musicHandle = alxPlay(menumusic);

This in audioProfiles.cs

new AudioDescription(Music)
{
   volume = 1.0;
   isLooping = true;
   is3D = false;
   type = $MusicAudioType;
};

new AudioProfile(menumusic)
{
   filename = "~/data/sound/music/menumusic.wav";
   description = "Music";
	preload = false;
};

and obviously i have a definition for $MusicAudioType; at the top with the rest of them.

Like i said this works fine as long as the audio file isn't over about a minute or so in length.
#7
04/29/2005 (12:40 pm)
The only thing i can add to this , in my audiodescription i have isStreaming = true if i use large audiofiles.
I tested this in my main gui , and i can play all my long music files and they are over 4 minutes all of them wave or ogg doesnt matter.
I use alxPlay , but i dont use that new audioresource , i hade some problems with the wave files when i used that.
#8
04/29/2005 (1:08 pm)
If i do as you suggest Billy Torque just crashes straight away :(

Opps, my bad. Made a typo that's why it was crashing. Forget the ";" at the end of true!

Ok, so it doesn't crash yet with a song over around 1.10.00 in length no sound.
#9
04/29/2005 (1:15 pm)
Ah finally got it working!!! Thanks Billy, did what you said, without the typo and after a dso clean, and everything works perfect.

Cheers everyone!!!