A small library to calculate the bearing of a VOR signal from a WAV file.
Project description
Python VOR Decoder
This 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, with additional comments, explanations, and minor modifications for clarity and usability.
Overview
VOR 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.
Features
- Pure Python implementation using NumPy, SciPy, and Matplotlib
- Signal processing pipeline including:
- Lowpass and bandpass FIR filtering
- Sample rate decimation
- FM subcarrier demodulation and phase extraction
- Cross-correlation for phase comparison
- Visualization of signals in both time and frequency domains at each processing step
- Calibration support for phase alignment
Testing
I tested the code using the signal from the VRN airport in Verona, Italy. The code successfully decoded the VOR signal and displayed the correct bearing with a small approximation.
Test points
The following test points were used, with their respective bearings:
| Latitude | Longitude | Measured Bearing | Displayed Bearing |
|---|---|---|---|
| 45.377740N | 10.880124E | 211° | 210° |
| 45.392627N | 10.905900E | 181° | 182° |
| 45.409503N | 10.883784E | 275° | 275° |
| 45.412321N | 10.900993E | 322° | 320° |
| 45.418328N | 10.930478E | 58° | 58° |
Usage
WAV recording
Record a VOR signal as a WAV file (mono or stereo). The recording should capture both the AM reference and FM variable signals.
- The receiver should be set to AM mode with a bandwidth of 22KHz
- Recording should be saved with a minimum sample rate of 48KHz (96KHz preferred)
- There is no need to record more than 1 second of audio, as the decoder processes the signal in chunks.
Calculating using Jupyter Notebook
The Jupyter Notebook at VOR_Decoder.ipynb provides an interactive environment to process the recorded WAV file and extract the bearing.
It displays the decoding steps, including the original signal, filtered signals, and the final bearing result with visualizations.
- Set the
FILENAMEvariable in the notebook or script to point to your WAV file. - Run the notebook or script to process the signal and extract the bearing.
Calculating using Python library
- Install the library using pip:
pip install python-vor - Import the
get_bearingfunction from the library:from python_vor import get_bearing - Call the function with the WAV file path and optional parameters:
from python_vor import get_bearing
offset = 223 # Optional offset to add in the VOR calculation
bearing = get_bearing(str(wav_file), offset=offset)
print(f"Bearing for {wav_file.name}: {bearing:.2f}°")
Processing details
The processing steps include:
- Loading and displaying audio statistics
- Filtering and decimating the reference and variable signals
- Demodulating the FM subcarrier
- Extracting and filtering the variable signal phase
- Comparing phases to compute the bearing
Dependencies
- numpy
- scipy
- matplotlib (only for the Jupyter Notebook visualization)
Install them via pip if needed:
pip install scipy==1.16.0
pip install numpy==2.3.1
Contributing
Please refer to the CONTRIBUTING.md file for guidelines on contributing to this project.
Attribution
Original code and algorithm by martinber.
This repository provides a cleaned-up and commented version for educational and practical use.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_vor-0.0.2.tar.gz.
File metadata
- Download URL: python_vor-0.0.2.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ed5f448d995099f53bdd643a9feed3358b4b86f9cfb63673307b0e0475b099c
|
|
| MD5 |
d349300c4f6ec7dfb25e9fb55a5d4887
|
|
| BLAKE2b-256 |
3d36e07fb72bbe7225c832b12c846c38b14724339b1a1fb9ee8da87e12989198
|
Provenance
The following attestation bundles were made for python_vor-0.0.2.tar.gz:
Publisher:
publish.yml on iu2frl/PythonVOR
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_vor-0.0.2.tar.gz -
Subject digest:
4ed5f448d995099f53bdd643a9feed3358b4b86f9cfb63673307b0e0475b099c - Sigstore transparency entry: 271984460
- Sigstore integration time:
-
Permalink:
iu2frl/PythonVOR@a17c890fb8b927e9cbc2a9455f0aee10487e2857 -
Branch / Tag:
refs/tags/0.0.2 - Owner: https://github.com/iu2frl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a17c890fb8b927e9cbc2a9455f0aee10487e2857 -
Trigger Event:
release
-
Statement type:
File details
Details for the file python_vor-0.0.2-py3-none-any.whl.
File metadata
- Download URL: python_vor-0.0.2-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
188321ce6e853608959c412679879081c6b48615fa818432ff8046252eaa24b7
|
|
| MD5 |
61c2536c7489218469957cf493eb04b7
|
|
| BLAKE2b-256 |
9f1eff9cf1541c41d93b274a740f361ea2f5bb581822227cb751cfc5ab383e1b
|
Provenance
The following attestation bundles were made for python_vor-0.0.2-py3-none-any.whl:
Publisher:
publish.yml on iu2frl/PythonVOR
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_vor-0.0.2-py3-none-any.whl -
Subject digest:
188321ce6e853608959c412679879081c6b48615fa818432ff8046252eaa24b7 - Sigstore transparency entry: 271984475
- Sigstore integration time:
-
Permalink:
iu2frl/PythonVOR@a17c890fb8b927e9cbc2a9455f0aee10487e2857 -
Branch / Tag:
refs/tags/0.0.2 - Owner: https://github.com/iu2frl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a17c890fb8b927e9cbc2a9455f0aee10487e2857 -
Trigger Event:
release
-
Statement type: