Sounds in first person view...
by Kirby Webber · in Torque Game Engine · 11/22/2003 (1:05 pm) · 9 replies
Backtracking some problems in order to clarify their cause, I inserted some sounds from Tribes2 in order to do a test.
The sounds play perfectly when the camera is behind the player (3rd person perspective) but not in First person view?!
When the camera is in 1st person, the sounds play, but they get, uhmmm, choppy is the best way I can describe it.
I'm at a loss for what it is that I'm missing? Is there a sound node that I was unaware of?
I've chased the open AL issue till I'm blue in the face, but that doesn't *seem* to be the problem.
Any insight would be greatly appreciated.
The sounds play perfectly when the camera is behind the player (3rd person perspective) but not in First person view?!
When the camera is in 1st person, the sounds play, but they get, uhmmm, choppy is the best way I can describe it.
I'm at a loss for what it is that I'm missing? Is there a sound node that I was unaware of?
I've chased the open AL issue till I'm blue in the face, but that doesn't *seem* to be the problem.
Any insight would be greatly appreciated.
#2
My only suggestion right now is to make ANY sound you intend to use as 3D as a MONO file. I'm not sure if this is the solution or not, or if it even makes sense, but the 3D sound positioning engine seems to trip over stereo sound files a bit. This is definitely the case with distance effects (volume adjusts based on proximity), as stereo files will play at the same volume at any proximity but mono works great.
Hope that helps... or maybe someone else will chime in if I'm not being accurate here. :-)
11/24/2003 (9:51 am)
I'm not exactly sure what you're describing here, but I think what you're getting is an "issue" with 3D sound positioning stuff. When you use a sound and it's set to use "3D" types in the AudioProfile, it can seemingly do wonky things from first-person view with sounds triggered very near the player's position... from what I've noticed anyway.My only suggestion right now is to make ANY sound you intend to use as 3D as a MONO file. I'm not sure if this is the solution or not, or if it even makes sense, but the 3D sound positioning engine seems to trip over stereo sound files a bit. This is definitely the case with distance effects (volume adjusts based on proximity), as stereo files will play at the same volume at any proximity but mono works great.
Hope that helps... or maybe someone else will chime in if I'm not being accurate here. :-)
#3
I had come across a forum thread recently that illuminated the Stereo vs Mono channel issue with regards to 3D sound.
It is because of this that I went back and grabbed some original Tribes2 sounds for testing.
What is particularly interesting to me is that the sounds from the demo (i.e. ogg vorbis format) seem to play correctly, while *.wav files do not.
I have wondered if something was handled differently in the way that Torque deals with the two formats.
Should I just look around for an sound editor with Ogg Vorbis support and give up on *.wav's? If so, any suggestions?
11/24/2003 (9:57 am)
Paul, first let me say thanks for the reply.I had come across a forum thread recently that illuminated the Stereo vs Mono channel issue with regards to 3D sound.
It is because of this that I went back and grabbed some original Tribes2 sounds for testing.
What is particularly interesting to me is that the sounds from the demo (i.e. ogg vorbis format) seem to play correctly, while *.wav files do not.
I have wondered if something was handled differently in the way that Torque deals with the two formats.
Should I just look around for an sound editor with Ogg Vorbis support and give up on *.wav's? If so, any suggestions?
#4
...of course, I'm just pointing this out in case you didn't check the files to be sure. I'm pretty sure all the TGE's OGG files are mono (from brief checking) and I just don't know about Tribes2.
If you want to start into the World of Ogg, I'd suggest you start by using your existing sound editor and just converting the files from .wav using the free Ogg Drop Encoder from the Ogg Vorbis site:
http://www.vorbis.com/
I've had great luck with that little utility (except it used to crash when converting larger numbers of files... might be fixed now).
I'm not sure what else to do differently, since the sound engine is pretty straight-forward. The only troubles I've had over time have had to do with messing with AudioProfile stuff and with mono/stereo.
11/24/2003 (10:19 am)
Hrmm... the OGG support has only recently been added to the Torque, so my only earlier experience was with WAV format files. Since using OGG, I'm just in the habit of making all mono files, so I don't have a comparison. I am not sure the sound system in Tribes2 is the same as Torque (OpenAL), but I don't know anything about that. If it's a different system, their files may be in stereo, which isn't much help in this test....of course, I'm just pointing this out in case you didn't check the files to be sure. I'm pretty sure all the TGE's OGG files are mono (from brief checking) and I just don't know about Tribes2.
If you want to start into the World of Ogg, I'd suggest you start by using your existing sound editor and just converting the files from .wav using the free Ogg Drop Encoder from the Ogg Vorbis site:
http://www.vorbis.com/
I've had great luck with that little utility (except it used to crash when converting larger numbers of files... might be fixed now).
I'm not sure what else to do differently, since the sound engine is pretty straight-forward. The only troubles I've had over time have had to do with messing with AudioProfile stuff and with mono/stereo.
#5
Right now I'm using a rather strange combination of applications which include some rather basic level utilities.
I'm going to look around for a more complete solution, and hoefully will get this issue resolved in the near future - gaming just isn't the same without good sound. ;-)
I appreciate your help Paul. =)
11/24/2003 (11:32 am)
I'll try porting my sound files to OV this week and see if that helps.Right now I'm using a rather strange combination of applications which include some rather basic level utilities.
I'm going to look around for a more complete solution, and hoefully will get this issue resolved in the near future - gaming just isn't the same without good sound. ;-)
I appreciate your help Paul. =)
#6
I'm really befuddled here - everything sounds fine in 3rd person view (behind the player). I have tried manipulating the eye node by setting it in different locations, but the farther away I move it (In front of the player entity) the worse the effect becomes.
Could it simply the speed with which my entities move affecting the fallof? (These things "cruise" about 90mph by my calcs, and "jet 125 plus.)
I'd really like to get this tackled once and for all.
11/25/2003 (5:58 am)
Tried usng Ogg Vorbis and it's the same thing!I'm really befuddled here - everything sounds fine in 3rd person view (behind the player). I have tried manipulating the eye node by setting it in different locations, but the farther away I move it (In front of the player entity) the worse the effect becomes.
Could it simply the speed with which my entities move affecting the fallof? (These things "cruise" about 90mph by my calcs, and "jet 125 plus.)
I'd really like to get this tackled once and for all.
#7
11/25/2003 (6:01 am)
What soundcard do you have? I have a Soundblaster Audigy, and the 1st person sounds do play, but they are very silent compared to 3rd person... I guess it has to do with the 3D nature of the sounds/the soundcard... I had a cheap no-name card before which didnt have this problem... all just speculation, but it may be worth a try looking at your card ;)
#8
Perhaps I should look into newer drivers for the card - I've exausted the Open AL version possibilities. ;)
Actually - I'm kind of embarrassed that I didn't think to update Sound Card drivers before now. I'd almost bet money that solves it... but you never know - I'll just have to hope until I can get home to my dev machine.
In the meantime, I'll post my findings later on tonight (hopefully ;-).
THANKS Stefan - this *may* not do it, but it's more hope than I had 5 minutes ago! =)
Happy camper here!
11/25/2003 (6:07 am)
SB Audigy - I noticed the "silence too" though when I move it gets "choppy".Perhaps I should look into newer drivers for the card - I've exausted the Open AL version possibilities. ;)
Actually - I'm kind of embarrassed that I didn't think to update Sound Card drivers before now. I'd almost bet money that solves it... but you never know - I'll just have to hope until I can get home to my dev machine.
In the meantime, I'll post my findings later on tonight (hopefully ;-).
THANKS Stefan - this *may* not do it, but it's more hope than I had 5 minutes ago! =)
Happy camper here!
#9
First, create another sound (ie. EngineSound2D) and another sound profile (ie. mEngineSound2D) in wheeledvehicle.h
Second, follow the mEngineSound in wheeledvehicle.cc and add mEngineSound2D including the addField etc. (the only place I didn't add the mEngineSound2D is in onNewDataBlock(GameBaseData* dptr) where we start the engine because it's fine to start the engine (only once!) in 3D and updateEngineSound will do the rest.)
Third, in updateEngineSound(F32 level) we need to make it so that only one engine sound will play and switch it depending if we're first person or not. should look like something like this:
I just did that tonight, finding this thread before trying my code ;-p
ohhhh and fourth, don't forget to add enginesound2d = yournewaudioprofile2d; in your vehicle's datablock. And of course, make a new audioprofile accordingly, pointing to a 2D audiodescription :-)
01/20/2004 (12:48 am)
What I think happens is because the sound is 3D, stereo in the engine. Because of that, in 1st person, you are right in the middle of the point that is emitting 3D sound from. But the thing is, mostly at higher speeds, that particular point gets choppy just enough to make the sound go from left to right very fast (stereo). You can hear that clearly when using headphones. From that, there might be a better way to do it, but I made it so the sound is 3D in 3rd person and 2D in first person. When the sound is 2D, it is only for the controlling client. I've done it with the wheeled vehicles only, since we only use wheeled vehicles in our game. Other vehicles should be very similar to this:First, create another sound (ie. EngineSound2D) and another sound profile (ie. mEngineSound2D) in wheeledvehicle.h
Second, follow the mEngineSound in wheeledvehicle.cc and add mEngineSound2D including the addField etc. (the only place I didn't add the mEngineSound2D is in onNewDataBlock(GameBaseData* dptr) where we start the engine because it's fine to start the engine (only once!) in 3D and updateEngineSound will do the rest.)
Third, in updateEngineSound(F32 level) we need to make it so that only one engine sound will play and switch it depending if we're first person or not. should look like something like this:
if (mEngineSound || mEngineSound2D) {
if(!isFirstPerson()){
if(mEngineSound2D){
alxStop(mEngineSound2D);
mEngineSound2D = 0;
}
if(!mEngineSound)
mEngineSound = alxPlay(mDataBlock->sound[WheeledVehicleData::EngineSound], &getTransform());
alxSourceMatrixF(mEngineSound, &getTransform());
}
else{
if(mEngineSound){
alxStop(mEngineSound);
mEngineSound = 0;
}
if(!mEngineSound2D)
mEngineSound2D = alxPlay(mDataBlock->sound[WheeledVehicleData::EngineSound2D], &getTransform());
}
if(mEngineSound)
alxSourcef(mEngineSound, AL_PITCH, (level));
else if(mEngineSound2D)
alxSourcef(mEngineSound2D, AL_PITCH, (level));
}I just did that tonight, finding this thread before trying my code ;-p
ohhhh and fourth, don't forget to add enginesound2d = yournewaudioprofile2d; in your vehicle's datablock. And of course, make a new audioprofile accordingly, pointing to a 2D audiodescription :-)
Torque Owner Kirby Webber
I'm completely stumped.