The 'Gain' parameter

Discussions related to MegaDrum Hardware

The 'Gain' parameter

Postby elrules » Thu Sep 25, 2008 3:28 pm

Hi, I would like to have a complete explanation on how the Gain parameter works, and how it affects the triggering and how it affects other parameters.

For example, after months in this forum today I discovered searching and reading that it's adviced to leave the gain of a switch input in 4 o 3, although in the piezo (bow) input it is set to 0.

How does it work exactly? For example I have a cymbal which triggers hits softer than other pads. Do I have to set HighLevel lower or do I have to set Gain higher?

.... Well, to sumarize, I would like a general explanation of everything-a-megadrum-user-must-know-about-Gain-parameter

Thanks;)
Keep megadruming
elrules
 
Posts: 629
Joined: Thu Nov 29, 2007 4:51 pm
Location: Murcia, Spain, Europe, The World

Re: The 'Gain' parameter

Postby dmitri » Thu Sep 25, 2008 8:47 pm

Levels on ADC inputs in Atmega are measured against reference voltage.
If the input voltage is above the reference voltage it is registered as a maximum (equals to 1023 in Atmega).
If the input voltage is between 0 and the reference voltage it is registered as a level between 0 and 1023 proportionately to input/reference voltage relation.
E.g. if the reference voltage is equal to 4V and
1. input voltage equals 2V than it is registered as 511.
2. input voltage is above 4V (4.1V, 4.5V, 5V) than it is registered as 1023
3. input voltage equals 1V than it is registered as 255

When Gain is set to 0, the reference voltage is close to 5V.
When Gain is set to 8, the reference voltage is close to 2V.

Does it make sense?
dmitri
Site Admin
 
Posts: 8709
Joined: Fri Aug 03, 2007 8:05 pm

Re: The 'Gain' parameter

Postby gastric » Thu Sep 25, 2008 8:58 pm

That technical information is interesting.

What about a simple laymans explanation describing how to properly set the gain using just the MegaDrum as the visual guide. Since MegaDrum includes VU meters I'm assuming you set GAIN=0 then whack the trigger as hard as your hardest hits while increasing GAIN until the VU peaks. But what do you do if you're peaking the VU with GAIN=0? Add resistors to your trigger outputs until only the hardest hits peak the VU? And what about switch based triggers?
gastric
 
Posts: 286
Joined: Wed May 14, 2008 1:22 am
Location: Raleigh, NC, USA

Re: The 'Gain' parameter

Postby dmitri » Thu Sep 25, 2008 10:30 pm

gastric wrote:That technical information is interesting.

What about a simple laymans explanation describing how to properly set the gain using just the MegaDrum as the visual guide. Since MegaDrum includes VU meters I'm assuming you set GAIN=0 then whack the trigger as hard as your hardest hits while increasing GAIN until the VU peaks. But what do you do if you're peaking the VU with GAIN=0? Add resistors to your trigger outputs until only the hardest hits peak the VU? And what about switch based triggers?

You're missing the point here. Gain level is not directly related with a peak VU level or max MIDI level for that matter. The MIDI level reaches maximum value (VU peaks) when the registered input signal is higher than 'HighLevel' setting. You can get a maximum MIDI level even with a low Gain and a low input signal but with a loss of dynamic resolution.

Let's suppose your pad produces weak signals even with strongest hits, say 0.5V. Now even if you set Gain to a minimum you still will be able to get a maximum MIDI level from it. With the Gain set to 0 (reference voltage ~5V) a maximum level MegaDrum will register from this pad will be around 100. If the Threshold is set to 10 and HighLevel is set to 90 (we set it below 100 so that reliably produce maximum MIDI levels with strong hits close to but below 100) and presuming we have set Linear Curve than:
1) a signal with a level 11 will produce a MIDI level equal 1
2) a signal with levels between 90 and 100 will produce MIDI levels equal 127

As you can see you still can get both minimum and maximum MIDI levels but you will loose resolution because 90-10=80 and this levels range is narrower than full MIDI range of 0-127.

