DSD FME

Digonding

Member
Joined
Jan 4, 2024
Messages
9
Okay, its DMR Simplex. Guess I never tested that type before when making raw wav files. I just went and tested that functionality, and it doesn't work for me either. I think what is happening is that samples are being dropped and not properly writen to the wav file due to the absence of the other slot, as it were. I'll have to take a look at the code at some point, and see if anything can be done to fix it.

In the meantime, if you need a capture to playback later on in DSD-FME, just use the -c capture.bin symbol capture method instead, those work properly when played back using dsd-fme -i capture.bin
The -c function works correctly. There may be the same problem with the -d function (capture .amb).

When I capture a DMR simplex with no encryption, all frames are in the .amb file but when I capture a DMR simplex encrypted in ARC4 (without giving the key), there is hardly any frame in the .amb file.

It would be nice to be able to capture all the frames in all cases.
 

lwvmobile

DSD-FME
Joined
Apr 26, 2020
Messages
1,297
Location
Lafayette County, FL
There may be the same problem with the -d function (capture .amb).
Actually, that one is by design. I don't write decoded voice wav files or .amb/.imb files if the source is encrypted and no key is supplied.

In terms of the .amb/.imb files, without a proper point of reference (i.e., the start of the superframe, key id, alg id, MI) then there would be no way to decyrpt them later on, the only outlier being Moto BP which treats every ambe frame the same. .amb/.imb files do not store any more information than the 49-bit or 88-bit voice frame + its error value.

In order to make the change to always save amb files, you would need to find the relevant code in dsd_mbe.c and remove the encryption conditional check.

Code:
//restore MBE file save, slot 1 -- consider saving even if enc
if (opts->mbe_out_f != NULL && (state->dmr_encL == 0 || opts->dmr_mute_encL == 0) )
{
    saveAmbe2450Data (opts, state, ambe_d);
}

would need to be

Code:
//restore MBE file save, slot 1 -- consider saving even if enc
if (opts->mbe_out_f != NULL)
{
    saveAmbe2450Data (opts, state, ambe_d);
}

And also the same for slot 2 as well. Keep in mind, I don't plan on making this change to the base source code myself, as this way my intention for .amb and .imb files.

It would be nice to be able to capture all the frames in all cases.

