Rockbox

  • Status Closed
  • Percent Complete
    100%
  • Task Type Patches
  • Category Recording
  • Assigned To No-one
  • Operating System Iriver H100 series
  • Severity Low
  • Priority Very Low
  • Reported Version
  • Due in Version Version 3.1
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by vinylivo - 2006-02-28
Last edited by petur - 2006-04-03

FS#4748 - Automatic Recording Gain Control

This patch adds automatic gain control (AGC) for recording.
At the moment it works with Mmmm’s recording enhancements pack but I included a patch with the agc and the recenhancementpack included.
Features:
- 6 selectable AGC presets: Off, Safety (clip prevention), Live (slow), DJ-Set (slow), Medium and Voice (fast).
- Controls also out of balance and tries to center the levels.
The nominal target levels for the presets are: Live -9dB, DJ-Set -5dB, Medium -6dB, Voice -7dB.
- Peak level histogram view in 4 modes: high resolution linear or logarithmic histogram, low height linear or logarithmic histogram plus balance meter, disk usage and batter level display.
- Shows correct recording status in statusbar.
- Issues a warning splash when disk space or battery level gets low.
- Stops recording when disk is full (leaving a small 128MB remaining space that the jukebox can continue to work).
- Stops recording when battery level is critical for hdd writing to prevent corrupted (or with 0 bytes because FAT entry couldn’t be written anymore) files.

This is a preliminary release, AGC-Mode is not yet saved in user settings and localization (language) is not yet done.

All presets reduce the level by detection of clipping more than a second. The internal timing is 0.5s for now, perhaps I’ll increase it to 0.2s later. ‘fast’ here means an attack time of 2 seconds and a release time of 4 seconds, so this is not a realtime compressor but really a relatively slow gain control system. And the gain control works by increasing/decreasing the input gain in 0.5dB steps. The user can change the gain manually anytime and therefore override the AGC. If AGC-Mode is not set to Off or Safety it will take over control again and head up for the preset target volume.

Technical details:
Algorithm timing: 0.5 sec
Thresholds (upper/lower) [dB]: Live -7/-11, DJ-Set -4/-6, Medium -5/-7, Voice -5/-8
Timing (attack/release/balance) [s]: Live 40/150/60, DJ-Set 24/64/40, Medium 12/32/20, Voice 1.5/4/3

Closed by  petur
2006-08-17 11:25
Reason for closing:  Accepted
Additional comments about closing:  

the rest of the REP should be committed separately or resubmitted to the tracker

Forgot to mention that the first patch (rec_agc_histogram) is for people who already installed Mmmm’s recording enhancement pack.
The second includes the enhancement pack and AGC.

The ‘graphics’ for HD space and battery life do not take different fontsizes into account..

So here’s the updated patch for AGC.
New features:
- settings are saved.
- localization (english & german)
- limiter versions of presets. allows to set a maximum gain which isn’t succeeded. press left when AGC presets highlighted to select limiter presets. timing is the same as ‘normal’ presets. press down when AGC presets highlighted and a limiter preset is selected to change maximum gain.
- improved precision of peak meter (much lower error in important -12dB to 0dB range, error < 0.2dB).

This patch includes Mmmm’s remote support and high size peak meter.

hi!
I have no idea how to apply that to my rockbox…..I m very interested since i m a musician and record a lot with my Iriver h320 in live sittuations…Anybody could tip me? thanks a lot and thanks for people developing this great thing!

A quick update against daily build 060313:

- now with user font in recording screen if it fits. remote and main can have different fonts and peak-meter sizes depending on space.
- removed the ‘limiter’ presets and made ‘max. AGC gain’ enabled always.
- slight rearrangment of battery, disk and balance-meter. also enabled these infos for the higher sized histogram views if there is enough space on the screen.
- seperate saved preset & max. agc gain settings for mic and line-in.
- includes remote support (from Mmmm’s patch)
- includes improved power managment (as I was unable to remove it right now, just too busy).
- use patch -p1 to apply to source.

