El 29/12/17 a las 21:09, Kevin Otte escribió: > I'd like to experiment with piping FreeDV over the network a la DMR and > DSTAR reflectors. First step would seem to be how to extract those > frames from what's coming over the air. > > My first testing attempt: > kjotte@daedalus:~/svn/codec2-dev/build$ ./src/freedv_tx 2400B > ../raw/hts1a.raw - | ./src/freedv_rx 2400B - /tmp/demod.craw --codecrx > > My understanding is that the result of this pipeline would be > /tmp/demod.craw populated with the raw Codec2 1300 frames that were > sent. Instead I'm getting the decoded 8KHz PCM. > > What have I missed?
Hi Kevin and all, I've taken a look at this. To rephrase Kevin's question, in case it wasn't clear: Assume we have a recording of a FreeDV signal. Extract the Codec2 frames using the command line tools. I see no way of doing this with the current command line tools. There is the undocumented "--codecrx" option in freedv_rx, but this works as follows: a) If --codecrx is not used, then freedv_rx uses freedv_rx() from the API to demodulate the signal and decode the Codec2 frames to obtain speech samples. b) If --codecrx is used, then freedv_rx first uses freedv_codecrx() from the API to demodulated the signal and obtain the Codec2 frames. Then, it uses codec2_decode() to decode the frames and obtain speech samples. Maybe there is some subtlety involved, but to me it seems that a) and b) accomplish the same in different ways. So I don't see the purpose of the "--codecrx" flag (other than to test the freedv_codecrx() function in the API). I have patched freedv_rx to do what Kevin wants (see the patch below): make freedv_rx output codec2 frames when --codecrx is used. I'm testing it as follows, and it works fine: ./freedv_tx 2400B ../../raw/hts1a.raw - | \ ./freedv_rx 2400B - - --codecrx | \ ./c2dec 1300 - - | \ play -t raw -r 8000 -e signed-integer -b 16 -c 1 - (note that I'm including c2dec in the pipe). 73, Dani. --------- Index: src/freedv_rx.c =================================================================== --- src/freedv_rx.c (revision 3386) +++ src/freedv_rx.c (working copy) @@ -205,10 +205,10 @@ unsigned char encoded[bytes_per_codec_frame * codec_frames]; /* Use the freedv_api to demodulate only */ - nout = freedv_codecrx(freedv, encoded, demod_in); + nout = freedv_codecrx(freedv, speech_out, demod_in); /* deccode the speech ourself (or send it to elsewhere, e.g. network) */ - if (nout) { +/* if (nout) { unsigned char *enc_frame = encoded; short *speech_frame = speech_out; @@ -220,11 +220,12 @@ nout += samples_per_frame; } } +*/ } nin = freedv_nin(freedv); - fwrite(speech_out, sizeof(short), nout, fout); + fwrite(speech_out, use_codecrx ? sizeof(char) : sizeof(short), nout, fout); freedv_get_modem_stats(freedv, &sync, &snr_est); freedv_get_modem_extended_stats(freedv,&stats); total_bit_errors = freedv_get_total_bit_errors(freedv); ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Freetel-codec2 mailing list Freetel-codec2@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freetel-codec2