I am getting ready to tackle converting raw IF audio into P25 CC data. What I was hoping someone could answer is if the audio can be converted immediately or if needs to be decoded from another format before you get the 12 Octets of data?
Have you looked at op25? Everything you need is already there. Here's an outline. You said IF so I assume you mean IQ data. You can skip steps 0-4 if you use SDR software (like SDR#) to pipe discriminator audio into your application.
0. translation: if the IF isn't centered around the desired frequency - you'll need to translate by multiplying by a quadrature sine wave.
1. decimation: if the IF sample rate is well above normal audio sample rates (above 96 khz), you'll need to re-sample the data at a lower rate. This will also lower CPU cost for subsequent stages.
2. Low pass filter both I and Q channels - around 6 to 7 khz wide.
3. FM demodulate - you can use the arc-tangent function for this. Now you have discriminator audio.
4. Low pass filter - the P25 standard recommends a cut-off at 2880 hertz.
5. symbol recovery - convert a 1/4800th segment of audio samples to a symbol value where each symbol is two bits. Your code needs to recognize the boundary where one symbol ends and then next begins.
6. frame synchronization - as these symbols fly past, you must locate the frame synchronization pattern. The pattern is 24 symbols long.
7. Accumulate symbols. Know that every 36th symbol is a status symbol. These are stripped out when assembling TSBKs.
8. NID - the next 32 symbols carry the NID which is a 12 bit NAC, 4 bit DUID and 48 bits of error correction. Skip the 12th symbol - which is a status symbol (see 7 above).
9. Use the correction bits to get a reliable NAC and DUID. The TIA docs explain how to compose the NID bits given a DUID and NAC. You want the reverse.
10. When the DUID equals 12 or 7, you have one or more TSBKs following.
11. Accumulate symbols. These are interleaved "constellation" symbols.
12. De-interleave: the TIA docs explain the interleave schedule for transmit. You want the reverse.
13. The TIA docs explain how to map trellis symbols to constellation symbols for transmit. Again, you want the reverse.
14. Apply half-rate trellis correction to the trellis symbols. For every four bits in, you get two bits out.
15: TSBKs! To validate each TSBK, apply the CCITT CRC-16 to the first 10 bytes. The result should match the last two bytes.