atmatthewat / mdc-encode-decode

Software modem for a specific data burst format
21 stars 7 forks source link

Could you please explain a little how to use this code? #3

Open KOUKILEO opened 2 years ago

KOUKILEO commented 2 years ago

Hello~ I'm using arduino to develop this project, but I don't know anything about C... Could you please explain a little how to use this code? thank you

matthewkmacdonald commented 2 years ago

Hi! Are you planning on encoding, decoding, or both? The basic functions you need to set up an encoder are in mdc_encode.h, and mdc_decoder.h for the decoder For example, mcd_encoder_new() returns a pointer to an MDC encoder object. Ex: mdc_encoder_t *encoder = mdc_encoder_new(8000);

On a more fundamental note though, these libraries either create or consume audio samples and frames for rendering or decoding MDC1200 signaling. If you are new to C then you should first familiarize yourself with the core library functions needed to ingest and output audio (e.g. are you reading/writing static files or real-time audio streams?).

ITCMD commented 10 months ago

Would also love some assistance on this. Our department would love to be able to decode and encode MDC IDs and send radio checks from an analog radio we use for our dispatch, but we do not have the ability to familiarize ourselves much with the code.

Does anyone have a compiled or useable version that would just be a shell command on linux or exe on Windows? We tried MDCTool but it fails to start on any of our systems and is not actively developed.

jfm-so commented 9 months ago

@ITCMD Hate to highjack, but might be worth to checked out the linked repository. Was working through a similar project decoding MDC IDs.

https://github.com/russinnes/fsync-mdc1200-decode

URL="http://localhost/$FILE.mp3"
TEMP_MP3_FILE="/tmp/temp_audio.mp3"
TEMP_RAW_FILE="/tmp/temp_audio.raw"

# Download the MP3 file
curl -s -L $URL -o $TEMP_MP3_FILE

# Convert MP3 to raw
sox -t mp3 $TEMP_MP3_FILE -r 8000 -c 1 -b 8 -e unsigned-integer -t raw $TEMP_RAW_FILE

# Pass the raw file to demod and get unit id
UNITID=$(demod -f $TEMP_RAW_FILE | jq -r .unitID)

# Clean up temporary files
rm $TEMP_MP3_FILE $TEMP_RAW_FILE