The symbol capture bin files are the preferred method for saving and playback, as they capture everything and allow replay of everything, including the voice frame headers with encryption parameters, sync patters, etc which do allow for a point of reference for keystream generation, and provide correct encryption parameters for decryption. OP25 symbol capture bins are also compatible with DSD-FME, and those can be played back as well (sadly I couldn't make it a two way street due and have OP25 work with DSD-FME capture bins due to differences in how frame sync is handled). The raw wav files are the secondary option, and are tested to work under most circumstances, DMR Simplex aside. In a future release, I may be able to rectify that, but I'm not planning on putting much effort into tracking down the root cause, I treid a few minor things last night to no avail. I think its just the sudden jitter induced by the lack of signal from the off slot that causes it to not write the sample and messes up the synchronization of the wav file.
 

Digonding

Member
Joined
Jan 4, 2024
Messages
9
Thanks, it works by modifying the code.
It's a shame you don't add an option because people who want to study encryption may need to capture encrypted frames. It's not just ARC4 with MIs, there are many other ciphers that encrypt a superframe identically (like Hytera Basic) or others.

And in this case, when you want to study the cipher frames, it's much easier to extract them from an.amb file rather than copying and pasting from the screen.
 

lwvmobile

DSD-FME
Joined
Apr 26, 2020
Messages
1,297
Location
Lafayette County, FL
It's a shame you don't add an option

I believe that's actually what the mute toggle option is for, should be in the ncurses menu somewhere. I don't have a CLI option for it, however. I had forgotten about it, as I never use it. I assume it still works properly given all the changes since its original implementation.

because people who want to study encryption may need to capture encrypted frames. It's not just ARC4 with MIs, there are many other ciphers that encrypt a superframe identically (like Hytera Basic) or others.

Uh-huh.

And in this case, when you want to study the cipher frames, it's much easier to extract them from an.amb file rather than copying and pasting from the screen.

If you say so.
 

lwvmobile

DSD-FME
Joined
Apr 26, 2020
Messages
1,297
Location
Lafayette County, FL
I'll have to take a look at the code at some point, and see if anything can be done to fix it.

I took a second look at the code, and found the offending lines that are preventing DMR Simplex raw wav files (and also causing random issues when both saving raw wav files of any system while also monitoring raw audio simultaneously).

In dsd_symbol.c, you'll need to look for these lines starting on line 271:

Code:
//do an extra checkfor carrier signal so that random raw audio spurts don't play during decoding
if ( (state->carrier == 1) && ((time(NULL) - state->last_vc_sync_time) < 2))
{
    memset (state->analog_out, 0, sizeof(state->analog_out));
    state->analog_sample_counter = 0;
}

and just comment them out entirely, I don't think that code snippet works the way I had intended for it to work anyways.

Code:
// //do an extra checkfor carrier signal so that random raw audio spurts don't play during decoding
// if ( (state->carrier == 1) && ((time(NULL) - state->last_vc_sync_time) < 2))
// {
//   memset (state->analog_out, 0, sizeof(state->analog_out));
//   state->analog_sample_counter = 0;
// } //This is the root cause of issue listed above, will evaluate further at a later time for a more elegant solution, or determine if anything is negatively impacted by removing this
 

LimaZulu

Member
Joined
Jul 7, 2011
Messages
375
It seems that -P for per call recording does not work for me. If I tun it on from the menu it does record just fine.It just does not start automatically. I am using latest aw 20240101 patch . Here is an example of one of my my start up files:

Code:
dsd-fme-aw-lz.exe -i tcp:localhost:7353 -fi -mc -g -P -N 2> NUL

And one request for @lwvmobile to consider - maybe an option to automatically delete older recordings as their count can grow up really fast and take up really big part of the free space on busy systems. The one that I am monitoring is not so traffic intensive and yet the amount of files becomes huge very fast and the space taken as well. Maybe an option to delete files older than 3 days or maybe a week. If not that, at least sorting into different folders by date - each day -> new folder. At least that will speed up the folder opening times, sorting files by date, name etc. Same can be done for logs as well. Currently I use to turn off logging for daily monitoring. I do logging only when trying to discover something or on new system just for the sake of curiosity.
 

ki4hyf

Member
Premium Subscriber
Joined
Mar 2, 2005
Messages
217
Location
Jackson, TN
-mc is redundant, as it's the default. No big deal, but not needed. -g expects a number for the audio gain and sees -P, probably making it ineffective.

maybe an option to automatically delete older recordings

That would be on you to run cron or whatever Windows does to rotate logs.
 

LimaZulu

Member
Joined
Jul 7, 2011
Messages
375
-mc is redundant, as it's the default. No big deal, but not needed. -g expects a number for the audio gain and sees -P, probably making it ineffective.
With or without -g, the result is always the same

That would be on you to run cron or whatever Windows does to rotate logs.

Well, I wasn't asking if it's my job or not. I was just proposing an option to be considered and it is a developer kob to decide if he wants to be my job or not ;)
 

lwvmobile

DSD-FME
Joined
Apr 26, 2020
Messages
1,297
Location
Lafayette County, FL
dsd-fme-aw-lz.exe -i tcp:localhost:7353 -fi -mc -g -P -N 2> NUL
You can't have a switch which needs a value arg go to another switch, it things the value for -g is -P, -g requires a value.

it is a developer kob to decide if he wants to be my job or not
I believe you've kept me busy on things for long enough.
 

ki4hyf

Member
Premium Subscriber
Joined
Mar 2, 2005
Messages
217
Location
Jackson, TN
Well, I wasn't asking if it's my job or not. I was just proposing an option to be considered and it is a developer kob to decide if he wants to be my job or not ;)
Fair enough, but it would break things for me, and probably others.
 

LimaZulu

Member
Joined
Jul 7, 2011
Messages
375
You can't have a switch which needs a value arg go to another switch, it things the value for -g is -P, -g requires a value.
Ok but as I already said even without -g the result is the same.