@sebastien: This is for developers only at the moment (you need the development tools installed and compile the source yourself). I’ll compile a recent binary for H120 and H320 when I find some time.

I isolated the recording enhancements part of the patch, and i also made a version which will apply cleanly against paprica’s scroll margins patch (which can be found here : http://www.rockbox.org/bugs/task/2994 ), as they conflict but they are both very nice ;)

Use -p0 to apply

there is a missing part in nicolas_p patch (english.lang)

id: LANG_WARNING_BATTERY_LOW
desc: in recording screen
eng: “Battery is low!” voice:
new:

With the remote support and peakmeter patch added to CVS I guess we need a new patch for ‘just’ the AGC part..

petur commented on 2006-03-29 19:25

Could you *please* split usefull patches (like this) into one functionality per patch?
I would love to test and commit the AGC and other stuff, but I can’t do it all in one…

OK here it comes. This is only the AGC, the histogram follows in a seperate patch. Since remote support and peakmeter patch got added to CVS there are only a few files left to modify, namely german & englisch language, settings, sound_menu, status (for showing the ‘REC? symbol in statusbar) and recording.

petur commented on 2006-04-03 10:00

Great… but it seems you just missed the ‘feature freeze’ deadline, so I won’t be able to commit it for another 4 weeks. After the 3.0 release, it ‘ll be one of the first things to go in :)

Yeah that’s sad I know, but it was impossible to do it before.

I splitted agc and batt/disk warnings too, so here are the seperate patches. I still try to update the patch every two weeks or so that they remain updated for easier patching lateron.

petur commented on 2006-04-09 11:38

Tried your AGC patch and it sure has potential - I only used the safety setting and it worked nicely. The settings will need a fair bit of documentation, maybe change it to a fully parametric control (in true rockbox style) next to the wizard-like presets.

As the lang file changed, it didn’t apply cleanly anymore, so I fixed it for you (AGC patch only)

Thanks Peter, I thought about more control for presets too, perhaps some user presets which can be configured like the EQs. There are quite some control parameters that’s why I thought it would be easier just to give presets. But we can make something that lets the user choose target level, control hysteresis, attack and release timing as the most important ones. Perhaps via context menu?
I’ll dive into this…

This is the official patch for the new language format. I moved all graphic changes (like status bar REC symbol etc) to the seperate histogram patch.

And I added a patch which includes AGC and Histogram display because it’s not so easy to apply both patches to the source (conflicts because several functions and other stuff are used by both). So use the ‘rec_agc_hist_pack’ for this.

Patches were done against daily-060408 and use -p1 for patching

The color (part of the) patch turns the textcolor to black .. not very nice if you have a black background :^)

petur commented on 2006-04-09 20:55

Paul, you must surely be talking about the agc+histogram patch, as the agc-only patch does no such thing here…

hmm I guess yes :)

Fixed it..

Replace lcd_set_foreground(LCD_DEFAULT_FG) with lcd_set_foreground(global_settings.fg_color) works for me

it appears the patch does not setup LCD width correctly(on my H3x0 at least, the left side (as far as I can see the outline only) of the balance meter is missing and the outline of the histogram is not shown either..

Another thing I noticed is that the box around the histogram and the ‘needle’ in the balancementer is always drawn in black. This makes it hard to see when using a black background..;^)

petur commented on 2006-05-12 23:59

updated agc patch for current cvs

   agc (36.2 KiB)

Hello Petur, Paul, and Jvo.
I think that there’s a small bug in this lastest AGC patch.
When AGC is set to be in a “non-off” state it seems to only be available if your source is set to “mic”.
Wouldn’t AGC be useful during line-in recording as well?
I understand that it makes no sense to have AGC on when recording from digital, but automatic line-in attenuation would be a good feature too, no?
If you didn’t want it during line-in you could always set the AGC to “off”.

