]> marstr Code Repo - 124thAWS/commitdiff
Fixed issue of ATC not being recognised correctly; Introduced callsign and flight... master
authorMarStr <marcus@marstr.online>
Thu, 11 Jul 2024 19:27:31 +0000 (21:27 +0200)
committerMarStr <marcus@marstr.online>
Thu, 11 Jul 2024 19:27:31 +0000 (21:27 +0200)
124thAWS.py
repoinfo

index 12e647c2174e118dd2f7c36eb93b6975b71e1bec..8549a4e3c02a1fa667de8e37c63c1276869123f6 100644 (file)
@@ -38,13 +38,14 @@ atc_aws_voicemodel = 'standard'
 # Define where your X-Plane log file is located\r
 # This usually sits in the root of your X-Plane folder, named Log.txt\r
 # -------------------------------------------------------------------\r
 # Define where your X-Plane log file is located\r
 # This usually sits in the root of your X-Plane folder, named Log.txt\r
 # -------------------------------------------------------------------\r
-atc_xplane_log = "M:\\Flight Sim\\Simulator\\12\\Log.txt"\r
+atc_xplane_log = "M:\\Flight Sim\\Simulator\\12\\Log_tmp.txt"\r
 #atc_xplane_log = "C:\\Users\\windo\\Desktop\\Log.txt"\r
 \r
 # -------------------------------------------------------------------\r
 # Put in your call sign. Must be the same you entered in 124th ATC\r
 # -------------------------------------------------------------------\r
 #atc_xplane_log = "C:\\Users\\windo\\Desktop\\Log.txt"\r
 \r
 # -------------------------------------------------------------------\r
 # Put in your call sign. Must be the same you entered in 124th ATC\r
 # -------------------------------------------------------------------\r
-atc_callsign = "MST 6012"\r
+atc_callsign = "MST"\r
+atc_flightno = "6012"\r
 \r
 \r
 # -------------------------------------------------------------------\r
 \r
 \r
 # -------------------------------------------------------------------\r
@@ -122,7 +123,6 @@ while True:
             c_idx = 0\r
             for word in content:\r
                 if word == "Communication:":\r
             c_idx = 0\r
             for word in content:\r
                 if word == "Communication:":\r
-                    c_idx = c_idx+1\r
                     break\r
                 c_idx = c_idx + 1\r
             \r
                     break\r
                 c_idx = c_idx + 1\r
             \r
@@ -140,7 +140,8 @@ while True:
                 # Pick a voice - depending on current situation\r
                 resp = ""\r
                 voice_to_use = -1\r
                 # Pick a voice - depending on current situation\r
                 resp = ""\r
                 voice_to_use = -1\r
-                if content[c_idx+1] == atc_callsign:\r
+                content[c_idx+2] = content[c_idx+2].replace(",", "")\r
+                if content[c_idx+1] == atc_callsign and content[c_idx+2] == atc_flightno:\r
                     vc = random.randrange(len(atc_voices))\r
                     if vc == atc_pilot_voice:\r
                         vc = vc-1\r
                     vc = random.randrange(len(atc_voices))\r
                     if vc == atc_pilot_voice:\r
                         vc = vc-1\r
@@ -158,6 +159,21 @@ while True:
                 if atc_show_responses == True:\r
                     print(" > " + resp + " - [" + atc_voices[voice_to_use] + "]: " + newline)\r
 \r
                 if atc_show_responses == True:\r
                     print(" > " + resp + " - [" + atc_voices[voice_to_use] + "]: " + newline)\r
 \r
