Fix minimum volume is too loud issue on DM-1701

Discussions related to the firmware code development
Post Reply
EA5HAV
Posts: 6
Joined: Sun Jan 26, 2025 8:51 pm

Fix minimum volume is too loud issue on DM-1701

Post by EA5HAV » Sun Jan 26, 2025 11:08 pm

I propose this solution to the issue of the minimum volume being too loud on the Baofeng DM-1701:

Code: Select all

diff --git a/opengd77/MDUV380_firmware/application/include/functions/sound.h b/opengd77/MDUV380_firmware/application/include/fun
ctions/sound.h
index 63f0607..94e1b7a 100644
--- a/opengd77/MDUV380_firmware/application/include/functions/sound.h
+++ b/opengd77/MDUV380_firmware/application/include/functions/sound.h
@@ -73,7 +73,7 @@ extern volatile float dmrRxAGCrxPeakAverage;
 #define HOTSPOT_BUFFER_SIZE                      50U
 #define HOTSPOT_BUFFER_COUNT                     48U

-#define DMR_RX_AGC_DEFAULT_PEAK_SAMPLES                        2000.0f
+#define DMR_RX_AGC_DEFAULT_PEAK_SAMPLES                        250.0f

 extern union sharedDataBuffer
 {
diff --git a/opengd77/MDUV380_firmware/application/source/user_interface/menuSoundOptions.c b/opengd77/MDUV380_firmware/applicat
ion/source/user_interface/menuSoundOptions.c
index cf356a1..75e209f 100644
--- a/opengd77/MDUV380_firmware/application/source/user_interface/menuSoundOptions.c
+++ b/opengd77/MDUV380_firmware/application/source/user_interface/menuSoundOptions.c
@@ -264,7 +264,7 @@ static void updateScreen(bool isFirstRun)
                                        leftSide = currentLanguage->dmr_rx_agc;
                                        if (nonVolatileSettings.DMR_RxAGC != 0)
                                        {
-                                               snprintf(rightSideVar, SCREEN_LINE_BUFFER_SIZE, "%ddB", ((nonVolatileSettings.DM
R_RxAGC - 1) * 3));
+                                               snprintf(rightSideVar, SCREEN_LINE_BUFFER_SIZE, "%ddB", ((nonVolatileSettings.DMR_RxAGC - 4) * 3));
                                        }
                                        else
                                        {
The change is basically to lower DMR_RX_AGC_DEFAULT_PEAK_SAMPLES by 9dB. As a result, the former DMR Rx AGC possible choices from 0 to 21dB have been remapped to -9 to 12 dB on the UI:

Image

Note since I'm only shifting everything 9dB downwards and AGC_SETTINGS_LUT remains unaltered, gains from 15 to 21 are lost. This looks like an acceptable compromise to me as these gain values produced clipping distortion at least on my unit.

Thanks for your consideration and for the great job!

VK3KYY
Posts: 8498
Joined: Sat Nov 16, 2019 3:25 am
Location: Melbourne, Australia

Re: Fix minimum volume is too loud issue on DM-1701

Post by VK3KYY » Sun Jan 26, 2025 11:17 pm

EA5HAV wrote:
Sun Jan 26, 2025 11:08 pm
I propose this solution to the issue of the minimum volume being too loud on the Baofeng DM-1701:

Code: Select all

diff --git a/opengd77/MDUV380_firmware/application/include/functions/sound.h b/opengd77/MDUV380_firmware/application/include/fun
ctions/sound.h
index 63f0607..94e1b7a 100644
--- a/opengd77/MDUV380_firmware/application/include/functions/sound.h
+++ b/opengd77/MDUV380_firmware/application/include/functions/sound.h
@@ -73,7 +73,7 @@ extern volatile float dmrRxAGCrxPeakAverage;
 #define HOTSPOT_BUFFER_SIZE                      50U
 #define HOTSPOT_BUFFER_COUNT                     48U

-#define DMR_RX_AGC_DEFAULT_PEAK_SAMPLES                        2000.0f
+#define DMR_RX_AGC_DEFAULT_PEAK_SAMPLES                        250.0f

 extern union sharedDataBuffer
 {
diff --git a/opengd77/MDUV380_firmware/application/source/user_interface/menuSoundOptions.c b/opengd77/MDUV380_firmware/applicat
ion/source/user_interface/menuSoundOptions.c
index cf356a1..75e209f 100644
--- a/opengd77/MDUV380_firmware/application/source/user_interface/menuSoundOptions.c
+++ b/opengd77/MDUV380_firmware/application/source/user_interface/menuSoundOptions.c
@@ -264,7 +264,7 @@ static void updateScreen(bool isFirstRun)
                                        leftSide = currentLanguage->dmr_rx_agc;
                                        if (nonVolatileSettings.DMR_RxAGC != 0)
                                        {
-                                               snprintf(rightSideVar, SCREEN_LINE_BUFFER_SIZE, "%ddB", ((nonVolatileSettings.DM
R_RxAGC - 1) * 3));
+                                               snprintf(rightSideVar, SCREEN_LINE_BUFFER_SIZE, "%ddB", ((nonVolatileSettings.DMR_RxAGC - 4) * 3));
                                        }
                                        else
                                        {
The change is basically to lower DMR_RX_AGC_DEFAULT_PEAK_SAMPLES by 9dB. As a result, the former DMR Rx AGC possible choices from 0 to 21dB have been remapped to -9 to 12 dB on the UI:

Image

Note since I'm only shifting everything 9dB downwards and AGC_SETTINGS_LUT remains unaltered, gains from 15 to 21 are lost. This looks like an acceptable compromise to me as these gain values produced clipping distortion at least on my unit.

Thanks for your consideration and for the great job!

So you are proposing that the maximum DMR audio gain is reduced from 21 to 12dB?

If so, won't this affect people who need DMR gain of above 12dB ??

AFIK. Even with several thousand people using OpenGD77 on the DM1701, no one else reported any need to change the DMR audio gain beyond its current limits.

EA5HAV
Posts: 6
Joined: Sun Jan 26, 2025 8:51 pm

Re: Fix minimum volume is too loud issue on DM-1701

Post by EA5HAV » Mon Jan 27, 2025 12:02 am

You could get these 3 gain steps back by adding 3 extra multipliers to AGC_SETTINGS_LUT at sound.h:

Code: Select all

static int AGC_SETTINGS_LUT[]= {1,2,4,8,16,32,64,128,256,512,1024};
And setting DMR_RX_AGC_MAX to 11 in menuSoundOptions.c.

BTW, looking at this code, some platforms allow up to 16 gain steps, wouldn't this cause an AGC_SETTINGS_LUT buffer overrun? 🤔

Code: Select all

#if defined(PLATFORM_GD77) || defined(PLATFORM_GD77S) || defined(PLATFORM_DM1801) || defined(PLATFORM_DM1801A) || defined(PLATFORM_RD5R)
#define DMR_RX_AGC_MAX 16
#define FM_MIC_GAIN_MIN 1  // Limit to min 1, as 0: no audio
#define FM_MIC_GAIN_MAX 31
#elif defined(PLATFORM_MD9600)
#define DMR_RX_AGC_MAX 16
#define FM_MIC_GAIN_MIN 0
#define FM_MIC_GAIN_MAX 15
#else
#define DMR_RX_AGC_MAX 8
#define FM_MIC_GAIN_MIN 0
#define FM_MIC_GAIN_MAX 15
#endif
Not sure why no one else reported is. But the fact is that this radio is too loud at its minimum volume especially if you are in a quiet environment, eg. at nights with kids already sleeping etc.

VK3KYY
Posts: 8498
Joined: Sat Nov 16, 2019 3:25 am
Location: Melbourne, Australia

Re: Fix minimum volume is too loud issue on DM-1701

Post by VK3KYY » Mon Jan 27, 2025 2:42 am

Did you try more than one DM1701?

Is there a possibility you have a hardware fault on your radio which casues the volume to not work correctly?

I checked with some other DM1701 owners and no one else seems to have the problem you are experiencing.

User avatar
F1RMB
Posts: 3096
Joined: Sat Nov 16, 2019 5:42 am
Location: Grenoble, France

Re: Fix minimum volume is too loud issue on DM-1701

Post by F1RMB » Mon Jan 27, 2025 3:57 am

The original "too loud" volume on the DM-1701 was fixed around May 2024.
I also re-checked that, and it works as expected.
So, as Roger wrote, maybe your transceiver may have a HW problem.
What about the volume notification, can you control the lowest volume levels (1 to 3 pixels wide) ?.

VK3KYY
Posts: 8498
Joined: Sat Nov 16, 2019 3:25 am
Location: Melbourne, Australia

Re: Fix minimum volume is too loud issue on DM-1701

Post by VK3KYY » Mon Jan 27, 2025 6:51 am

EA5HAV wrote:
Mon Jan 27, 2025 12:02 am
....
Can you also confirm that the volume level is too loud when you don't use DMR AGC ??

EA5HAV
Posts: 6
Joined: Sun Jan 26, 2025 8:51 pm

Re: Fix minimum volume is too loud issue on DM-1701

Post by EA5HAV » Mon Jan 27, 2025 2:17 pm

VK3KYY wrote:
Mon Jan 27, 2025 2:42 am
Did you try more than one DM1701?
I did try two Baofengs DM-1701 bought more than 1 year apart.
VK3KYY wrote:
Mon Jan 27, 2025 6:51 am
Can you also confirm that the volume level is too loud when you don't use DMR AGC ??
Yes. See video below.
F1RMB wrote:
Mon Jan 27, 2025 3:57 am
What about the volume notification, can you control the lowest volume levels (1 to 3 pixels wide) ?.
I think so. I can go from mute to 1 px, then 2 px, then it skips 3 and jumps to 4 px if I can see correctly. Then backwards 4px goes to 2px then mute.

Anyway I recorded a video with volume set at 1 px, AGC OFF. Maybe this is a matter of perception or I have too sensitive an ear, IDK. But at night with kids sleeping this is loud to me and having some negative AGC gets the job done and I believe the impact in ROM usage is minimum (3 extra ints if you want to keep gains 15-21, none otherwise).


youtu.be/wO5ubLp3U0Q
Last edited by EA5HAV on Mon Jan 27, 2025 2:39 pm, edited 1 time in total.

EA5HAV
Posts: 6
Joined: Sun Jan 26, 2025 8:51 pm

Re: Fix minimum volume is too loud issue on DM-1701

Post by EA5HAV » Mon Jan 27, 2025 2:34 pm

Here is another video with AGC at 0dB and volume at 1px.


youtu.be/XDKHEBM0khE

And here is complaint about the same thing (he's reviewing the original fw, though).
Note: One issue with the radios I tested was the volume control level. On DMR, the volume range is from 100% (full) to about 15%, then sharply drops to zero. There is no low volume position. On analog, minimum is even louder.

I installed a 29 ohm resister in series with the speaker line to cut back the levels.

VK3KYY
Posts: 8498
Joined: Sat Nov 16, 2019 3:25 am
Location: Melbourne, Australia

Re: Fix minimum volume is too loud issue on DM-1701

Post by VK3KYY » Mon Jan 27, 2025 8:28 pm

You use-case does not seem to be normal, i.e these radios are not designed for quiet listening at night.

Although you could modify the firmware, for you own use-case, I don't think this is the optimal method to reduce the volume, because the signal to noise ratio will get worse as you reduce the numerical values of the audio signal samples.
This is because these radios are inherently noisy on their internal supplies, and the audio amp will be designed to operate in the normal analogue signal output by the DMR chip

Your solution to use a resistor will probably produce better quality audio than attempting to accomplish the same task in the digital domain

EA5HAV
Posts: 6
Joined: Sun Jan 26, 2025 8:51 pm

Re: Fix minimum volume is too loud issue on DM-1701

Post by EA5HAV » Mon Jan 27, 2025 10:15 pm

Thanks for the advice!

Here is the firmware with the proposed change in case it helps anyone.

Cheers.

Post Reply