Notice: A non well formed numeric value encountered in /sites/ on line 96 Notice: A non well formed numeric value encountered in /sites/ on line 96 Notice: A non well formed numeric value encountered in /sites/ on line 96 Deprecated: Function create_function() is deprecated in /sites/ on line 104 Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /sites/ on line 845 Deprecated: Function create_function() is deprecated in /sites/ on line 111 FS#11364 : AS3543 volume increase



FS#11364 - AS3543 volume increase

Attached to Project: Rockbox
Opened by MichaelGiacomelli (saratoga) - Sunday, 06 June 2010, 18:32 GMT
Last edited by MichaelGiacomelli (saratoga) - Thursday, 24 June 2010, 01:15 GMT
Task Type Patches
Category Drivers
Status Closed
Assigned To No-one
Operating System Another
Severity Low
Priority Normal
Reported Version Release 3.6
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Volume tests of RB, the OF, and different amp settings are here:

RMAA tests driving a load for the OF, RB and various settings are here:

Specifically, these two entries for the current SVN build and the patched one:


The AS chips use a two step volume control with separate levels for the DAC and headphone amp. This patch increases the DAC volume 7dB. So basically, +6dB in the current build (which does not distort) becomes 0dB in the patch (which also does not distort). The new +6dB corresponds to actually over driving the amp, and does distort (but probably not enough to notice in real music verses a full scale test tone).

Interestingly the OF can drive as loud as our new +6dB with very little distortion, which might suggest we don't have one of the voltages set right somewhere. If we ever get a JTAGed as3525v2 player it would be great to dump the AS3543 registers.
This task depends upon

Closed by  MichaelGiacomelli (saratoga)
Thursday, 24 June 2010, 01:15 GMT
Reason for closing:  Accepted
Additional comments about closing:  Committed as r27101.
Comment by Rafaël Carré (funman) - Monday, 07 June 2010, 14:34 GMT
ranma has jtaged Clip+ but I'm not sure if he could run the OF yet since the internal storage is broken

Perhaps the difference in volume comes from using microphone/FM/PCM muxing?

I only have my sound card line in to make recordings, is it enough to compare clip+ with clipv2 and fuzev2 ?
Comment by MichaelGiacomelli (saratoga) - Monday, 07 June 2010, 14:39 GMT
A typical line in should be fine. Although if your sound card is very poor like mine the SNR figures may not mean much, the THD measurements should still be good.

That said, even with this patch, the THD is still nearly 0 at 0dB, and surprisingly low even at +6dB, so I don't see figuring out exactly what the OF does as all that important.
Comment by Rafaël Carré (funman) - Thursday, 10 June 2010, 13:38 GMT
Perhaps it would be simpler to define something to 0x1b/0x16, and just use that define in the conditions?
Comment by Sanggon, Lee (isanggon) - Monday, 14 June 2010, 00:55 GMT
I measured OF / RB / RB with 0x1b with emu0404usb and portable multimeter.

Attached files are RMAA data. RB's IMD at low frequency is not as good as OF, but it seems, 0x1b with +6db have steel good performance.

Measured volume level is,
OF : 0.546V
RB with 0x1b : 0.310V

Thank you for this great work.

