Sampling

From MegaDrumWiki
Revision as of 22:47, 7 December 2014 by Airflamesred (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The purpose of the sampling block is to transform analog inputs into an event stream with the following characteristics:

  • accurately represents the strength of each hit
  • does not produce false trigger events
  • emits the event as soon as possible after it occurs

MD has four parameters that allow you to control this process:

  • Gain
  • Threshold
  • High Level
  • MinScan

To explain how these work, let’s consider a simple piezo input.  Consider the following (very simplified) output from a sensor that has been struck four times:

File:Hits 1.svg
Multiple Hits

MD uses digital sampling to start the process; this is actually just like sampling an audio signal to turn it into a digital wave.

Gain

The first sampling parameter is Gain.  Gain can be thought of as a volume knob.  Just as a volume knob makes the music louder or quitter, the gain setting will make the signal from the piezo stronger or weaker.

Why would you do this?


When MD samples it expects the voltage of the signal to be in a specific voltage range.  If the signal is too weak it will be difficult to detect that something of significance has happened, and if it is too strong, MD will be unable to distinguish between softer and harder hits.

If your piezo is ‘hot’, this means that it is more sensitive and that the electrical signal is already strong and needs a lower gain setting to avoid clipping the input.  If your piezo is cool, this means that it is less sensitive and that a higher gain setting will be appropriate.

Gain helps you match what your piezo produces to what MD wants to consume.

Gain is the only parameter that affects the analog signal.  The other three are working with the output of the A/D converter.

After sampling, the block has a digital representation of the analog signal with values in the range from 0-1023.

Threshold

Any real world analog system has some degree of noise present.  This noise is sampled along with legitimate strike signals.  For a piezo input, threshold is the level, below which, the signal is considered noise.  When the signal rises above the threshold, the sampling block will generate an event.

Consider the following:

With the lower line for threshold, it should be clear that the sampling block is going to generate a large number of events for activity that isn’t actually there. The sampled noise looks like very quiet strikes. A threshold that is too low can demonstrate the following symptoms:

  • Repeated notes when nothing is actually happening on an input
  • Random notes when nothing is actually happening on an input[1]

Of course, the threshold can also be set too high. This will cause MD miss softer notes. Consider the second strike: with the ‘too high’ threshold value, MD will not detect it as a hit.

This is a crucial performance parameter and it may take a bit of experimentation to find a value that works best. Please note that the threshold will be different for different pieces of gear in your set.

High Level

The sampling block does not pass the actual sampled level (0-1023) with the strike events. That would make setting the parameters in the other blocks unnecessarily difficult. Instead it normalizes the sampled level to a 0-255 scale, where 0 is the Threshold and 255 is the pad being struck as hard as possible.

High Level is simply the sampling level that corresponds to strength 255 for the event. Any sample levels higher than this will be transmitted as 255. Levels lower than this will be scaled on a straight line to the threshold level.

Tips for setting HighLevel:

  • The auto-High level setting will allow the input block to automatically adjust the high level to the strength of the strongest hit it has seen. Briefly turning this on and then hitting the pad as hard as you can, a number of times, will produce a very good first estimate for HighLevel
  • Reducing the HighLevel allows a sort of brick wall limiting function. If your sensor occasionally emits a very strong signal, it is OK to reduce the MaxLevel so that these are squashed into the top end of the musically useful strengths.
  • Reducing HighLevel too far will reduce the smoothness of your velocity response.
  • Raising HighLevel high above the actual levels generated by the sample will also degrade the velocity response, generally limiting the final MIDI notes to lower velocity values, no matter how hard the pad is struck.

Min Scan

MinScan controls how long after the input signal crosses the threshold MD will continue to sample the input. Consider:

Remember, that once the input signal crosses the threshold, the sampling block is going to generate an event. The next question is what strength should that event have?

If MinScan is too short, then MD will stop looking while the input is still rising. This will result in a trigger that does not accurately record its potential dynamic range.

However, MinScan represents a delay (latency) between the physical strike and a note being generated. Setting MinScan too long will result in longer latency. Typically, rubber cymbals and pads are able to use a setting of 20 (2 msec) while mesh heads may require 30-50 (3-5msec). The bigger the pad, the longer MinScan will need to be to properly detect signal level.


  1. Not to be confused with notes that are caused by vibrations between pads that are mechanically connected (we’ll discuss configuring those tools later in the filtering section)