# Gesture Signal Processing

### From CCRMA Wiki

(→Filtering) |
(→Filtering) |
||

Line 9: | Line 9: | ||

</center> | </center> | ||

- | + | ===Filter Approximating An Integrator=== | |

- | + | In this case, we integrate an acceleration measurement in order to obtain velocity. We see that with each time step, '''v''' is updated to be nearly the same as the previous '''v''', but it is affected by the input '''a'''. This is an example of a low-pass filter because the filter passes mainly low frequencies. | |

<pre> | <pre> | ||

v = 0.1*a + 0.9*v; | v = 0.1*a + 0.9*v; | ||

Line 16: | Line 16: | ||

+ | ===Filter Approximating A Differentiator=== | ||

Next we show how to approximate a differentiator, so now '''x''' represents a measured position, and '''v''' represents velocity (although the result is scaled by a constant). The extra variable '''r''' is introduced to represent the previous position measurement. Hence, the estimated velocity is the difference between the current position and the previous position. This filter is an example of a high-pass filter because it passes mainly high frequencies. | Next we show how to approximate a differentiator, so now '''x''' represents a measured position, and '''v''' represents velocity (although the result is scaled by a constant). The extra variable '''r''' is introduced to represent the previous position measurement. Hence, the estimated velocity is the difference between the current position and the previous position. This filter is an example of a high-pass filter because it passes mainly high frequencies. | ||

<pre> | <pre> |

## Revision as of 18:27, 12 October 2008

## Contents |

## Filtering

While studying sensors, we discovered that often a particular sensor will measure the position **x**, velocity **v**, or acceleration **a** of an object. However, we might like to use a different variable to control the way we synthesize sound. Ideally, integration and differentiation can be applied to convert between variables.

### Filter Approximating An Integrator

In this case, we integrate an acceleration measurement in order to obtain velocity. We see that with each time step, **v** is updated to be nearly the same as the previous **v**, but it is affected by the input **a**. This is an example of a low-pass filter because the filter passes mainly low frequencies.

v = 0.1*a + 0.9*v;

### Filter Approximating A Differentiator

Next we show how to approximate a differentiator, so now **x** represents a measured position, and **v** represents velocity (although the result is scaled by a constant). The extra variable **r** is introduced to represent the previous position measurement. Hence, the estimated velocity is the difference between the current position and the previous position. This filter is an example of a high-pass filter because it passes mainly high frequencies.

v = x - r; r = x;

Filter design is an important part of the field of signal processing. For more details, see Julius Smith's book on simple filter design.

## Interpolation

Interpolation is a method of constructing new data points within the range of a discrete set of known data points.

### Interpolation In Time

We have already learned about using the **line~** object in Pd to interpolate in time to avoid zipper noise.

### Interpolation In Space

Now we consider interpolation in space. Given a finite number of sensors at discrete positions, we might want to estimate the continuous position of an object in space. For example, imagine a line of 10 force sensing resistors or capacitative sensors as shown below.

We can develop an estimate of the center of the user's finger using linear interpolation. Let's say that the centers of the 4th, 5th, and 6th sensors are located at the horizontal positions 20mm, 25mm, and 30mm, respectively. If **s _{4}**,

**s**, and

_{5}**s**represent the sensor inputs from the 4th, 5th, and 6th sensors, respectively, then the following expression estimates the continuous position of the center of the finger:

_{6}**(20mm)*s _{4} + (25mm)*s_{5} + (30mm)*s_{6}**

**--------------------------------------------------------**

**s**

_{4}+ s_{5}+ s_{6}Note that for this technique to work well, the sensors should be well matched. The expression also should not be evaluated if **s _{4} + s_{5} + s_{6}** is small, in which case the user is not pressing hard enough on the array of sensors.

## Thresholding

Often we want to implement some sort of event detector. For instance, we may want to detect the event that the musician has struck an object such as a drum. If the musician is holding an accelerometer in his or her hand, we can detect the event by waiting for a large value or a large change in the accelerometer signal.

For more details on thresholding, see the **threshold** and **threshold~** objects' help patches in Pd.