petur commented on 2006-05-15 22:06

Davide, I think the problem was that the newly added frequency line didn’t compensate for line-in having L/R gain ( ↔ mic only one line). I have fixed this and had quite some work getting the patch compatible with latest CVS.

Please test ;)

   agc (33.6 KiB)
petur commented on 2006-05-17 22:17

Updated to latest CVS and fixed build issue for sim builds

   agc (33.7 KiB)
petur commented on 2006-05-26 22:15

Updated to latest CVS

   agc (33.6 KiB)
petur commented on 2006-07-03 20:08

Updated to latest CVS

petur commented on 2006-08-01 06:22

Updated to latest CVS (but in a hurry, so please check)

Regretfully, it breaks when attempting to use it on Line-In.
Seems to work for Mic in. This was the case in an earlier build.
Sorry Petur, it’s broken. :-(

petur commented on 2006-08-02 06:03

How does it break?

It’s a diff from a version I run here, and I admit I only tested Line-In. But that worked.
Will check tonight…

Using Mic input I monitor and record BOTH channels! This is actually great, a dual mono track is better than left channel only (as it was), but I don’t know whether this new behavior is caused specifically by AGC or not. AGC seems to work fine with the new dual mono mic recording.

Using Line input I can monitor and record both channels, but there is no AGC display and when I set the gain high and clip the input none of the levels change even when AGC is set to Safety in the menu.

I am currently ‘make’ing a clean build from yesterday’s source (20060801) and will report back on the ‘dual mono’ mic input recording status.

CONFIRMED: Dual Mono Recording for Mic Input committed to CVS. Whoever commited this change THANK YOU!
AGC bug still pending, de-activated during Line-Input recording regardless of menu setting. No AGC status disply in WRS when Source=Line-In (someone please corroberate)
Davide-NYC.
PS: thanks for all of the Devs on this project. LLRB (long live Rockbox)

petur commented on 2006-08-02 17:36

Ouch.. must have overlooked that… will fix

petur commented on 2006-08-02 21:34

This one should be better. Don’t know about the remote and certainly not what the code will do now for non AGC targets.

The recording screen code is in need of some serious clean-up. I’m trying to have a look at it. *seeks time*

petur commented on 2006-08-03 21:31

Some small updates:
- moved HAVE_AGC to the config_xxx.h files for smoother multi-target implementation
- small fix in recording screen

mmmm- commented on 2006-08-06 15:31

Petur… Here’s a patch based on the one above 3/08

I’ve added display support for digital in for players that support it (although AGC obviously does nothing for digital so on second thoughts maybe we shouldn’t display at all in that mode…hmmmm).

Also I’ve fixed the remote display (and any other screens that are too small to fit all this info on).

(application/octet-stream)    AGC.patch (31.3 KiB)
mmmm- commented on 2006-08-06 21:48

Here’s a better one. Now the AGC settings don’t appear for digital in (as they don’t do anything anyway) and the cursor handling is better…

Small screens that can’t fit in the AGC info/settings now have the bottom line change into the settings line when the cursor is moved down.

petur commented on 2006-08-08 17:26

my version of the agc patch in sync with cvs. Does not contain recent changes by Mmmm yet. Posted here on request ;)

petur commented on 2006-08-08 23:20

Better version:
- Synced with CVS (again)
- Should incorporate Mmmm’s changes
- Removed 2 constants
- Prepared for other targets

Do test…

DLed clean CVS and patched with agc_20060809.patch.
Built SIM: no errors, build NORMAL: no errors.
Installed on H140, tested mic in and line-in.
Digital in shows no AGC.
Tested with the 300LCD-Joystick remote. (buttons are mis-mapped but are all there)
IMO: Looks good! Woohoo!

petur commented on 2006-08-15 23:08

sync to cvs

petur commented on 2006-08-16 23:27

AGC part has been committed ;)

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing