Supersonic Audio

11 Mar 2020 02:23 #45416 by Algernon
I've knocked up a script to do supersonic audio and sonic booms, just over MP at the moment.

The following user(s) said Thank You: timi

Please Log in or Create an account to join the conversation.

11 Mar 2020 06:45 #45417 by timi
The following user(s) said Thank You: Algernon

Please Log in or Create an account to join the conversation.

11 Mar 2020 07:52 #45418 by StuartC
thats way better than what we have

Please Log in or Create an account to join the conversation.

11 Mar 2020 09:09 #45419 by enrogue
Fantastic!

Please Log in or Create an account to join the conversation.

11 Mar 2020 09:28 #45420 by Algernon
Thanks for the kind words! The good news is, it's surprisingly easy to add to an aircraft. I'll post the code in a little while in case you want to try it on something.

The bad news is, it's easily rendered less impressive by the silly doppler problem. I did see somewhere that you can compile FlightGear to use a different audio engine which has accurate doppler - but damned if I can now find the page I read. I wondered if it might be worth a little play with...

Please Log in or Create an account to join the conversation.

11 Mar 2020 09:40 - 11 Mar 2020 09:51 #45421 by Algernon
This code goes in the Nasal section of the base model file:
var root = cmdarg();

### Sonic Boom ###
	var mach_node = root.getNode("sim/multiplay/generic/float[12]",1);
	var sb_base = root.getNode("sim/sound/supersonic",1);
	var supersonic = sb_base.getNode("supersonic",1);
	supersonic.setBoolValue(0);
	var sb_range = sb_base.getNode("range-m",1);
	sb_range.setDoubleValue(0);
	var sb_bearing = sb_base.getNode("bearing-deg",1);
	sb_bearing.setDoubleValue(0);
	var sb_vector = sb_base.getNode("vector-deg",1);
	sb_vector.setDoubleValue(0);
	var in_cone = sb_base.getNode("in-cone",1);
	in_cone.setBoolValue(0);
	var sb_trigger = root.getNode("sim/sound/triggers/sonic-boom",1);
	sb_trigger.setBoolValue(0);
	var sb_vol = root.getNode("sim/sound/supersonic/volume",1);
	sb_vol.setDoubleValue(1);
	var ac_geo = geo.Coord.new();
	var aclat_node = root.getNode("position/latitude-deg");
	var aclon_node = root.getNode("position/longitude-deg");
	var acalt_node = root.getNode("position/altitude-ft");
	
    var cone_angle = 88;
	
	var sb_loop = func {
	     mach = mach_node.getValue();
		 ac_geo.set_latlon( aclat_node.getValue(),aclon_node.getValue(),acalt_node.getValue());
		 var pl_geo = geo.aircraft_position();
		 sb_range.setDoubleValue( pl_geo.distance_to(ac_geo) );
		 sb_bearing.setDoubleValue( pl_geo.course_to(ac_geo) );
		 var ac_hdg = root.getNode("orientation/true-heading-deg").getValue();
		 sb_vector.setDoubleValue( sb_bearing.getValue() - ac_hdg );
		 var x = geo.normdeg180(sb_vector.getValue());
		 var vol = ( 1 - mach ) * 10 ;
		 if ( x > ( cone_angle * -1 ) and x < cone_angle ) {
		     in_cone.setBoolValue(1);
			}
		 else {
		     in_cone.setBoolValue(0);
			 sb_vol.setDoubleValue(vol);
			}
		 if ( mach >= 1 ) {
		     supersonic.setBoolValue(1);
			 if ( in_cone.getBoolValue() ) {
			     sb_boom(0);
				}
			}
		 else {
		     supersonic.setBoolValue(0);
			}
		 
		}
	
	sb_boom = func(delay) {
	     if ( sb_trigger.getBoolValue() ) { return }
		 sb_trigger.setBoolValue(1);
		 settimer( func { sb_vol.setDoubleValue(1) } , 0.3);
		 settimer( func { sb_trigger.setBoolValue(0) } , 10);
		}
	
	var sb_timer = maketimer(0.1,sb_loop);
	sb_timer.start();

Then add this volume block to each every MP sound:
<volume>
    <property>sim/sound/supersonic/volume</property>
    <factor>1</factor>
    <offset>0</offset>
   </volume>

It reduces the volume as the aircraft moves through the transonic range, then bangs it back once the viewer is overtaken by the wavefront.

It's a really basic implementation at the moment, and is just the start point - it behaves well in flybys, but I suspect it won't be so good if you're following an aircraft. Going to try a test now.

Please Log in or Create an account to join the conversation.

