c172p-team / c172p

A high detailed version of the Cessna 172P aircraft for FlightGear
GNU General Public License v2.0
79 stars 44 forks source link

Improve stall horn sound #85

Closed gilbertohasnofb closed 9 years ago

gilbertohasnofb commented 9 years ago

improve stall horn sound, use this as reference: https://www.youtube.com/watch?v=4tLWIvnVnCQ#t=42

onox commented 9 years ago

I'm trying this right: log((aero/alpha-deg - 13.63 + 0.5) * 2.0) for the volume.

onox commented 9 years ago

@dany93 I'll push a commit for you to test in a minute.

onox commented 9 years ago

Ok. See branch bug-85.

onox commented 9 years ago

@dany93 Note that currently the pitch is shifted linearly between 0.9 and 1.1. But in the video from https://github.com/Juanvvc/c172p-detailed/issues/117#issuecomment-112844657 there's a sudden increase in pitch, so we should use a <table> with <tableData>.

dany93 commented 9 years ago

I have no alarm sound. Is it normal? I can only look at /sim/alarms/stall-warning =

onox commented 9 years ago

Did you get branch bug-85?

dany93 commented 9 years ago

I did git fetch upstream then git checkout bug-85

onox commented 9 years ago

I have a fix. Pushed.

dany93 commented 9 years ago

What should I do to refresh my download?

gilbertohasnofb commented 9 years ago

@onox do you still need the angles from that video or the information @dany93 gave you is already enough? Let me know because I am back home now.

onox commented 9 years ago

@dany93 git pull upstream bug-85?

onox commented 9 years ago

@gilbertohasnofb That would be nice.

gilbertohasnofb commented 9 years ago

Okay, will do that!

dany93 commented 9 years ago

@onox It seems good. But I'm not a reference, I have never heard a stall warning apart from in FG....

Sorry, I will have to leave.

onox commented 9 years ago

I have another commit that uses <tableData>. Pushed.

onox commented 9 years ago

@gilbertohasnofb When you watch this video at 0:12 https://www.youtube.com/watch?feature=player_detailpage&v=CbtG8KHeMak#t=12 you'll hear the horn is growling a bit. Can you create such a second to a separate .wav file?

onox commented 9 years ago

And please pull latest bug-85, then you'll the see in the latest commit the <tableData> I'm using.

gilbertohasnofb commented 9 years ago

Can you create such a second to a separate .wav file?

I will try!

onox commented 9 years ago

Hopefully that second sound can make the stall horn sound more organic, and less electronic.

onox commented 9 years ago

@tigert Is the location of the stall horn near the wind shield to the left of the pilot? I thought I read something like that lately here.

gilbertohasnofb commented 9 years ago

@onox have a look on the discussion about how the horn works in https://github.com/Juanvvc/c172p-detailed/issues/117#issuecomment-112837134; the consensus is that it's a mechanical device on the wing, so the sound should come from the left

onox commented 9 years ago

I have updated the position of the stall horn.

gilbertohasnofb commented 9 years ago

I measured the angles in that video at three different positions when the sound pitch changes:

0:00 seconds - pitch 1 - 19.31 degrees 0:05 seconds - pitch 2 - 23.86 degrees 0:08 seconds - pitch 3 - 27.93 degrees

And now I will start working on that new sound you asked, onox.

onox commented 9 years ago

Hmm... not sure that we can handle a difference of about 8 degrees because of the stall near the alpha limit. The range is probably shorter than the video suggest. This is what I currently have:

<table>
    <independentVar>aero/alpha-deg</independentVar>
    <tableData>
        13.6364    0.9
        15.0000    0.9
        15.0428    1.0
        16.0000    1.0
        16.0428    1.1
    </tableData>
</table>
gilbertohasnofb commented 9 years ago

@onox about the new sound, I didn't have the time to deal with it today, I'm so sorry. I hope I will have it by tomorrow, okay?

wkitty42 commented 9 years ago

@dany93

we can then calculate (or fake) the speed of the air through the reeds or valves... that speed will determine the pitch of the note..

How?

this was in response to my thoughts about having the air pressure values from two points on the wing... the idea is (was?) that one of those points would be the low pressure ""trigger"" area of the stall horn (ie: the leading wing edge where you suck to test the horn)... the other point would be the high pressure area of the stall horn.. that's the area where the air enters the horn assembly... once we have those two values, it should be a simple matter of subtracting them to get the ""strength"" of the difference in the two points...

in normal flight, these two numbers should be equal or very close to equal so their subtractive value would be very close to zero... have to see if we can find them and then gather the values... at a low stall AoA, these two numbers should be slightly larger then in normal flight... that will increase the value of subtracting them... as the stall gets worse and the AoA increases, the values will grow further apart which will increase their subtractive value... if we use this value, with a lower limit number, to indicate when a stall is starting, then the low value can be used to start the stall horn at a low pitch and volume... as the stall increases and the number grows larger due to the difference in air pressure between the two points, we increase the pitch of the sound as well as increasing the volume...

i'm imagining having only one sound file that sounds like a low pitch raspy gravelly kazoo sound... with the number increasing, we have the sound system playing the same sound but increasing the pitch which will make it higher in note and we also have the sound system increase the volume... we keep doing this up to an upper limit value where the sound is at its highest pitch tone and volume...

by the same token, as we recover from the stall, the air pressure differences between the two points gets smaller and smaller which would cause our sound to start reducing its tonal pitch and volume all the way back till we return to normal flight and the values are below our lower limit...

this is all based exactly on the descriptive texts i've read on how reed and valve stall horns work... in a stall the lower pressure on the front of the wing leading edge allows the air to enter through the stall horn scoop, pass through the reeds or valve, and exit at the leading edge of the wing... that's why you suck on the hole at the front of the wing... you create low pressure and the normal pressure just brings the air on through...

