Board index FlightGear Development New features

Thunder for the lightning?

Discussion and requests for new features. Please note that FlightGear developers are volunteers and may or may not be able to consider these requests.

Re: Cessna 172P detailed (was "Cockpit textures for the c172

Postby clrCoda » Sat Oct 31, 2015 2:12 am

Apparently openal has reverb. How easy or difficult this is to use I have no idea at this point.
Ray St. Marie
clrCoda
 
Posts: 1225
Joined: Wed Apr 07, 2010 12:04 pm

Re: Cessna 172P detailed (was "Cockpit textures for the c172

Postby clrCoda » Sat Oct 31, 2015 2:15 am

It might be possible to handle say like a global thundersound much like we hear AI/MP sounds. Exterior to the actual aircraft code.
Ray St. Marie
clrCoda
 
Posts: 1225
Joined: Wed Apr 07, 2010 12:04 pm

Re: Cessna 172P detailed (was "Cockpit textures for the c172

Postby Thorsten » Sat Oct 31, 2015 7:17 am

IMHO the sound should be like a real crack of thunder, the one crack, and that distance from that original instantaneous crack should reverberate. Like in the real world.


The real world has a way of being really complicated. I happened to come across a book describing the physics of thunderstorms and lightning recently, and the amount of stuff I did not know about the topic before was embarassing.

Reality starts with a (roughly cylindrical) shockwave emerging from the discharge channel. This is not a sound wave initially because it goes faster than speed of sound, but after a few meters it attenuates sufficiently to become one.

Even standing twenty meters from a lightning strike, you would hear rolling thunder, because the sound from the lower end of the channel reaches you basically now, whereas the upper end of the channel at the cloud base is perhaps some 500 meters away from you, and you would hear that sound with a delay (of course, it would be lower in volume, as it would have attenuated, and you'd be blinded and near-deaf anyway....)

Standing further away, the horizontal distance eventually becomes as much important as the vertical distance - this part is simple geometry.

Standing yet further away, it matters that sound propagates through the atmosphere differently dependent on density, in particular sound waves are systematically deflected away from the surface. This is the reason you can't hear lightning for more than 30 km distance - it doesn't attenuate that much, you could theoretically hear it, but the sound waves can't reach you - if you were in the air, you would hear the sound farther.

A lightning strike also isn't a simple event - there's the fanning out of forked channels from the cloud, then the upward strike of the main lightning bolt to meet them, a downward-racing re-ionization of the channel, another upward main bolt, can be a sequence of up to ten events - which also draws out the sound.

So what you hear is a function of geometry, distance and altitude not just in volume, but qualitatively, and you would actually need a few different sounds to do it justice.

Please note that the sounds in the atmosphere reverberate. Off of mountains, clouds, buildings, road surfaces.


I think we may leave clouds largely out of this list... But it's really not the main reason thunder rolls and is not a sharp crack - that is just different distance to the various elements of the discharge channel, leading to staggered arrivals of the sound waves.

It might be possible to handle say like a global thundersound much like we hear AI/MP sounds. Exterior to the actual aircraft code.


Some people (Erik included) seem to favour this solution, I frankly do not - what you can hear inside a cockpit depends on how sound-proof the cockpit is and what the ambient sounds are. In a single-prop GA plane, the noise level in the cockpit is extremely high when the engine is running (last time I did this, we had headsets on and could talk only via mike) - I doubt you'd hear any rumbling of distant thunder. Hanging beneath a hangglider, I you would on the other hand. The cockpit of the Space Shuttle is sound-proofed to the extend of damping the inferno of multiple rocket engines 30 meters away (which are still rather noisy from a mile away...) - I'm fairly sure if you're inside with the doors closed, you can't hear a thing of a thunderstorm.

So while it may be possible, I personally don't think it would be desirable. My opinion is that we should store the environment ambience sound files in a common location, but that they should be used aircraft-side because the aircraft developer knows best what can be heard in-cockpit.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Cessna 172P detailed (was "Cockpit textures for the c172

Postby Hooray » Sat Oct 31, 2015 11:52 am

http://sourceforge.net/p/flightgear/mai ... /34583131/
Erik wrote:I have to think this through for a bit but my first thought is to create
a new instance of SGSampleGroup for Environmental sounds and make it
possible for everybody to dynamically create sounds there.
But that's just a thought at the moment.

Erik
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Cessna 172P detailed (was "Cockpit textures for the c172

Postby gsagostinho » Sat Oct 31, 2015 12:06 pm

@all The main point here is that we are not trying to simulate a thunder sound in all its complexity by any means, we simply want to create a little "ear-candy" and that's all. As a matter of fact, I am doing my masters in music composition, and I am focused in particular in computer and algorithmic music. All my electroacoustic compositions are completely programmed (I normally use Pure Data). Once, for a research project of mine, I programmed in Pd a soundscape which contained thunder strikes and rain, and everything was done generatively: no two thunder strikes were identical. Everything was done also using simple noise generators, oscillators, filters and reverbs, and the result was pretty good. But do we really need something like this for a flight simulator? I would say no, a simple recorded sample is more than enough. It's again the same story as with our stall horn, which people wanted to be so detailed that we almost ended up programming a Stall Horn Simulator as opposed to a simple sound effect. And a stall horn is much more important for a flight sim than a thunder sound is! Onox, wlbragg and I are already trying to find ways to contour the limitation that I mentioned here and soon we will have proper simultaneous thunder sounds, regardless of any change in the source code. So I just ask a little bit of patience.

As for the ambient sounds, I am with Thorsten all the way: it should be defined by the aircraft developers.
User avatar
gsagostinho
 
Posts: 1806
Joined: Thu Jan 15, 2015 7:27 pm
Location: London, UK

Re: Cessna 172P detailed (was "Cockpit textures for the c172

Postby Hooray » Sat Oct 31, 2015 12:11 pm

Personally, I would be most interested in exposing an abstract API for registering/creating sound effects and associating those with "positions" in the simulated 3D world - not unlike the AI traffic system which is property-driven, and which can be accessed/controlled by Nasal (as per tanker.nas).

Otherwise, I do agree that there are many options for things to become really sophisticated - but the first step really is exposing a method for creating aircraft-agnostic sound effects that may be tied to different locations - and looking at the code, we already understand how to do that.

To access such a system from scripting space can either by accomplished by properties (analogous to the AI system), by fgcommands (analogous to Stuart's cloud interface) or through Nasal/CppBind (least amount of work obviously): http://wiki.flightgear.org/Nasal/CppBind
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Cessna 172P detailed (was "Cockpit textures for the c172

Postby erik » Sat Oct 31, 2015 12:26 pm

gsagostinho wrote in Sat Oct 31, 2015 12:06 pm:As for the ambient sounds, I am with Thorsten all the way: it should be defined by the aircraft developers.


Another way I was thinking at is to let FlightGear handle the sound generation but let aircraft developers influence the sound properties like (change in) volume.
Current: Parachutist, Paraglider, Pterosaur, Pilatus PC-9M and variants, ERCO Ercoupe, Fokker Dr.1, Fokker 50, Fokker 100
Less active: Cessna T-37, T-38, Santa Claus. Previous: General Dynamics F-16. Worked on: Wright Flyer
erik
 
Posts: 2245
Joined: Thu Nov 01, 2007 2:41 pm

Re: Cessna 172P detailed (was "Cockpit textures for the c172

Postby gsagostinho » Sat Oct 31, 2015 12:31 pm

erik wrote in Sat Oct 31, 2015 12:26 pm:
gsagostinho wrote in Sat Oct 31, 2015 12:06 pm:As for the ambient sounds, I am with Thorsten all the way: it should be defined by the aircraft developers.


Another way I was thinking at is to let FlightGear handle the sound generation but let aircraft developers influence the sound properties like (change in) volume.


Oh, that's clever! So they would have default parameters for aircrafts which did not define them, and then follow specific values when they are defined, right? If you want, we could discuss about using our sounds and code from the c172p for this idea. I think our rain and rain in the windshield sounds are quite good, and the thunder implementation is almost done as well.

For those interested, here is where we are working on these sounds (warning: huge thread): https://github.com/Juanvvc/c172p-detailed/issues/443

@Erik I will mention this idea to onox, as he is the most knowledgeable one of us regarding basically anything 8)
User avatar
gsagostinho
 
Posts: 1806
Joined: Thu Jan 15, 2015 7:27 pm
Location: London, UK

Re: Cessna 172P detailed (was "Cockpit textures for the c172

Postby Hooray » Sat Oct 31, 2015 12:55 pm

the approach mentioned by onox should work fairly well - and I agree that he actually looked at the underlying C++ code in SimGear - however, anybody implementing the scripting layer for this, should definitely NOT be using settimer() but use the maketimer() wrapper instead.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Cessna 172P detailed (was "Cockpit textures for the c172

Postby erik » Sat Oct 31, 2015 2:14 pm

gsagostinho wrote in Sat Oct 31, 2015 12:31 pm:Oh, that's clever! So they would have default parameters for aircrafts which did not define them, and then follow specific values when they are defined, right?

Exactly.

Erik
Current: Parachutist, Paraglider, Pterosaur, Pilatus PC-9M and variants, ERCO Ercoupe, Fokker Dr.1, Fokker 50, Fokker 100
Less active: Cessna T-37, T-38, Santa Claus. Previous: General Dynamics F-16. Worked on: Wright Flyer
erik
 
Posts: 2245
Joined: Thu Nov 01, 2007 2:41 pm

Re: Cessna 172P detailed (was "Cockpit textures for the c172

Postby Hooray » Sat Oct 31, 2015 3:14 pm

like onox mentioned on github, it would make sense to look at this unrelated to weather effects - i.e. like Erik said: come up with another instance of an "fx" sound system where sounds and effects can be registered, along with virtual "positions" in the simulated 3D world - not unlike the view manager, which also supports absolute and relative view positions.

After all, there are many other scenarios that would benefit from being able to use such a sound system, entirely unrelated to weather effects - e.g. think about AI traffic or virtual AI nodes.

The AI/MP code can be used as a template to see how the system needs to be modified in order to support not just static positions, but also dynamic/moving ones.

Basically, you would end up with a manager subsystem where sounds/effects could be registered, along with "placements" for instances of those - analogous to how a Canvas texture can be positioned arbitrarily using the notion of "virtual placements", all of which are using the same underlying texture - but each placement (instance) can still be independently adjusted.

Once such a system is accessible from scripting space, it is foreseeable that people will use this for implementing tons of new ideas, without any of those necessarily being specific to weather effects (thunder).
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Cessna 172P detailed (was "Cockpit textures for the c172

Postby punkepanda » Sat Oct 31, 2015 3:24 pm

Yes it was something like that I was thinknig about yesterday.. Need something to access sound packages from xml/script place so any aircraft developer can access it easily. If aircraft developers want to have specific sounds they can also implement it as addon.
punkepanda
 
Posts: 234
Joined: Mon Nov 04, 2013 10:11 pm
Callsign: LostFlight
Version: 2.12
OS: Arch Linux

Re: Cessna 172P detailed (was "Cockpit textures for the c172

Postby Hooray » Sat Oct 31, 2015 3:29 pm

first of all, you need a generic system that exposes the corresponding functionality, regardless of the concrete manifestation/use-case (weather/thunder effects) - and then, this can be used by others wanting to do related stuff.

As long as the interface works via properties (fgcommands and/or a dedicated SGSubsystem/SGPropertyChangeListener mapped onto the property tree), it is perfectly accessible from scripting space.

And existing subsystems implementing the logic for mapping writes to /models and /ai or /canvas to their corresponding C++ APIS, demonstrate fairly well that this is the most future-proof mechanism to expose APIs in a generic fashion.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Cessna 172P detailed (was "Cockpit textures for the c172

Postby punkepanda » Sat Oct 31, 2015 3:46 pm

Exactly.. Could not agree more.. Pure logic!
punkepanda
 
Posts: 234
Joined: Mon Nov 04, 2013 10:11 pm
Callsign: LostFlight
Version: 2.12
OS: Arch Linux

Re: Cessna 172P detailed (was "Cockpit textures for the c172

Postby gsagostinho » Sat Oct 31, 2015 3:54 pm

@erik @Hooray @Thorsten I forwarded this discussion to onox and we will see what we can do to help with that, okay? Maybe some of our sounds and code could already serve as a base for such an effort.
User avatar
gsagostinho
 
Posts: 1806
Joined: Thu Jan 15, 2015 7:27 pm
Location: London, UK

PreviousNext

Return to New features

Who is online

Users browsing this forum: No registered users and 4 guests