• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Sound files related to airport ICAO code ?

Messages
97
Country
italy
Hi friends !
Would anyone know how to make a gauge that reproduces sounds choose a sound based on the airport where the user aircraft is actually parked ?

My requirement is this, let me explain better: I would like to make a simple panel gauge with 3 switches (A, B and C) connected to the reproduction of 3 different sounds (the user clicks on the switch A and the sound A starts, click on B and sound B starts, etc.). So far everything is simple.

However, I would like to make different sets of sounds, ie I would like to have the sound A, B and C for when the user is parked at EDDM, the sound A, B and C for when the user is parked at LEBL etc. I would therefore like to create different A-B-C sound sets, each for a different airport.

The user, once landed, should always click his three ABC keys in the cockpit but the gauge should figure out at which airport the user landed (reading the airport ICAO code) and choose which ABC set to play (EDDM A-B-C sound set, LEBL A-B-C sound set, etc).

Do you have any ideas I suggest on how I could solve this problem?

Thank you very much in advance for any suggestions you want to give me

Regards
Alby
 
Search for and download Bob McElrath's excellent fs9gps guidebook and have a look at NearestAirportCurrentIdent.
 
Finding your current airport ICAO is easy.
Code:
<Update Frequency="1">
    (A:GPS POSITION LAT, Radians) (>C:fs9gps:NearestAirportCurrentLatitude, Radians)
    (A:GPS POSITION LON, Radians) (>C:fs9gps:NearestAirportCurrentLongitude, Radians)
    1 (>C:fs9gps:NearestAirportMaximumItems)
    5 (>C:fs9gps:NearestAirportMaximumDistance, NMiles)
</Update>

But the rest of the code makes sense only if you want to work with a limited number of predefined airports.

Mouse callback:
Code:
<Click>
    (C:fs9gps:NearestAirportItemsNumber) 0 >
    if{
        0 (>C:fs9gps:NearestAirportCurrentLine)

        (C:fs9gps:NearestAirportCurrentIdent) 'EDDM' scmp 0 == if{ (* EDDM sound code... *) }
        (C:fs9gps:NearestAirportCurrentIdent) 'LEBL' scmp 0 == if{ (* LEBL sound code... *) }
        (* etc... *)

    }
</Click>
 
Search for and download Bob McElrath's excellent fs9gps guidebook and have a look at NearestAirportCurrentIdent.

Thank you chris, a very useful resource, i have downloaded and read the index. I have to try some examples...
 
Finding your current airport ICAO is easy.
Code:
<Update Frequency="1">
    (A:GPS POSITION LAT, Radians) (>C:fs9gps:NearestAirportCurrentLatitude, Radians)
    (A:GPS POSITION LON, Radians) (>C:fs9gps:NearestAirportCurrentLongitude, Radians)
    1 (>C:fs9gps:NearestAirportMaximumItems)
    5 (>C:fs9gps:NearestAirportMaximumDistance, NMiles)
</Update>

But the rest of the code makes sense only if you want to work with a limited number of predefined airports.

Mouse callback:
Code:
<Click>
    (C:fs9gps:NearestAirportItemsNumber) 0 >
    if{
        0 (>C:fs9gps:NearestAirportCurrentLine)

        (C:fs9gps:NearestAirportCurrentIdent) 'EDDM' scmp 0 == if{ (* EDDM sound code... *) }
        (C:fs9gps:NearestAirportCurrentIdent) 'LEBL' scmp 0 == if{ (* LEBL sound code... *) }
        (* etc... *)

    }
</Click>

Thank you Luka,
it seams you solve the problem, very good solution :-)
Now I have to deepen and understand your code (I have very little experience and knowledge in gauge development) but I understood the concept. Maybe if i use "ICAO region" instead of "ICAO airport code" (i mean for example ED-- or LE--) i can reduce the number of predefined items.
Anyway, thanks again for the suggestion
regards

Alby
 
Maybe if i use "ICAO region" instead of "ICAO airport code" (i mean for example ED-- or LE--) i can reduce the number of predefined items.

Strictly speaking - Region - the two character code - is going to be much more difficult because AirportRegion is not part of the fs9gps Airport ICAO. Instead, you would have to do a search on NearestIntersection, NearestVOR, or NearestNDB, return the fs9gps ICAO identifier, get into the respective Waypoint group via ICAO transfer (involves cycle skipping), then return the Region code. Even then, you're not going to be assured that the facility you searched on is always in the same Region as the airport you want. Bottom line - I wouldn't pursue that approach.

