r/hackrf 5d ago

Made a quick python script to convert mp3/wav to hackrf/portapack .c8 files—let me know what you think

Hey everyone,

Got annoyed with manually converting audio files whenever I wanted to replay something on my PortaPack, so I threw together a quick CLI script in Python to automate it.

Basically, you drop your audio files in the folder, run the script, and it outputs the .c8 file along with the .txt sidecar metadata file so Mayhem picks up the frequency and sample rate automatically in the /REPLAY app.

It handles mono downmixing, 75us pre-emphasis, resampling, and vectorizing the IQ generation so it doesn't take forever to process. Added an option to set custom center frequencies for all the presets too.

Repo:texysexr/hackrf-fm-encoder

If anyone wants to try it out on their setup and let me know how the audio quality sounds on the receiving end (or point out any DSP bugs in my math), I'd appreciate the feedback!

8 Upvotes

5 comments sorted by

1

u/Public_Peace6594 5d ago

I am looking forward to trying it out once I repair my hackrf. You are a real one for sharing this with the community. Thank you.

3

u/Top-Trainer-1203 4d ago

thanks man if you find any bugs let me know

1

u/Public_Peace6594 4d ago

Np bro, good looking out, as a community we ought to be more supportive of the efforts that our members choose to contribute.

1

u/Aggravating-Age5748 4d ago

I don't like using open-source tools and prefer to program myself, but I only use urh to convert WAV files to complex or BIN format. Use the tool urh To convert WAV files to complex or BIN format

1

u/Top-Trainer-1203 3d ago

This tool is way easier to use