f4exb / dsdcc

Digital Speech Decoder (DSD) rewritten as a C++ library
286 stars 60 forks source link

Decoding framed AMBE data #19

Closed nostar closed 5 years ago

nostar commented 5 years ago

Hi, is it possible to decode 48 byte framed AMBE data that is used by DSTAR reflectors over UDP? I think all the decoding done of RF data is unframed AMBE serial data, is that correct?

f4exb commented 5 years ago

I don't know what you are talking about. Can you please include reference to parts of the DSTAR protocol that refers to this?

nostar commented 5 years ago

Here is a document that describes the DSTAR UDP streams.

http://www.qsl.net/kb9mwr/projects/dv/dstar/formats%20of%20files%20and%20UDP-streams%20used%20on%20D-STAR.pdf

I am currently receiving UDP data like this from various reflectors and I would like to decode the ambe audio data, but I think that the dsd(cc)/mbelib is written to only decode the unframed type of AMBE data, as defined in the AMBE 2020 datasheet. The framed mode is a 48 byte packet where, for the speed of DSTAR, only 9 bytes (all 24 bytes are used per frame for 9600) of voice data is sent per 20ms frame. Those 9 bytes come from each of the UDP packets sent by a reflector that a receiving device uses to generate a 48 byte AMBE 'frame' to be sent to a chip. I am generating those 48 byte frames that are usually sent to some sort of hardware AMBE dongle, but I dont think these frames are recognized by dsd(cc)/mbelib. I have lots of raw data if you interested in seeing more about this.

nostar commented 5 years ago

I've got it all figured out now. I am listening to D-STAR reflectors/repeaters over UDP streams by passing the 9 bytes of AMBE data from each UDP packet to mbelib via this function, bypassing all of the DSDcc demodulation/processing of the SDR data. This works really well:

process_voice(unsigned char *d)
{
    char ambe_fr[4][24];
    memset(ambe_fr, 0, 96);
    w = dW;
    x = dX;
    for(int i = 0; i < 9; ++i){
        for(int j = 0; j < 8; ++j){
            ambe_fr[*w][*x] = (1 & (d[i] >> j));
            w++;
            x++;
        }
    }
    mbe_processAmbe3600x2400Framef(m_audio_out_temp_buf, &m_errs, &m_errs2, m_err_str, ambe_fr, ambe_d,m_mbelibParms-> m_cur_mp, m_mbelibParms->m_prev_mp, m_mbelibParms->m_prev_mp_enhanced, 3);
    processAudio();
}
f4exb commented 5 years ago

So you are processing UDP blocks from the network. I don't see the connection with DSDcc that is meant to decode the FM discriminator output in a transmission sent over the air.

nostar commented 5 years ago

I do

f4exb commented 5 years ago

I don't see the relation with dsdcc sorry so I am going to close this issue