But it may be "good enough" to extract the first letter of the AirportIdent and use that as a proxy for Region. Take a look at the ssub command in the Wiki section to see how to extract the first letter. This won't always work because airport idents do not always start with the first letter of the Region, but it's easy to implement.

Bob
 
Strictly speaking - Region - the two character code - is going to be much more difficult because AirportRegion is not part of the fs9gps Airport ICAO. Instead, you would have to do a search on NearestIntersection, NearestVOR, or NearestNDB, return the fs9gps ICAO identifier, get into the respective Waypoint group via ICAO transfer (involves cycle skipping), then return the Region code. Even then, you're not going to be assured that the facility you searched on is always in the same Region as the airport you want. Bottom line - I wouldn't pursue that approach.

But it may be "good enough" to extract the first letter of the AirportIdent and use that as a proxy for Region. Take a look at the ssub command in the Wiki section to see how to extract the first letter. This won't always work because airport idents do not always start with the first letter of the Region, but it's easy to implement.

Bob

Thank you Bob, you are right, region airport is not a good idea, better the full airport code. First letter only doesn't sound so good because there a lot of differencese: for example L : Italy (LIRF), Hungary (LHBP), Austria (LOWI)... same "L" but 3 total different languages. Thank you anyway for the suggestion
 
First letter only doesn't sound so good because...
You need to test first two letters!

My favorite method for determining the region is by testing the "center" airspaces (FIR/ARTCC), which are generally the same as country borders, except for minor deviations in some parts of Africa:
Code:
<Update>
    (A:GPS POSITION LAT, Radians) (>C:fs9gps:NearestAirspaceCurrentLatitude, Radians)
    (A:GPS POSITION LON, Radians) (>C:fs9gps:NearestAirspaceCurrentLongitude, Radians)
    (A:GPS POSITION ALT, Meters) (>C:fs9gps:NearestAirspaceCurrentAltitude, Meters)
    (A:GPS GROUND TRUE TRACK, Radians) (>C:fs9gps:NearestAirspaceTrueGroundTrack, Radians)
    (A:GPS GROUND SPEED, knots) (>C:fs9gps:NearestAirspaceGroundSpeed, knots)
    0 (>C:fs9gps:NearestAirspaceNearDistance, nmiles)
    0 (>C:fs9gps:NearestAirspaceNearAltitude, feet)
    0 (>C:fs9gps:NearestAirspaceAheadTime, minutes)
    0 (>C:fs9gps:NearestAirspaceMaximumDistance, nmiles)
    1 (>C:fs9gps:NearestAirspaceMaximumItems)
    2 (>C:fs9gps:NearestAirspaceQuery)      (* '2' = 'Center' *)
</Update>

And example for German, Italian and English (as a default):
Code:
    (C:fs9gps:NearestAirspaceItemsNumber) 0 >)
    if{
        0 (>C:fs9gps:NearestAirspaceCurrentLine)
        (C:fs9gps:NearestAirspaceCurrentName) 0 2 ssub sp0

        l0 'ED' scmp 0 ==
        l0 'LO' scmp 0 == or
        l0 'LS' scmp 0 == or
        if{
            (* Germany, Austria, Switzerland *)
        }
        els{
            l0 'LI' scmp 0 ==
            if{
                (* Italy *)
            }
            els{
                (* English *)
            }
        }
    }