If we set Gain to 8 we raise sensitivity ~2.5 times. A maximum level MegaDrum will register from this pad will be around 250. To get the same sensitivity we set Threshold to 25 and we can set HighLevel to ~230 (again somewhat lower than a maximum of 250).
Now a registered input level range will be 250-25=225 which is wider than a full MIDI range of 0-127 and we won't loose dynamic resolution ... with a Linear Curve. With a non-Linear Curve it's better to have a wider input level range so that not to loose dynamic resolution on steep parts of the curves.

If the pad is hot and maximum input signals are considerably higher than 5V than no gain settings will prevent from loosing dynamic ranger due to clipping and you will have to use a resistor divider to weaken signals. Please note that even if piezo may produce voltages above 30V when unloaded, in most cases when connected to MegaDrum pads will produce signals close to or below 5V due to construction dampening (you don't hit piezos directly when it's in a pad) and low impedance on MegaDrum inputs.
dmitri
Site Admin
 
Posts: 8709
Joined: Fri Aug 03, 2007 8:05 pm

Re: The 'Gain' parameter

Postby elrules » Thu Sep 25, 2008 11:26 pm

If I have understood it well, it is recommended (if you think you have average "temperature":D pads) to set highlevel to 1023 and see how it works. If you can't reach peak level, then start increasing Gain. You are decreasing that way only the reference voltage than is considered maximum but keeping all the (1023-threshold) range.

When Gain is set to 0, the reference voltage is close to 5V.
When Gain is set to 8, the reference voltage is close to 2V.
I have one last doubt. Is this relationship linear? (= If you set gain=4 then ref voltage is 3,5V) Or maybe exponential?
elrules
 
Posts: 629
Joined: Thu Nov 29, 2007 4:51 pm
Location: Murcia, Spain, Europe, The World

Re: The 'Gain' parameter

Postby dmitri » Fri Sep 26, 2008 5:28 pm

elrules wrote:
When Gain is set to 0, the reference voltage is close to 5V.
When Gain is set to 8, the reference voltage is close to 2V.
I have one last doubt. Is this relationship linear? (= If you set gain=4 then ref voltage is 3,5V) Or maybe exponential?

It is more linear than anything else.
dmitri
Site Admin
 
Posts: 8709
Joined: Fri Aug 03, 2007 8:05 pm

Re: The 'Gain' parameter

Postby gastric » Thu Apr 30, 2009 2:38 am

I'm ressurrecting this old thread as it appears to be the single most educational thread regarding Gain. Seriously, some super great data here. But it kind of tapered off when elrules started proposing how to most effectively set GAIN. Can anyone confirm these steps as the most appropriate?

[begin GAIN instructions - last edited April 30, 2009]

The goal of setting your GAIN is to achieve the following:

1. Provide the most Levels (calculated as the difference between Threshold and HighLevel) possible to each trigger.
2. While only providing the highest Levels to your actual hardest trigger hits.

This will provide your trigger the widest range of dynamics while ensuring that only the hardest hits reach maximum MIDI Velocity.

To properly set your GAIN do the following:

1. Set HiLvlAuto = No
2. Set HighLevel to 960
3. Set Gain = 0
4. Strike pad as hard as you are likely to play it and review the MIDI Velocity output.
5. If MIDI Velocity is less than 127 increase Gain. And repeat testing and increasing gain until your hard hits consistently register a MIDI Velocity of 127.
6. If MIDI Velocity is consistently 127 set All Gains Low = Yes. Repeat testing. If MIDI Velocity is still consistently 127 you will need to apply a voltage divider to your trigger to reduce the voltage output to something more usable with MegaDrum (ideally the strongest hits should not produce voltage peaks above ~4.5v). Note : setting All Gains Low completely disables the Gain setting for all inputs.
Last edited by gastric on Thu Apr 30, 2009 12:42 pm, edited 1 time in total.
gastric
 
Posts: 286
Joined: Wed May 14, 2008 1:22 am
Location: Raleigh, NC, USA