PS: sorry, too, if this is wordy... it has been a long day and we're just starting to see the end of the recovery after our modem was zapped in a storm at 0500 this morning... we weren't able to find a replacement and get it online until ~1500... these last four hours have been very hectic, trying and tiring... i do hope the above is clear enough in explanation... it would be good to be able to find these values or something like them... the sim knows when we're stalling so we may just have to find that/those value/values that it uses and work from there... i believe the idea is sound... it works in real life... the existing stall horns are proof of that :wink: :smile_cat:

onox commented 9 years ago

@wkitty42 The only information that JSBSim has is the current alpha and the alpha limit. See https://github.com/Juanvvc/c172p-detailed/issues/85#issuecomment-113135864

I've changed the computation of the volume to be less linear. You try it yourself by doing git checkout bug-85.

about the new sound, I didn't have the time to deal with it today, I'm so sorry. I hope I will have it by tomorrow, okay?

Sure, no worries @gilbertohasnofb.

onox commented 9 years ago

@dany93 Could you take a look at the current code in branch bug-85 and give suggestions if things need to be improved?

wkitty42 commented 9 years ago

YAY!! i found the numbers i was looking for! the ones we can use to vary the pitch of the stall horn as well as the volume... i found a commit log showing when "/sim/alarms/stall-warning" was changed from a boolean to a double but i can't find it again... anyway, that was one of the triggers for me to log the output from that property to see what it was and when... it is zero until we enter a stall state and then it fluctuates depending on the severity of our stall... this is the number i've been trying to come up with! i just need a kazoo sound and someone to show me how to do the pitch changes with the sound system so that i can feed the stall-warning value to the pitch modifier... then we'll have our stall horn like it acts IRL... once that's working, we only need to tweak it for accuracy but it'll be much better than trying to change sounds at different AoA or speeds and such :wink: :angel:

onox commented 9 years ago

And guess what /sim/alarms/stall-warning uses as input... AoA! See https://github.com/Juanvvc/c172p-detailed/issues/85#issuecomment-113135864

wkitty42 commented 9 years ago

@onox i didn't understand that when i read it... the variable names didn't mean anything to me at that time... i thought AoA was only about the angle and not about stalling... you can have a high AoA without stalling, can't you? or, wait... AoA is along your direction of travel... hummm... ok...

in that comment above, you say that the volume is controlled by AoA... can we do the same with the pitch of the sound? are you already working on doing that or is it already available and i'm reinventing the wheel? admittedly i am learning some of the internals but the class has just barely been started :wink: :laughing:

onox commented 9 years ago

i'm reinventing the wheel? admittedly i am learning some of the internals but the class has just barely been started

Yes, you're a bit reinventing the wheel. See branch bug-85.

wkitty42 commented 9 years ago

i haven't played with that branch yet... not since i've been working on this for the last 4 days or so... i will try to take a look at it, though... one thing in my testing that i've found is that using that stall-warning value doesn't seem to be working as i had hoped it would... it seems to be too slow on the count... i mean, i'm at 300 feet with an airspeed of ~42 kts (indicated.. not sure about ground speed) and a incline of ~13 degrees and before i start to hear the horn but i'm starting to fall out of the sky...

either way, i'm probably going to continue to work on this for my own satisfaction and learning...if you guys want it when i get it done, great... if not, oh well...

dany93 commented 9 years ago

https://en.wikipedia.org/wiki/Angle_of_attack https://www.youtube.com/watch?v=5wIq75_BzOQ

onox commented 9 years ago

@gilbertohasnofb Do you know if the core devs have made a final decision about (dis)allowing CC-BY sound files? (So we can have a loopable variant of the original stall sound)

gilbertohasnofb commented 9 years ago

No, they didn't.... I am also waiting for it, but that thread is just getting bigger and bigger everyday without anything being decided. But given that there seems to be no consensus there by any mean, my guess is that they will settle for not changing anything, meaning no CC-BY. I will update you all about it once that discussion is over.

onox commented 9 years ago

I'll ask then.

onox commented 9 years ago

@gilbertohasnofb I think we have a green light for a loopable variant of the original stall horn sound:

So, my apologies for causing confusion, and in particular to the c172p-detailed team. I'll get their CC-BY sounds committed as soon as possible,

I'll also include this information (along with Edward's suggestion of a link to the GNU compatible license page) in the next draft of the Policy document.

Best regards,

-Stuart

gilbertohasnofb commented 9 years ago

@onox new looped stall sound already uploaded to branch bug-85! Same name as before: stall2.wav. I also removed the scratches layer from OH-CTL and ZS-MDF liveries and those have been uploaded directly to master. Hope that now everything is settle :smile:

onox commented 9 years ago

@gilbertohasnofb Can you update the Thanks file? Please copy, edit and use the file from the master branch.

gilbertohasnofb commented 9 years ago

@onox But the Thanks file at bug-85 is the most recent one, I already updated it. It should overwrite the Thanks file automatically once we merge this branch.

onox commented 9 years ago

In master branch you have written for the parking brake and trim sounds: "which kindly allowed it to be used under under the CC0 license".

Should I use https://github.com/Juanvvc/c172p-detailed/blob/bug-85/Thanks or https://github.com/Juanvvc/c172p-detailed/blob/master/Thanks ? Because currently the two file are conflicting.

gilbertohasnofb commented 9 years ago

You are right, onox. In the end it doesn't really matter since we have been allowed to use CC-BY files, but I updated the file on the branches bug-85 and master (so they shouldn't conflict any more) and I will paste those authorizations in the forum thread (something the devs recommended me to do).