11 Mar 2020 09:45 - 11 Mar 2020 10:04 #45422 by enrogue
It's AeonWave, which is actually developed by one of the FG devs - you can find it at adalin.com, from memory it's on github as well as being able to grab it from adalin

Not sure how the build process works - it's referred to as AAX in the source

Looking at cmake, the variable to use is

USE_AEONWAVE="true" (so set a boolean)

then it will want you to point it at the place where it's installed with AAX_INCLUDE_DIR (it automatically looks where OSG is installed) and probably also AAX_LIBRARY

EDIT: quick update - as soon as you install AeonWave & run cmake in windows, it finds it, building next now

Please Log in or Create an account to join the conversation.

11 Mar 2020 10:09 - 11 Mar 2020 10:09 #45423 by Algernon
Thanks! I'm a bit daunted doing that for my first time compile, perhaps I'll work up to it if I'm finding the doppler thing really problematic. One thing it definitely screws up is high-level booms being heard on the ground. The undesirable pitch up effect reduces it to a fingersnap.

Please Log in or Create an account to join the conversation.

11 Mar 2020 10:30 #45424 by enrogue
I could compile for you - simgear reports one failure on the aeonwave test unit, but otherwise ok. fligtgear compiled just fine

It would just be a replacement fgfs.exe binary I think, you'll probably need to install aeonwave as well

Please Log in or Create an account to join the conversation.

11 Mar 2020 10:42 #45425 by Algernon
Wow, that would be great - thanks very much! I'll look into installing aeonwave...do I need to know a path that the compiled .exe will look for?

Please Log in or Create an account to join the conversation.

11 Mar 2020 11:40 #45426 by enrogue
I've no idea to be honest about paths - just install it to the defaults & it should be ok I guess

What version of FG do you want? 2019.1.2?

Please Log in or Create an account to join the conversation.

11 Mar 2020 12:30 #45427 by Algernon
Yes please :)

Please Log in or Create an account to join the conversation.

11 Mar 2020 12:31 - 11 Mar 2020 12:32 #45428 by Algernon

Please Log in or Create an account to join the conversation.

11 Mar 2020 12:54 #45429 by enrogue
That rocks!

Please Log in or Create an account to join the conversation.

11 Mar 2020 13:18 #45430 by eagle12
I think this is a replay from the flight-recorder, you have only one afterburner.
Add this in the lightningT5-yasim-set.xml at the flight-recoder and you have two afterburner in the replay.
Compare it with your lightningT5-yasim-set.xml.

<flight-recorder>
<replay-config type="int">0</replay-config>
<config n="0" include="/Aircraft/Generic/flightrecorder/generic-jet.xml">
<name type="string">EE-Lightning Flight Recorder</name>
<signal>
<type>float</type>
<property type="string">/sim/multiplay/generic/float[2]</property>
</signal>
<signal>
<type>float</type>
<property type="string">/sim/multiplay/generic/float[3]</property>
</signal>
</config>
</flight-recorder>


And please change in the lightningT5-yasim-set.xml at the aero line a small letter for the lightning, because on linux the Lightning does not work when you have in the set.xml a capital letter when the set.xml file begin with a small letter.

I am the only one who have linux?

By the way nice work !!!

Please Log in or Create an account to join the conversation.

11 Mar 2020 13:33 #45431 by Algernon
Done :)

Please Log in or Create an account to join the conversation.

11 Mar 2020 13:46 #45432 by Algernon
You can get this updated development version - appears to be stable - from our GitHub, will update the Drive soon too: gitlab.com/FGUK/aircraft/EE-Lightning

Please Log in or Create an account to join the conversation.

11 Mar 2020 14:08 #45433 by eagle12
Wow Algy you very fast !!! Whats going on her? :)

I take my hat off to you (a German saying or Stuart say that was a Kraut saying :P ), maybe you understand that the fiiiirst part, hello ?

Please Log in or Create an account to join the conversation.

11 Mar 2020 14:52 #45435 by Algernon
I'm having a bit of FlightGear dev time, which I don't often get, so while I had the files open it was easy :)

Please Log in or Create an account to join the conversation.

11 Mar 2020 15:22 #45437 by eagle12
The linux user say, thank you thank you so much.:cheer:

Fly me to the moon
Let me play among the stars
Let me see what spring is like
On a, Jupiter and Mars .....

No one knows the song or what ?

Please Log in or Create an account to join the conversation.

Time to create page: 0.336 seconds
Powered by Kunena Forum

Latest Forum Posts

PM Notifications

You are not logged in.

PM Mailbox

You are not logged in.

Latest updated downloads