Re: The 'Gain' parameter

Postby gabriel1712 » Thu Apr 30, 2009 8:26 am

It's great that you're taking the monumental task of collecting all the bits 'n pieces out there

gastric wrote:... If MIDI Velocity is still consistently 127 you will need to apply a voltage divider to your trigger to reduce the voltage output to something more usable with MegaDrum (ideally the strongest hits should not produce voltage peaks above ~4.5v)...


You should put equal emphasis on improving the physical side as a viable alternative to Volt divider. It's cheap, reversible, experimental-friendly, and very efficient. Volt divider is a good option when you can't do a non-destructive physical damping and you don't feel like chopping up your $$$-units.

Physical improvements to gain issues can be; Damping the piezo w/ thin layers of rubber. Damping the mesh w/ adjustable feltclamps. Adjusting the cone hight/piezo pressure on mesh, etc. List the common options as the solution differs much for each design and can be googled.

Physical improvements are also fantastic dealing with Retriggering and Xtalk, but I'll comment on that when your tour-bus is in that area :D
"the woods are lovely, dark and deep
but I have promises to keep
and miles to go before I sleep..."
gabriel1712
 
Posts: 195
Joined: Thu Mar 19, 2009 10:16 pm
Location: Denmark

Re: The 'Gain' parameter

Postby gastric » Thu Apr 30, 2009 12:05 pm

I'm not sure that physical dampening on a bar-and-cone-and-mesh trigger affects voltage output, though it will affect double/ghost triggering. But you're correct, the physical pad has a lot to do with it's overall performance characteristics. Note that pulling the cone off the head too much will have negative affects on low-velocity strikes. For documenting the MD parameters I think we'll have to mostly separate out details about the triggers themselves with only cursory mention of them.
gastric
 
Posts: 286
Joined: Wed May 14, 2008 1:22 am
Location: Raleigh, NC, USA

Re: The 'Gain' parameter

Postby gastric » Thu Apr 30, 2009 12:50 pm

Following my original directions is providing confusing results. :) As far as I can tell GAIN is not working at all using firmware 20090326.

* Set GAIN = 0
* Set HighLevel = 1022
* Strike the trigger hard
* MIDI Velocity = 124
* Set GAIN = 8
* Strike the trigger hard
* MIDI Velocity = 124

I would have expected GAIN to reduce reference volage, which in turn would generate a steep input curve towards maximum velocity, in addition to causing more of my hits to reach maximum velocity (127). However, none of my hits reach maximum velocity.

Doing the following:

* Set HighLevelAuto = Yes
* Set HighLevel = 100
* Set GAIN = 0
* Strike the trigger hard
* HighLevel = 989
* Set HighLevelAuto = Yes
* Set HighLevel = 100
* Set GAIN = 0
* Strike the trigger hard
* HighLevel = 985

I'm assuming the spread of 4 in HighLevel between Gain = 0 and Gain = 8 is arbitrary, though maybe completely real. But regardless I would expect Gain to have a significant impact on HighLevel considering the significant reference voltage differences in play.

Levels on ADC inputs in Atmega are measured against reference voltage. When Gain is set to 0, the reference voltage is close to 5V. When Gain is set to 8, the reference voltage is close to 2V. If the input voltage is above the reference voltage it is registered as a maximum (equals to 1023 in Atmega). If the input voltage is between 0 and the reference voltage it is registered as a level between 0 and 1023 proportionately to input/reference voltage relation.

Just to confirm, All Gains Low = No. I'm using MCT to more easily push/pull data from MD and while doing so am trying to remember to confirm the actual MD is registering the same data in MCT to rule out some defect in MCT. ;) I also confirmed that Gain changes in MCT are being properly pushed to MD. So the good news is MCT appears to be working great. Thumbs up!
gastric
 
Posts: 286
Joined: Wed May 14, 2008 1:22 am
Location: Raleigh, NC, USA

Next

Return to MegaDrum Hardware

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 88 guests