Is it possible to add sound to the movement of a servo to add realism in the TMD file ?
I'm thinking of the retracted landing gear or the canopy.
With the "soundlinear" object, I can apply a sound to the movement of a servo but it is not symmetrical.
Sound on servo movement
-
-
- Official Post
Yes but not out of the box if I remember correctly. Please try if the servo .OutputSpeed is possible or not, it might not be implemented but worth a check.
Manual way:
For each servo that you want to add a sound to you need a second servo with somewhat high speed that uses the first servo as an input. You then need to subtract the output of the first and second servo and are left with a small deviation when ever the first servo is currently moving. You then have to scale this small deviation with soundmappings to get the volume and pitch and feed that to your soundloop. -
thank you Jet-Pack
I tried OutputSpeed on inputId and VolumeID, but nothing works.
Only this example works, and it's not symmetrical. (Volume off in the center)<[int32][sound][1]
<[string8][object][soundlinear]
<[uint32][PositionID][Fuselage.R]>
<[uint32][VelocityID][Fuselage.V]>
<[uint32][InputID][ServoLinearTest.Output]>
//<[uint32][VolumeID][ServoLinearTest.Output]>
<[string8][SoundFile][electric02.wav]>
<[float32][InputMin][0.0]>
<[float32][InputMax][1.0]>
<[float32][VolumeMin][0.0]>
<[float32][VolumeMax][1.0]>
<[float64][FrequencyMin][0.5]>
<[float64][FrequencyMax][1.5]>
<[float64][VolumeOffset][0.0]>
<[float64][VolumeModulation][1.0]>
>
> -
I also read that it's possible to add a sound to the wheels rolling.
Skidding and high-speed wheel rotation sounds for the A350 in Aerofly FS.
Is it possible to implement this in Aerofly RC?
-
- Official Post
Try using the mixlinear instead
Pseudo code:
Dynamics
Servo1
Servo2 with Input Servo1.Output
mixlinear DifferenceServo1And2
output DifferenceServo1And2Sound
input DifferenceServo1And2
soundmapping VolumeServo1
sound_loop...If the wheel rotation speed is available then you can use that as a sound. Check if any graphics part actually uses the wheel rotation speed but I don't think that is used in Aerofly RC, only in Aerofly FS.
-
Sorry, i can't find any information on how to implement "soundmapping" and "sound_loop" in the wiki.
Code
Display More//Servo Rudder Sound <[string8][object][servolinear] <[string8][Name][ServoRudderSound1]> <[string8][Input][ServoRudder.Output]> <[float64][OutputSpeed][2.0]> <[float64][Position][1]> <[float64array][InputPosition][ 0 1 ]> <[float64array][OutputPosition][ 1 0 ]> > <[string8][object][servolinear] <[string8][Name][ServoRudderSound2]> <[string8][Input][ServoRudderSound1.Output]> <[float64][OutputSpeed][20.0]> <[float64][Position][1]> <[float64array][InputPosition][ 0 1 ]> <[float64array][OutputPosition][ 1 0 ]> > <[string8][object][mixlinear] <[string8][Name][MixServoRudderSound]> <[string8][Input0][ServoRudderSound1.Output]> <[string8][Input1][ServoRudderSound2.Output]> <[float64][Weight0][0.050000]> <[float64][Weight1][-0.950000]> <[float64][Offset][0.00000]> >
-
- Official Post
To make your mixlinear output value available in the sound you need to add an output object:
Code<[string8][object][output] <[string8][Name][MixServoRudderSoundOutput]> <[string8][Input][MixServoRudderSound.Output]> >In the sound section you can read in that value with the soundinput object:
Code<[string8][object][soundinput] <[string8][Name][MixServoRudderSound]> <[uint32][InputID][MixServoRudderSoundOutput.Output]> >The soundloop isn't used all that much in Aerofly RC but here are a couple of aircraft/helicopters that do use it:
blade700x, dr1micro, goblin700, soxos600, 700 and 800.
Here is an example code snippet from the goblin700
Code
Display More<[string8][object][soundinput] <[string8][Name][RotationSpeed]> <[uint32][InputID][Engine.RotationSpeed]> > <[string8][object][soundmapping] <[string8][Name][RPMPitch]> <[string8][Input][RotationSpeed.Output]> <[tmvector2d][Map][ (0.0 0.2) (1400.0 0.9) (1900.0 1.3) (4000.0 2.0) ]> > <[string8][object][soundmapping] <[string8][Name][RPMVolume]> <[string8][Input][RotationSpeed.Output]> <[tmvector2d][Map][ (0.0 0.0) (900.0 0.1) (1400.0 0.2) (1900.0 0.2) (4000.0 0.2) ]> > <[string8][object][soundloop] <[string8][Name][RPMLoop]> <[string8][InputVolume][RPMVolume.Output]> <[string8][InputPitch][RPMPitch.Output]> <[uint32][PositionID][Fuselage.R]> <[uint32][VelocityID][Fuselage.V]> <[string8][SoundFile][goblin700_high.wav]> >The soundinput reads the value from the physics and makes it available in the sound secion
The soundmapping is a list of value pairs:
The x component is the input,
The y component is the output at that input value
So for the RPMVolume in the example above the volume is zero when the rotation speed is 0.0 or below. When the rotation speed reaches 1400 rad/s then the output volume is 0.2 or 20%. Values in between are interpolated linearly.The RPMPitch in the example rises up with increasing RPM, where the pitch is the playback speed, 1.0 or 100% would play the sound file at original speed. 0.2 plays it at 20% or very slowly at low pitch. 2.0 or 2x speed is reached when the rotation speed reaches 4000 rad/s.
Note: 1.0 RPM = 0.10471975512 rad/s <=> 1.0 rad/s = 9.549296585514 RPM
You can also use a soundmultiply object to multiply two mappings together in the sound section. This is good to combine two conditions that have to be met at the same time, for example in a sideslip AND at high speed or in this case when blade angle of attack is high AND rotation speed is high.