Yesterday we trawled through some online video, ripped the soundtracks and used Audacity to get some loops of the compressor, and rotor beat. That's two discrete sounds that when mixed together should give a good representation of helo noise. Using Audacity it's possible to mark a region, and use that as a 'sample' to remove that noise from another. So we took some of the compressor/engine noise and removed (or reduced) this by around 16db from the rotor noise.
Next task is to add these two looped audio sample sources to the CH47 model script. As we want all instances of the CH47 to use there we'll add them at class level....
local class=CreateClass(...)
class.soundcompressor = LoadSound("abstract::ch47_compressor_loop.ogg")
class.soundrotors = LoadSound("abstract::ch47_rotor_loop.ogg")
The compressor noise can get on your nerves. We want to emphasise the rotor beat so we have set a volume ration of 1:2 between them. Setting the volume of the rotor loop to 1.0 and compressor to 0.5
function class:CreateObject(model) if class.soundcompressor~=nil then
object.source_compressor = object.model:EmitSound(class.soundcompressor,75,1,1)
SetSourceVolume(object.source_compressor,0.5);
end
if class.soundrotors~=nil then
object.source_rotors = object.model:EmitSound(class.soundrotors,250,1,1)
SetSourceVolume(object.source_rotors,1.0);
end
Note, LoadSound() returns a source which we need to store for later when we change volume and pitch. When the Rotor Speed is increased either by the AI pilot or engine/entity update, the blade flap function is called to update the relative positions of each blade. And here is a good place to update the audio for the blade thumping. It seems better to place it here than in the update/render which is called every frame. Here it only is updated on changes to the rotor state.
function object:BladeFlap()
local flapangle = 7 - (object.rotorspeed*0.6) + (object.bladeangle * 0.08)
local offset = 120
for i=0,1 do
if object.bladehinge[i]~=nil then
RotateEntity(object.bladehinge[i][0], Vec3(flapangle,0,0))
RotateEntity(object.bladehinge[i][1], Vec3(flapangle,-offset,0))
RotateEntity(object.bladehinge[i][2], Vec3(flapangle,offset,0))
offset = -offset
end
end
-- CHANGE AUDIO PITCH
SetSourcePitch(object.source_rotors,object.rotorspeed * 0.045)
end
local flapangle = 7 - (object.rotorspeed*0.6) + (object.bladeangle * 0.08)
local offset = 120
for i=0,1 do
if object.bladehinge[i]~=nil then
RotateEntity(object.bladehinge[i][0], Vec3(flapangle,0,0))
RotateEntity(object.bladehinge[i][1], Vec3(flapangle,-offset,0))
RotateEntity(object.bladehinge[i][2], Vec3(flapangle,offset,0))
offset = -offset
end
end
-- CHANGE AUDIO PITCH
SetSourcePitch(object.source_rotors,object.rotorspeed * 0.045)
end
We added additional code to turn on/off audio for static and parked helicopters. We can improve on this by introducing a "start-up" and "shutdown" state that will wind-up/down the compressor noise whenever the aircraft is flagged as "live" or "dormant".
Such a simple method that greatly adds a sense of weight and presence to an object. Here's a video of the result.
It sound really awesome, one question: the msn alert sound goes with the final release version? :)... you are doing a great job here, guys, can't wait to see the final work. cheers
ReplyDeleteGreat! Especially that distant sound is awesome.
ReplyDeleteYeah, it will come with the MSN alert. I was just telling Spac3Rat that we had some issues with the Apache cockpit at the time I was quickly recording the footage. So there was a lot of messaging this morning.
ReplyDeleteIt's not bad for a first try. My only gripe is how to swap out LUA loaded sound sources for cockpit interior versions. I'm sure there's a way of doing it.
I've got some nice movies of a Chinook landing about 30 meters in front of me during an exercise with some good sounds...Don't know if it's still usefull for you, if you'd want them, ask Spac3Rat for my msn/e-mail!
ReplyDeleteKeep up the good work, can't wait till it's done :)