An in-game microphone effect?
by Daniel Buckmaster · in Torque Game Engine · 11/06/2008 (12:59 pm) · 4 replies
Searching for this is basically useless, because every time I search for 'microphone' I get results about actual microphones. What I'm looking for is an in-game microphone. I doubt this has ben done before, but I'd like to know if it's even possible.
The idea is for a microphone to be attached to a speaker. The speaker, as youwould expect, plays any sounds picked up by the mic in the game simulation. Sort of like rendering transform portals, but for sound. I would use this for an in-game radio system. My first thought about radios was simply for them to transmit voices, but I figured it would be a whole lot better if they transmitted all the background noise as well (gunfire, explosions, etc.).
Maybe this idea is a little ambitious - I'm perfectly ready to accept that. I'll just brood on it until I can implement it in the game's sequel using TGEA ;D (yes, of course, I've already planned that far ahead... :P)
The idea is for a microphone to be attached to a speaker. The speaker, as youwould expect, plays any sounds picked up by the mic in the game simulation. Sort of like rendering transform portals, but for sound. I would use this for an in-game radio system. My first thought about radios was simply for them to transmit voices, but I figured it would be a whole lot better if they transmitted all the background noise as well (gunfire, explosions, etc.).
Maybe this idea is a little ambitious - I'm perfectly ready to accept that. I'll just brood on it until I can implement it in the game's sequel using TGEA ;D (yes, of course, I've already planned that far ahead... :P)
About the author
Studying mechatronic engineering and computer science at the University of Sydney. Game development is probably my most time-consuming hobby!
#2
The pro solution would be to make each radio a 'listener' type thing in the audio environment, like the camera is. Each time the radio updates, I set the OAL listener matrix to its position, etc., and then somehow records the sound. Then it sends this to the speaker object, which plays the sound. It's kind of the way voice chat works - the physical microphone picks up speech, which is encoded and sent across the network, and then played in someone else's speakers.
The toughest part of this apperoach, I'm pretty sure, would be the messing with the OAL environment and stuff. 1. I don't know whether sounds play on the server. 2. If not, then it's going to be a heck of a lot of work to shoehorn this into the client-side game, where only 16 sounds are playing at a time. 3. I don't fully understand how the audio system works anyway.
The other way, which is far simpler, is just to have characters directly interface with the radio when they speak. So you'd have a %player.speakIntoRadio(%radio) method which just transfers all their speech into the radio, which then sends this to the speakers.
Your method seems to be a sort of halfway between these, if I'm reading you right.
11/08/2008 (2:59 am)
Yeah, I was wondering about the optimisation side of things. I'm guessing that adding searches when a sound is playing is going to be very expensive, and quite a lot of stuff to add. As long as I'm adding lots of stuff, I'd prefer to make the solution as natural and integrated as possible. I had two ideas - one high-end, and one budget.The pro solution would be to make each radio a 'listener' type thing in the audio environment, like the camera is. Each time the radio updates, I set the OAL listener matrix to its position, etc., and then somehow records the sound. Then it sends this to the speaker object, which plays the sound. It's kind of the way voice chat works - the physical microphone picks up speech, which is encoded and sent across the network, and then played in someone else's speakers.
The toughest part of this apperoach, I'm pretty sure, would be the messing with the OAL environment and stuff. 1. I don't know whether sounds play on the server. 2. If not, then it's going to be a heck of a lot of work to shoehorn this into the client-side game, where only 16 sounds are playing at a time. 3. I don't fully understand how the audio system works anyway.
The other way, which is far simpler, is just to have characters directly interface with the radio when they speak. So you'd have a %player.speakIntoRadio(%radio) method which just transfers all their speech into the radio, which then sends this to the speakers.
Your method seems to be a sort of halfway between these, if I'm reading you right.
#3
11/08/2008 (5:14 am)
If you use FMOD, you can just sample the current sound buffer into the buffer you're transmitting. But then again you'd get GUI sounds and all of those annoying ones too.
#4
11/08/2008 (6:07 am)
FMOD looks great, but I guess it would be a lot of work to replace OpenAL, and not the kind of thing I want to be focusing on :P. It's pretty cool that it's free for non-comm use, though...
Torque Owner Ben Versaw
Obviously this is over simplified but that's an idea you might start with.