Closed micahflee closed 5 years ago
Thanks for opening this issue!
You can read/write PCM files using the -i
and -o
switches:
$ echo 123 | amodem send -o /tmp/file.pcm
Audio OFDM MODEM v1.14.0: 1.0 kb/s (2-QAM x 1 carriers) Fs=8.0 kHz
Sending 0.800 seconds of training audio
Starting modulation
Sent 0.004 kB @ 0.113 seconds
$ amodem recv -i /tmp/file.pcm
Audio OFDM MODEM v1.14.0: 1.0 kb/s (2-QAM x 1 carriers) Fs=8.0 kHz
Waiting for carrier tone: 2.0 kHz
Carrier detected at ~150.0 ms @ 2.0 kHz
Carrier coherence: 100.000%
Carrier symbols amplitude : 1.000
Frequency error: 0.000 ppm
Starting demodulation
123
Received 0.004 kB @ 0.010 seconds = 0.402 kB/s
P.S. The file has the following format is:
Hi, I am trying to record the output from amodem, then decode at a later time. I am having trouble making a pcm that is recognized by amodem, it just times out on recv. Are there any details omitted here?
I am using ffmpeg and have tried a few options. Here is an example, trying the bitrate and sample rate at 3200 (the rate I've been using):
ffmpeg -i infile.wav -b:a 32k -ar 32000 -acodec pcm_s16le -f s16le wav_converted.pcm
the output pcm from amodem is the only pcm I've found that gets recognized by recv. I have not yet found a way to inspect the pcm to see what is different about this one. Any suggestions?
I realized I was not capturing the initial detection tone in my test. Now that I have that in my recording, the pcm is recognized and carrier detected, but decoding fails, I guess from signal noise.
Thanks for letting me know, will take a look :)
I can suggest using SoX for converting raw PCM files into WAV files:
$ export BITRATE=8
$ echo 123 | amodem send -o audio.pcm
Audio OFDM MODEM v1.15.0: 8.0 kb/s (16-QAM x 2 carriers) Fs=8.0 kHz
Sending 0.800 seconds of training audio
Starting modulation
Sent 0.004 kB @ 0.015 seconds
$ sox --type=raw --bits=16 --channels=1 --encoding=signed-integer --rate=8000 --endian=little audio.pcm audio.wav
$ amodem recv -i audio.pcm -q
123
It would be cool to have the option of reading and writing data to a wav file instead of an audio interface. (I'm having trouble getting either ALSA or PortAudio working with my setup, but also it seems like this could be useful for other reasons too.)