+                # Let's replace the actual numbers with written, phonetic numbers to avoid things like\r
+                # "6012" audible as "six thousand twelve". Note the space after each number.\r
+                # We need to do this after the string checks performed before.\r
+                # Placing this here shows original text in console - but pronounces the numbers correctly.\r
+                newline = newline.replace("0", "Zero ")\r
+                newline = newline.replace("1", "One ")\r
+                newline = newline.replace("2", "Two ")\r
+                newline = newline.replace("3", "Three ")\r
+                newline = newline.replace("4", "Four ")\r
+                newline = newline.replace("5", "Five ")\r
+                newline = newline.replace("6", "Six ")\r
+                newline = newline.replace("7", "Seven ")\r
+                newline = newline.replace("8", "Eight ")\r
+                newline = newline.replace("9", "Niner ")\r
+\r
                 # Generate voice!\r
                 # Let's keep it at OGG - best compromize between data transfer size and quality\r
                 response = atc_polly_client.synthesize_speech(VoiceId=atc_voices[voice_to_use], OutputFormat='ogg_vorbis', Text = newline, Engine = atc_aws_voicemodel)\r
                 # Generate voice!\r
                 # Let's keep it at OGG - best compromize between data transfer size and quality\r
                 response = atc_polly_client.synthesize_speech(VoiceId=atc_voices[voice_to_use], OutputFormat='ogg_vorbis', Text = newline, Engine = atc_aws_voicemodel)\r
index 7ff6b5c33584d5f7e2f826ed4d8170f1e5528004..8c1971c5c5a981aca4ba8d7d36e903227286832e 100644 (file)
--- a/repoinfo
+++ b/repoinfo
@@ -79,17 +79,18 @@ The next section defines where the text log of X-Plane is located. Typically thi
 \r
 This is a default example I left in - you need to find the path of your file. This can also be on a network drive - important is that the Python script can access this location. Notice the double backslashes for the folder delimiters.\r
 \r
 \r
 This is a default example I left in - you need to find the path of your file. This can also be on a network drive - important is that the Python script can access this location. Notice the double backslashes for the folder delimiters.\r
 \r
-You will now need to enter your call sign. In 124thATC when you file a flight plan, you will be asked to provide a flight number which has two fields. What you enter here is your call sign.\r
+You will now need to enter your call sign and flight number. In 124thATC when you file a flight plan, you will be asked to provide a callsign and flight number, which has two fields. What you enter here is your call sign.\r
 \r
 \r
-In my case, I use "MST" on the left, and "6012" on the right. The resulting callsign will be a string made up of those two with a space. For me this is \r
+In my case, I use "MST" as my callsign, and "6012" on the right as my flight number. The resulting callsign will be a string made up of those two with a space. For me this is \r
 \r
 [code]MST 6012[/code]\r
 \r
 \r
 [code]MST 6012[/code]\r
 \r
-This is what you will need to enter at the line\r
+This is what you will need to enter at these lines:\r
 \r
 \r
-[code]atc_callsign = "MST 6012"[/code]\r
+[code]atc_callsign = "MST"\r
+atc_flightno = "6012"[/code]\r
 \r
 \r
-Replace this with your callsign.\r
+Replace this with your own call sign and flight number.\r
 \r
 Next, decide whether or not you want a voice for readbacks and/or communication from the cockpit to be played as audio. If you set this to False, only ATC communication will be audible.\r
 \r
 \r
 Next, decide whether or not you want a voice for readbacks and/or communication from the cockpit to be played as audio. If you set this to False, only ATC communication will be audible.\r
 \r
@@ -132,3 +133,8 @@ The sound format is OGG Vorbis. I would recommend you to leave it at that. It is
 [section]Future plans[/section]\r
 \r
 I may need to figure out how to efficiently read X-Plane's dataref values so that I can further enhance realism. For example only pick another voice if you left a certain area or changed the type of contact. I will be looking into this at some time - for now I am happy with how this has turned out.\r
 [section]Future plans[/section]\r
 \r
 I may need to figure out how to efficiently read X-Plane's dataref values so that I can further enhance realism. For example only pick another voice if you left a certain area or changed the type of contact. I will be looking into this at some time - for now I am happy with how this has turned out.\r
+\r
+\r
+[section]History[/section]\r
+1.01 - Fixed issue of ATC not being recognised correctly; Introduced callsign and flight number; Fixed issue of numbers not being pronounced correctly \r
+1.0 - Initial release
\ No newline at end of file