Region codes for all fsX FIR's:
AG: Solomon Islands
AN: Nauru
AY: Papua New Guinea
BG: Greenland
BI: Iceland
CZ: Canada
DA: Algeria
DG: Ghana
DN: Nigeria
DR: Niger
DT: Tunisia
EB: Belgium
ED: Germany
EE: Estonia
EF: Finland
EG: United Kingdom
EH: Netherlands
EI: Ireland
EK: Denmark
EN: Norway
EP: Poland
ES: Sweden
EV: Latvia
EY: Lithuania
FA: South Africa
FB: Botswana
FC: Republic of the Congo
FI: Mauritius
FL: Zambia
FM: Comoros, Mayotte and Réunion (France), and Madagascar
FN: Angola
FQ: Mozambique
FS: Seychelles
FT: Chad
FV: Zimbabwe
FW: Malawi
FY: Namibia
FZ: Democratic Republic of the Congo
GC: Canary Islands (Spain)
GL: Liberia
GM: Morocco
GO: Senegal
GV: Cape Verde
HA: Ethiopia
HB: Burundi
HC: Somalia
HE: Egypt
HH: Eritrea
HK: Kenya
HL: Libya
HR: Rwanda
HS: Sudan and South Sudan
HT: Tanzania
HU: Uganda
KZ, PA, PH, TJ: USA, Alaska, Hawaii, Puerto Rico
LA: Albania
LB: Bulgaria
LC: Cyprus
LD: Croatia
LE: Spain
LF: France
LG: Greece
LH: Hungary
LI: Italy
LJ: Slovenia
LK: Czech Republic
LL: Israel
LM: Malta
LO: Austria
LP: Portugal
LQ: Bosnia and Herzegovina
LR: Romania
LS: Switzerland
LT: Turkey
LU: Moldova
LW: North Macedonia
LY: Serbia and Montenegro
LZ: Slovakia
MD: Dominican Republic
MH: Honduras
MK: Jamaica
MM: Mexico
MP: Panama
MT: Haiti
MU: Cuba
MY: Bahamas
NF: Fiji, Tonga
NT: French Polynesia
NZ: New Zealand, Antarctica
OA: Afghanistan
OB: Bahrain
OE: Saudi Arabia
OI: Iran
OJ: Jordan and the West Bank
OK: Kuwait
OL: Lebanon
OM: United Arab Emirates
OO: Oman
OP: Pakistan
OR: Iraq
OS: Syria
OY: Yemen
RC: Taiwan
RJ, RO: Japan
RK: South Korea
RP: Philippines
SA: Argentina
SB: Brazil
SC: Chile
SE: Ecuador
SG: Paraguay
SK: Colombia
SL: Bolivia
SM: Suriname
SO: French Guiana
SP: Peru
SU: Uruguay
SV: Venezuela
SY: Guyana
TN: Caribbean Netherlands, Aruba, Curaçao, Sint Maarten
TT: Trinidad and Tobago
UE, UH, UI, UL, UN, UO, UR, US, UU, UW: Russia
UA: Kazakhstan
UB: Azerbaijan
UD: Armenia
UG: Georgia
UK: Ukraine
UM: Belarus and Kaliningrad (Russia)
UT: Tajikistan, Turkmenistan, Uzbekistan
VA, VE, VI, VO: India
VC: Sri Lanka
VD: Cambodia
VG: Bangladesh
VH: Hong Kong
VL: Laos
VN: Nepal
VR: Maldives
VT: Thailand
VV: Vietnam
VY: Myanmar
WA, WI, WR: Indonesia
WB, WM: Brunei, Malaysia
WS: Singapore
YB,YM: Australia
ZB, ZG, ZH, ZL, ZP, ZS, ZW, ZY: China
ZK: North Korea
ZM: Mongolia
 
Last edited:
You need to test first two letters!

My favorite method for determining the region is by testing the "center" airspaces (FIR/ARTCC), which are generally the same as country borders, except for minor deviations in some parts of Africa:
Code:
<Update>
    (A:GPS POSITION LAT, Radians) (>C:fs9gps:NearestAirspaceCurrentLatitude, Radians)
    (A:GPS POSITION LON, Radians) (>C:fs9gps:NearestAirspaceCurrentLongitude, Radians)
    (A:GPS POSITION ALT, Meters) (>C:fs9gps:NearestAirspaceCurrentAltitude, Meters)
    (A:GPS GROUND TRUE TRACK, Radians) (>C:fs9gps:NearestAirspaceTrueGroundTrack, Radians)
    (A:GPS GROUND SPEED, knots) (>C:fs9gps:NearestAirspaceGroundSpeed, knots)
    0 (>C:fs9gps:NearestAirspaceNearDistance, nmiles)
    0 (>C:fs9gps:NearestAirspaceNearAltitude, feet)
    0 (>C:fs9gps:NearestAirspaceAheadTime, minutes)
    0 (>C:fs9gps:NearestAirspaceMaximumDistance, nmiles)
    1 (>C:fs9gps:NearestAirspaceMaximumItems)
    2 (>C:fs9gps:NearestAirspaceQuery)      (* '2' = 'Center' *)
</Update>

And example for German, Italian and English (as a default):
Code:
    (C:fs9gps:NearestAirspaceItemsNumber) 0 >)
    if{
        0 (>C:fs9gps:NearestAirspaceCurrentLine)
        (C:fs9gps:NearestAirspaceCurrentName) 0 2 ssub sp0

        l0 'ED' scmp 0 ==
        l0 'LO' scmp 0 == or
        l0 'LS' scmp 0 == or
        if{
            (* Germany, Austria, Switzerland *)
        }
        els{
            l0 'LI' scmp 0 ==
            if{
                (* Italy *)
            }
            els{
                (* English *)
            }
        }
    }

Region codes for all fsX FIR's:
AG: Solomon Islands
AN: Nauru
AY: Papua New Guinea
BG: Greenland
BI: Iceland
CZ: Canada
DA: Algeria
DG: Ghana
DN: Nigeria
DR: Niger
DT: Tunisia
EB: Belgium
ED: Germany
EE: Estonia
EF: Finland
EG: United Kingdom
EH: Netherlands
EI: Ireland
EK: Denmark
EN: Norway
EP: Poland
ES: Sweden
EV: Latvia
EY: Lithuania
FA: South Africa
FB: Botswana
FC: Republic of the Congo
FI: Mauritius
FL: Zambia
FM: Comoros, Mayotte and Réunion (France), and Madagascar
FN: Angola
FQ: Mozambique
FS: Seychelles
FT: Chad
FV: Zimbabwe
FW: Malawi
FY: Namibia
FZ: Democratic Republic of the Congo
GC: Canary Islands (Spain)
GL: Liberia
GM: Morocco
GO: Senegal
GV: Cape Verde
HA: Ethiopia
HB: Burundi
HC: Somalia
HE: Egypt
HH: Eritrea
HK: Kenya
HL: Libya
HR: Rwanda
HS: Sudan and South Sudan
HT: Tanzania
HU: Uganda
KZ, PA, PH, TJ: USA, Alaska, Hawaii, Puerto Rico
LA: Albania
LB: Bulgaria
LC: Cyprus
LD: Croatia
LE: Spain
LF: France
LG: Greece
LH: Hungary
LI: Italy
LJ: Slovenia
LK: Czech Republic
LL: Israel
LM: Malta
LO: Austria
LP: Portugal
LQ: Bosnia and Herzegovina
LR: Romania
LS: Switzerland
LT: Turkey
LU: Moldova
LW: North Macedonia
LY: Serbia and Montenegro
LZ: Slovakia
MD: Dominican Republic
MH: Honduras
MK: Jamaica
MM: Mexico
MP: Panama
MT: Haiti
MU: Cuba
MY: Bahamas
NF: Fiji, Tonga
NT: French Polynesia
NZ: New Zealand, Antarctica
OA: Afghanistan
OB: Bahrain
OE: Saudi Arabia
OI: Iran
OJ: Jordan and the West Bank
OK: Kuwait
OL: Lebanon
OM: United Arab Emirates
OO: Oman
OP: Pakistan
OR: Iraq
OS: Syria
OY: Yemen
RC: Taiwan
RJ, RO: Japan
RK: South Korea
RP: Philippines
SA: Argentina
SB: Brazil
SC: Chile
SE: Ecuador
SG: Paraguay
SK: Colombia
SL: Bolivia
SM: Suriname
SO: French Guiana
SP: Peru
SU: Uruguay
SV: Venezuela
SY: Guyana
TN: Caribbean Netherlands, Aruba, Curaçao, Sint Maarten
TT: Trinidad and Tobago
UE, UH, UI, UL, UN, UO, UR, US, UU, UW: Russia
UA: Kazakhstan
UB: Azerbaijan
UD: Armenia
UG: Georgia
UK: Ukraine
UM: Belarus and Kaliningrad (Russia)
UT: Tajikistan, Turkmenistan, Uzbekistan
VA, VE, VI, VO: India
VC: Sri Lanka
VD: Cambodia
VG: Bangladesh
VH: Hong Kong
VL: Laos
VN: Nepal
VR: Maldives
VT: Thailand
VV: Vietnam
VY: Myanmar
WA, WI, WR: Indonesia
WB, WM: Brunei, Malaysia
WS: Singapore
YB,YM: Australia
ZB, ZG, ZH, ZL, ZP, ZS, ZW, ZY: China
ZK: North Korea
ZM: Mongolia

Thank you, another intersting solution. :-)
 
Back
Top