{"id":29572608,"url":"https://github.com/iu2frl/pythonvor","last_synced_at":"2026-05-15T21:37:51.012Z","repository":{"id":304222086,"uuid":"1017572076","full_name":"iu2frl/PythonVOR","owner":"iu2frl","description":"Studying how VOR works using a Python decoder","archived":false,"fork":false,"pushed_at":"2025-07-11T19:01:25.000Z","size":10371,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-11T19:32:12.658Z","etag":null,"topics":["air","airplane","avionics","bearing","decoder","heading","navigation","python","vor"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iu2frl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-10T18:37:24.000Z","updated_at":"2025-07-11T19:00:38.000Z","dependencies_parsed_at":"2025-07-11T19:32:19.205Z","dependency_job_id":"b57265dc-4b51-42cc-9653-9a83902b1484","html_url":"https://github.com/iu2frl/PythonVOR","commit_stats":null,"previous_names":["iu2frl/pythonvor"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/iu2frl/PythonVOR","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iu2frl%2FPythonVOR","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iu2frl%2FPythonVOR/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iu2frl%2FPythonVOR/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iu2frl%2FPythonVOR/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iu2frl","download_url":"https://codeload.github.com/iu2frl/PythonVOR/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iu2frl%2FPythonVOR/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265892483,"owners_count":23845028,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["air","airplane","avionics","bearing","decoder","heading","navigation","python","vor"],"created_at":"2025-07-19T05:10:26.835Z","updated_at":"2026-05-15T21:37:50.964Z","avatar_url":"https://github.com/iu2frl.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python VOR Decoder\n\nThis repository contains a pure Python implementation of a VOR (VHF Omnidirectional Range) radio navigation signal decoder. The code is based on and adapted from the work of [martinber](https://github.com/martinber/vor-python-decoder), with additional comments, explanations, and minor modifications for clarity and usability.\n\n## Overview\n\n\u003e [!NOTE]\n\u003e This library only decodes VOR signals from WAV files. It does not handle real-time signal processing or live VOR reception.\n\nVOR is a type of radio navigation system for aircraft, allowing pilots to determine their position and bearing relative to a ground-based VOR station. This decoder processes a WAV file recording of a VOR signal and extracts the bearing information using digital signal processing techniques.\n\n### VOR technical details\n\n![RF Spectrum of the VRN airport VOR](https://raw.githubusercontent.com/iu2frl/PythonVOR/main/imgs/VOR_Spectrum.png)\n\nVOR systems operate in the VHF range (108.0-117.95 MHz with 50 kHz spacing), with the lower 4 MHz shared with ILS frequencies. The VOR signal encodes directional information through the phase relationship between two 30 Hz signals. In Conventional VORs (CVOR), a 30 Hz reference signal is FM-modulated on a 9,960 Hz subcarrier while a variable 30 Hz AM signal is created by a rotating antenna.\n\n\u003e [!NOTE]\n\u003e This library only decodes VOR signals and not DVOR (Doppler VOR) signals. The decoding logic is designed specifically for Conventional VORs.\n\nDoppler VORs (DVOR) use a fixed circular array of omnidirectional antennas, reversing the modulation roles: the reference is AM-modulated while the variable signal uses electronic switching to create FM through the Doppler effect.\n\nBoth types also transmit a station identifier in 7 WPM Morse code and often include an AM voice channel. Aircraft receivers determine bearing by measuring the phase difference between these reference and variable signals, with identical decoding regardless of VOR type.\n\nThis is exactly what this decoder does: it processes a recorded VOR signal, extracts the reference and variable components, demodulates them, and calculates the bearing based on their phase difference.\n\n## Features\n\n- **Pure Python implementation** using:\n  - NumPy\n  - SciPy\n  - Matplotlib (only in the Jupyter Notebook)\n- **Signal processing pipeline** including:\n  - Lowpass and bandpass FIR filtering\n  - Sample rate decimation\n  - FM subcarrier demodulation and phase extraction\n  - Cross-correlation for phase comparison\n- **Visualization** of signals in both time and frequency domains at each processing step\n- **Calibration support** for phase alignment\n\n## Processing details\n\nThe processing steps include:\n\n- Loading audio file and displaying audio statistics (if debug logging is enabled)\n- Filtering and decimating the reference and variable signals\n- Demodulating the FM subcarrier\n- Extracting and filtering the variable signal phase\n- Comparing phases to compute the bearing\n- Returning the calculated bearing in degrees\n\n## Testing\n\nI tested the code using the signal from the VRN airport in Verona (115.800MHz), Italy. The code successfully decoded the VOR signal and displayed the correct bearing with a small approximation.\n\n### Test points\n\n![Map of the test points](https://raw.githubusercontent.com/iu2frl/PythonVOR/main/imgs/VRN_map.png)\n\nThe following test points were used, with their respective bearings:\n\n| Latitude | Longitude | Measured Bearing | Displayed Bearing |\n|----------|-----------|------------------|-------------------|\n| 45.377740N | 10.880124E | 211° | 210° |\n| 45.392627N | 10.905900E | 181° | 182° |\n| 45.409503N | 10.883784E | 275° | 275° |\n| 45.412321N | 10.900993E | 322° | 320° |\n| 45.418328N | 10.930478E | 58°  | 58°  |\n\n## Usage\n\n### WAV recording\n\nIndependent of the decoding method, you need to **record a VOR signal** in WAV format. This can be done using any audio recording software or hardware that supports VOR frequencies.\n\nRecord a VOR signal as a WAV file (mono or stereo). The recording should capture both the AM reference and FM variable signals.\n\n- The receiver should be set to AM mode with a bandwidth of 22KHz and centered on the VOR frequency (e.g., 115.800MHz).\n- Recording should be saved with a minimum sample rate of 48KHz (96KHz preferred)\n- There is no need to record more than 1 second of audio, as the decoder processes the signal in chunks.\n\n### Option 1: Calculating using Jupyter Notebook\n\nThe Jupyter Notebook at [VOR_Decoder.ipynb](https://github.com/iu2frl/PythonVOR/blob/main/VOR_Decoder.ipynb) provides an interactive environment to process the recorded WAV file and extract the bearing.\n\nIt displays the decoding steps, including the original signal, filtered signals, and the final bearing result with visualizations.\n\n1. **Set the `FILENAME` variable** in the notebook or script to point to your WAV file.\n1. **Run the notebook or script** to process the signal and extract the bearing.\n\n### Option 2: Calculating using Python library\n\n1. Install the library using pip: `pip install python-vor`\n2. Import the `get_bearing` function from the library: `from python_vor import get_bearing`\n3. Call the function with the WAV file path and optional parameters:\n\n```python\nfrom python_vor import get_bearing\nfile_path = \"path/to/your/vor_signal.wav\"\noffset = 223  # Optional offset to add in the VOR calculation\nbearing = get_bearing(file_path, offset=offset)\nprint(f\"Bearing for file at {file_path} is: {bearing:.2f}°\")\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eEnabling debug logs\u003c/summary\u003e\n\nTo enable detailed logging, you can set the logging level in your script:\n\n```python\nimport logging\nlogger = logging.getLogger(\"python-vor\")\nlogger.setLevel(logging.DEBUG)\n```\n\nThis will print debug messages like:\n\n```plaintext\nDEBUG:python-vor:Loading WAV input from audio\\45.409503N10.883784E-275Deg.wav\nDEBUG:python-vor:Input is stereo, keeping only one channel\nDEBUG:python-vor:Input sample rate: 96000\nDEBUG:python-vor:Input samples: 312256\nDEBUG:python-vor:Recording duration: 3.252666666666667 seconds\nDEBUG:python-vor:Recording is longer than 1 second, cutting it to 96000 samples\nDEBUG:python-vor:Input sample rate: 96000\nDEBUG:python-vor:Input samples: 96000\nDEBUG:python-vor:Recording duration: 1.0 seconds\nDEBUG:python-vor:Applying lowpass filter to reference signal\nDEBUG:python-vor:Calculating filter parameters\nDEBUG:python-vor:Lowpass filtering with 699 taps\nDEBUG:python-vor:New signal delay: 349\nDEBUG:python-vor:Decimating reference signal to 6000Hz\nDEBUG:python-vor:Decimating signal from 96000 to 6000 Hz\nDEBUG:python-vor:Applying bandpass filter to FM signal\nDEBUG:python-vor:Calculating filter parameters\nDEBUG:python-vor:Bandpass filtering with 351 taps\nDEBUG:python-vor:New signal delay: 175\nDEBUG:python-vor:Centering FM signal on 0Hz\nDEBUG:python-vor:Applying lowpass filter to FM signal\nDEBUG:python-vor:Calculating filter parameters\nDEBUG:python-vor:Lowpass filtering with 699 taps\nDEBUG:python-vor:New signal delay: 524\nDEBUG:python-vor:Decimating FM signal to 6000Hz\nDEBUG:python-vor:Decimating signal from 96000 to 6000 Hz\nDEBUG:python-vor:Calculating phase of FM signal\nDEBUG:python-vor:Removing DC from variable signal\nDEBUG:python-vor:Calculating filter parameters\nDEBUG:python-vor:Bandpass filtering with 1453 taps\nDEBUG:python-vor:New signal delay: 758\nDEBUG:python-vor:Comparing phases of reference and variable signals\nDEBUG:python-vor:Copying signals to avoid modifying the originals\nDEBUG:python-vor:Removing delays from signals\nDEBUG:python-vor:Correcting variable signal delay with angle offset\nDEBUG:python-vor:Cutting variable signal to match reference signal length\nDEBUG:python-vor:Calculating correlation between signals\nDEBUG:python-vor:Normalizing signals for better visualization\nDEBUG:python-vor:Calculated bearing: 275.4000000000001 degrees\nDEBUG:python-vor:Calculated bearing: 275.4000000000001°\n```\n\n\u003c/details\u003e\n\n## Dependencies\n\n- numpy\n- scipy\n- matplotlib (only for the Jupyter Notebook visualization)\n\nInstall them via pip if needed:\n\n```bash\npip install scipy==1.16.0\npip install numpy==2.3.1\n```\n\n## Contributing\n\nPlease refer to the [CONTRIBUTING.md](https://github.com/iu2frl/PythonVOR/blob/main/CONTRIBUTING.md) file for guidelines on contributing to this project.\n\n## Attribution\n\nOriginal code and algorithm by [martinber](https://github.com/martinber/vor-python-decoder).  \nThis repository provides a cleaned-up and commented version for educational and practical use.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](https://github.com/iu2frl/PythonVOR/blob/main/LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiu2frl%2Fpythonvor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiu2frl%2Fpythonvor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiu2frl%2Fpythonvor/lists"}