A fast, feature-rich command-line tool that converts standard audio files (MP3, WAV, FLAC, and M4A) into HackRF/PortaPack .c8 IQ files for playback using HackRF One and PortaPack (Mayhem Firmware).
Built with NumPy, SciPy, and Rich for maximum performance and an easy-to-use interface.
- 🎵 Convert MP3, WAV, FLAC, and M4A directly to
.c8 - ⚡ Highly optimized DSP pipeline using NumPy
- 📈 FM Pre-emphasis filtering for improved audio quality
- 📊 Beautiful terminal interface powered by Rich
- 📁 Automatically creates PortaPack
.txtmetadata files - 💾 Estimates output file size before conversion
- 🎚️ Built-in processing presets:
- PortaPack FM Broadcast (500 kHz)
- High Fidelity (1 MHz)
- Low Storage (250 kHz)
- Fully Custom
- 🔄 Automatic audio conversion using FFmpeg
- 📻 Displays the required
hackrf_transfercommand after conversion - 🖥️ Works on Windows, Linux, and macOS
- Python 3.8+
- FFmpeg installed and available in your system
PATH
Download FFmpeg from:
https://www.gyan.dev/ffmpeg/builds/
Extract it and add the bin folder to your system PATH.
sudo apt install ffmpegbrew install ffmpegClone the repository:
git clone https://github.com/texysexr/hackrf-fm-encoder.git
cd hackrf-fm-encoderInstall dependencies:
pip install -r requirements.txt- Place your audio files in the same folder as the script.
- Run the converter:
python audio2fm.py-
Select the audio file from the list.
-
Choose one of the processing presets:
| Option | Preset | Sample Rate | Description |
|---|---|---|---|
| 1 | PortaPack FM Broadcast | 500 kHz | Recommended for most users |
| 2 | High Fidelity | 1 MHz | Highest quality output |
| 3 | Low Storage | 250 kHz | Smallest file size |
| 4 | Custom | User Defined | Choose your own settings |
- Enter:
- Center Frequency (MHz)
- Output filename
The converter will then:
- Convert the audio to WAV (if necessary)
- Normalize audio
- Apply FM pre-emphasis
- Resample audio
- Generate FM IQ data
- Save a
.c8file - Create the required
.txtPortaPack metadata file
Example:
music.c8
music.txt
The metadata file contains:
center_frequency=107900000
sample_rate=500000
Copy both files to your PortaPack SD card:
/REPLAY
or
/LOOKOUT
Then select the .c8 file from the Replay application.
After conversion, the program displays a ready-to-use command such as:
hackrf_transfer -t output.c8 -f 107900000 -s 500000 -a 1 -x 47Input:
- WAV
- MP3
- FLAC
- M4A
Output:
.c8.txt(PortaPack metadata)
- Python
- NumPy
- SciPy
- Rich
- FFmpeg
This project is licensed under the MIT License.
Pull requests and feature suggestions are welcome.
If you find a bug or have an idea for an improvement, feel free to open an issue.
- Great Scott Gadgets
- HackRF One Community
- PortaPack Mayhem Firmware
- NumPy
- SciPy
- Rich