I believe you've kept me busy on things for long enough.
To be honest I only had one request so far and the rest is all bug fixes, but it seems that exceeded my maximum allowed requests :)
Anyways, I guess that's your polite way to say "No and stop asking!". Fair enough. Good luck with your project and thanks for the work done! :) I will still check it from time to time in hope that one day the issue with the spontaneous errors we were discussing will be observed and fixed ;)
 

luciano_frc

Member
Joined
Jan 15, 2024
Messages
8
hello everybody I'm new to SDR, I acquired an RTL-SDR V4 and I've been adventuring here, I've been using DSD-FME installed on my Ubuntu 22.04 relatively I have been successful in DMR but in my region I have many transmissions in P25 (phase1) I've been looking for a guide or tutorial on how to use DSD-FME to decode the P25 but, honestly, I've found things that make little sense and don't work, perhaps due to my lack of experience. Is there any tutorial you can recommend to me? I haven't had any luck with the DSD-FME documentation. Thanks in advance
 

lwvmobile

DSD-FME
Joined
Apr 26, 2020
Messages
1,297
Location
Lafayette County, FL
hello everybody I'm new to SDR, I acquired an RTL-SDR V4 and I've been adventuring here, I've been using DSD-FME installed on my Ubuntu 22.04 relatively I have been successful in DMR but in my region I have many transmissions in P25 (phase1) I've been looking for a guide or tutorial on how to use DSD-FME to decode the P25 but, honestly, I've found things that make little sense and don't work, perhaps due to my lack of experience. Is there any tutorial you can recommend to me? I haven't had any luck with the DSD-FME documentation. Thanks in advance

Well, what are you currently doing for DMR that is working? What software are you using for it?
 

lwvmobile

DSD-FME
Joined
Apr 26, 2020
Messages
1,297
Location
Lafayette County, FL
thanks for the quick response SDR++ is used configured to list audio to network, I will leave the video below, I can decode DMR well

Looks like DMR Reception in the video. Well, what happens when you try to decode Phase 1 using the same method?

Might be worth while to open another terminal tab there and run tail -n 40 -f log.ans and see what output you get if there are errors, etc. Also, is the Phase 1 system a trunking system? Or just single frequency?
 

luciano_frc

Member
Joined
Jan 15, 2024
Messages
8
what happens when you try to decode Phase 1 using the same method?
nothing happens, I don't hear the audio at all
the Phase 1 system a trunking system? Or just single frequency?
That's a good question, I don't know how to answer it precisely, but I believe it's trunking
When it's trunking, I need the control channel, correct? Can I find the control channel through SDR++? I will leave two screens below, one is from the channel in p25 and the other is output from the terminal with tail -n 40 -f log.ans

Captura de tela de 2024-01-22 18-15-57.png


Captura de tela de 2024-01-22 18-17-02.png
 

lwvmobile

DSD-FME
Joined
Apr 26, 2020
Messages
1,297
Location
Lafayette County, FL
That's a good question, I don't know how to answer it precisely, but I believe it's trunking

Looks like that is the control channel on 169.47 Mhz. On P25 (phase 1) the TSBK are the 'trunking signal blocks' so, you've definitely found the control channel. In order to tune those frequencies, you'll need to set up the RIGCTL module inside of SDR++ with the settings found here and have it started and in the listening status. If you don't have a RIGCTL module active, you'll need to scroll down to the bottom and select it from the drop down box and add it first.

Screenshot from 2023-06-14 22-55-32.png

Then, what you'll want to do is append the options -U 4532 -T to your start up command, so that is looks similar to below.

Code:
dsd-fme -ft -i tcp -U 4532 -T -N 2> log.ans

Since this is P25, you won't need to specify a channel map, as it can figure it out from the Identifier Update TSBKs and tune you to the correct frequencies based on the iden value. You could also do the same for DMR, NXDN, EDACS trunking as well, but those will most likely always need a channel map, unless they have a form of absolute channel assignment (DMR Absolute, NXDN DFA) signalling.
 
Top