Comment by MichaelGiacomelli (saratoga) - Monday, 14 June 2010, 00:58 GMT
Was this with my patch or did you just edit the code yourself?
Comment by Sanggon, Lee (isanggon) - Monday, 14 June 2010, 01:10 GMT
It is your patch with no modification. I applied with patch with slitly modified latest RB(26809 +  FS#11364  - AS3543 volume increase + FS#11297_as3525v2-cpufreq-v10.diff).

All test was with Maximum volume (RB with +6).

Comment by MichaelGiacomelli (saratoga) - Monday, 14 June 2010, 01:13 GMT
Did you confirm that the final volume was louder then SVN?
Comment by Sanggon, Lee (isanggon) - Monday, 14 June 2010, 01:16 GMT
I tested unmodified RB, too. It's volume level was 0.310V.
It seems something wrong with my test. I'll test again with clean RB with this patch only.
Comment by MichaelGiacomelli (saratoga) - Monday, 14 June 2010, 01:23 GMT
No that makes sense. Looking at the code I wasn't sure if this actually boosted the volume or just raised the DAC volume and lowered the amp volume by the same amount. I think the volume scale needs to be changed so that +6 in the current build becomes 0 dB and you can go to what used to be +12dB.
Comment by Sanggon, Lee (isanggon) - Monday, 14 June 2010, 13:59 GMT
I tested clean RB (26832) with this patch.

Both clean RB and patched RB have 0.310V of max volume (at +6). The result comes different with your test results.

Is this patch need to sync?

Comment by Martin Sägmüller (dfkt) - Wednesday, 16 June 2010, 14:59 GMT
I've tested this patch against the other variants suggested by Funman and Timar, and against the default build. Results are unexpected:
Comment by Nick Peskett (nickp) - Thursday, 17 June 2010, 01:47 GMT
Here's a patch against r26873 that includes Funman's suggested method of only altering the mix_l/ mix_r values;

I used value 0x1b and kept Saratoga's "if CONFIG_CPU == AS3525v2" condition, but thought I'd stick this around just the mix_(l|r) values.

These are the results I got by playing a normalised white noise file on the Clip+ at maximum volume/ +6db, recorded using an M-Audio Audiophile 2496, from Cooledit Pro's "statistics".

Peak Average
Amplitude RMS
Original WAV 0 -9.42
Original Firmware -5.6 -16.71
Trunk (r26873) -10.36 -21.515
All 0x1b * -11.64 -22.89
mix_lr 0x1b ** -4.415 -15.395

* vol1.patch
** volume-only_mix_lr-r26873.patch

RMAA tests can be found below. I tried to include results for the trunk build, but I gave up as RightMark seemed to be having problems with the output.
Comment by MichaelGiacomelli (saratoga) - Thursday, 17 June 2010, 02:07 GMT
This is just the patch posted on ABI a couple weeks ago with my comments from the above patch. See the ABI clip+ thread, it screws up the volume because it doesn't change the volume in the if (vol_r <= ... line like the patch I posted above does. Try scrolling from low volume to high volume and you'll see why thats a problem.

Since you're actually increasing the volume range 6dB, you need to change rockbox to go from a volume of -72.5 - +6dB to -88dB - +6dB, otherwise you'll get that weird jump in volume.
Comment by Sanggon, Lee (isanggon) - Thursday, 17 June 2010, 04:27 GMT
Nick Peskett's modified patch was worked. It gives more vol than OF to sansa clip+.

OF : 0.546V (MAX)
RB with nickp's patch : 0.66V at +6, 0.369 at 0

And I checked clipping problem with DSSF3's software oscillator.

OF shows clipping at 0.546V. But at 0.324V, OF doesn't clipped. More than 0.324V, OF shows clipping.
RB doesn't clipped still 0.369V (0).More than 0.369V, RB shows clipping.

With nickp's patch we can have more volume with no clipping(0.369V) than OF(0.324V).

But nickp's patch gives same vol at 0 and 1 (0.369V). Maybe this problem should be corrected.

Comment by Nick Peskett (nickp) - Thursday, 17 June 2010, 04:56 GMT
Ah yes, I'm noticing the jump between -40 & -39. I see it mentioned in the ABI thread now, sorry.

My headphones aren't very sensitive, so had never ventured down that low.

Yes, the patch I uploaded is entirely derived from the postings on the ABI thread (mainly timar, dfkt, funman & saratoga), but mainly I found snippets of code rather than a patch, so thought I'd post something here for people looking for a simple volume boost patch (seemed a better place). I seem to have added to the confusion though!
Comment by MichaelGiacomelli (saratoga) - Thursday, 17 June 2010, 05:08 GMT
Heres a quick and dirty attempt. Not sure if its correct, but it does scale the volume continuously and I think its louder.

Edit: this will also break on the AMSv1 players, but its a start.
Comment by Nick Peskett (nickp) - Thursday, 17 June 2010, 06:01 GMT
Your clip_vol_v2.patch looks (and sounds) pretty good.

Loudest results so far using the white noise clip I tested earlier;

Peak Amplitude: -4.06 dB (OF: -5.6dB)
Average RMS: -14.85 dB (OF: -16.71dB)

No noticeable degradation in the RMAA tests (newest patch is Vol V2);

Pressing "down volume" button ~1 sec, from 6db to -72db;
Comment by Sanggon, Lee (isanggon) - Thursday, 17 June 2010, 07:57 GMT
I tested again with clip_vol_v2.patch.
Now the volume level goes up to 0.69V(+6, clipping occured) and 0.369V(0,+1, clipping not occured)

But still volume level is not continuously down or up.
I found there are same volume section like, 0/1, -2/-3, -5/-6, -8/-9, -11/-12, -14/-15,,,,,, .
I checked this with DSSF3's software oscillator. You can easily check with that program or other similar programs.
Comment by MichaelGiacomelli (saratoga) - Thursday, 17 June 2010, 16:00 GMT
The DAC only has 1.5dB step sizes for volume. Is that what you're referring to?
Comment by Sanggon, Lee (isanggon) - Friday, 18 June 2010, 00:08 GMT
Yes. I think this problem occured because rockbox only support 1db volume control. If rockbox support 1.5db volume control, it'll be perfect.
Comment by MichaelGiacomelli (saratoga) - Saturday, 19 June 2010, 22:31 GMT
Cleaned up code and prevented changing non-AMSv2 targets. If no one else has any problems I'll commit this version.

FWIW I think this could also be used to increase volume on AMSv1 targets, but I haven't tried. Are they any louder in the OF then in Rockbox?
Comment by Rafaël Carré (funman) - Sunday, 20 June 2010, 01:45 GMT
some things which might need change in as3514.c:
- audiohw_settings
- sound_val2phys?
Comment by MichaelGiacomelli (saratoga) - Sunday, 20 June 2010, 02:33 GMT
I think sound_val2phys should be left alone since the DAC and HP amp volume don't appear to touch the line in or mic paths. I've fixed the audiohw_settings table.

Comment by Luca Leonardo Scorcia (LucaLeonardoScorcia) - Tuesday, 22 June 2010, 21:42 GMT
Tested for a couple of days on FuzeV2, works very well here.