It is indeed not in the same header, but it is in the same library.
You can just add '#include <codec2.h>" to your C file.
The functions use the same 'bits packed in bytes' format, with one
exception: a freedv frame might contain multiple codec2 frames (this
depends on the freedv mode)
So suppose you have the data in 'unsigned char rxdata_out[bytes_f];' you
can decode it with a loop:
struct CODEC2 c2 = freedv_get_codec2(f);
int bits_per_codec_frame = codec2_bits_per_frame(c2);
int bytes_per_codec_frame = (bits_per_codec_frame + 7) / 8;
int bits_f = freedv_get_bits_per_codec_frame(f);
int codec_frames = bits_f / bits_per_codec_frame;
int samples_per_frame = codec2_samples_per_frame(c2);
int i;
for (i = 0; i < codec_frames; i++) {
codec2_decode(c2,
&speech_out[samples_per_frame*i], &rxdata_out[bytes_per_codec_frame*i]);
}
On 06/17/2020 01:43 PM, Al Beard wrote:
> *Hi Jeroen,*
> *
> *
> *It's never easy....*
> *
> *
> *1) codec2_decode() is not defined in freedv_api.h*
> *2) codec2_decode() looks to require "bits" not "packed_bits"*
> *
> *
> *I'd like not to have to modify the codec2 library so my freedv binary*
> *will run on an updated codec2 library.*
> *
> *
> *Al VK2ZIW*
> *
> *
> *On Wed, 17 Jun 2020 12:17:04 +0200, Jeroen Vreeken wrote*
> > Hi Al,
> >
> > So you need both the codec2 data and the audio?
> > In that case I would use the freedv_rawdatarx function to get the
> codec2 data.
> > The audio data can be retrieved by calling codec2_decode() with it,
> then you have both.
> >
> > If you use the freedv_rawdatarx() function the text callback
> functions will still be called in the same manner as if you had used
> freedv_rx() so that should not be a problem.
> >
> > 73,
> > Jeroen PE1RXQ
> >
> > On 06/17/2020 09:20 AM, Al Beard wrote:
> >
>> *Hi Jeroen,*
>> > *
>> > *
>> > *I do actually want the decoded audio and the text string.*
>> > *So, should I decode to voice, the 700C file saved, after the QSO*
>> > *has finished?*
>> > *
>> > *
>> > *As I've mentioned, I'm not a "C" guru but I see a repeater as a
>> very worthwhile*
>> > *project offering a remote area digital voice communication method
>> for us hams*
>> > *where, unlike the commercial users eg. ambulances who have many
>> bases so*
>> > *HF skip will always (~mostly) get the signal to/from base HQ. *
>> > *
>> > *
>> > *Also, after a call to freedv_rawdatarx() is the text string
>> recovered?*
>> > *It's used to "trigger" retransmission.*
>> > *
>> > *
>> > *Alan VK2ZIW*
>> > *
>> > *
>> > *On Wed, 17 Jun 2020 02:22:20 +0200, Jeroen Vreeken wrote*
>> > > You should not mix freedv_rx() with freedv_rawdatarx().
>> > > Either one should be used.
>> > > The only difference between the two is that freedv_rx() will go
>> one step further after the modem part and decodes into audio.
>> > >
>> > > So after the call to freedv_rawdatarx() you are done and can skip
>> freedv_rx()
>> > >
>> > > On 06/16/2020 11:49 PM, Al Beard wrote:
>> > >
>>> Hi Jeroen,
>>> > >
>>> > > In freebeacon.c
>>> > > Line: 720
>>> > >
>>> > > nin = freedv_nin(f);
>>> > > while (codec2_fifo_read(fifo, demod_in, nin) == 0) {
>>> > > int nout = 0;
>>> > > //Alan
>>> > > ncodecb = freedv_rawdatarx(f, rxdata_out, demod_in);
>>> > > // original code continues
>>> > > nout = freedv_rx(f, speech_out, demod_in);
>>> > > freedv_get_modem_stats(f, &sync, &snr_est);
>>> > > nin = freedv_nin(f);
>>> > >
>>> > > ---------
>>> > > Can I do this without causing any problems?
>>> > >
>>> > > I'm concerned that routines called by freedv_rx() will have
>>> > > already processed the demod_in audio data.
>>> > >
>>> > > Alan VK2ZIW
>>> > >
>>> > > On Tue, 16 Jun 2020 17:58:14 +0200, Jeroen Vreeken wrote
>>> > > > Hi Al,
>>> > > >
>>> > > > Until recently you would have needed the freedv_codecrx() and
>>> > > > freedv_codectx() functions.
>>> > > > If you have the 'latest greatest' git version you will need to
>>> use
>>> > > > freedv_rawdatarx() and freedv_rawdatatx()
>>> > > >
>>> > > > 73,
>>> > > > Jeroen PE1RXQ
>>> > > >
>>> > > > On 06/16/2020 12:42 PM, Al Beard wrote:
>>> > > > > Hi all,
>>> > > > >
>>> > > > > Yes, it's been eighteen months since lightning blew my shack
>>> > > > > radios and computers and now I want to use the latest Codec2
>>> > > > > library code in a repeater.
>>> > > > >
>>> > > > > Starting with the "freebeacon" code, I want to retransmit
>>> the received
>>> > > > > 700C data and include the text string or strings.
>>> > > > > So the first step is to receive the "packed data bits".
>>> > > > >
>>> > > > > Can somebody point me to a function in freedv_api.x that
>>> will allow
>>> > > > > getting the "packed data bits" ?
>>> > > > >
>>> > > > > (In the past, I had to add a function.)
>>> > > > >
>>> > > > > 73 There is a valve type 73, has anybody used it in a
>>> transmitter
>>> > > > > or receiver?
>>> > > > > ---------------------------------------------------
>>> > > > > Alan VK2ZIW
>>> > > > >
>>> > > > > OpenWebMail 2.53
>>> > > > >
>>> > > > >
>>> > > > >
>>> > > > > _______________________________________________
>>> > > > > Freetel-codec2 mailing list
>>> > > > > [email protected]
>>> > > > > https://lists.sourceforge.net/lists/listinfo/freetel-codec2
>>> > > > >
>>> > > >
>>> > > > _______________________________________________
>>> > > > Freetel-codec2 mailing list
>>> > > > [email protected]
>>> > > > https://lists.sourceforge.net/lists/listinfo/freetel-codec2
>>> > >
>>> > > ---------------------------------------------------
>>> > > Alan Beard
>>> > >
>>> > > OpenWebMail 2.53
>>> > >
>>> > >
>>>
>>> > >
>>> > >
>>>
>>> > >
>>> _______________________________________________
>>> Freetel-codec2 mailing
>>>
>>> list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/freetel-codec2
>>>
>>
>> >
>> > ---------------------------------------------------
>> > Alan Beard
>> >
>> > OpenWebMail 2.53
>> >
>> >
>> >
>>
>> >
>> >
>>
>> >
>> _______________________________________________
>> Freetel-codec2 mailing
>> list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/freetel-codec2
>>
>
>
>
> ---------------------------------------------------
> Alan Beard
>
> OpenWebMail 2.53
>
>
>
>
>
> _______________________________________________
> Freetel-codec2 mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/freetel-codec2
_______________________________________________
Freetel-codec2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freetel-codec2