EMG Signal Processing

From sampled muscle signals to contraction timing, amplitude, and spectral measurements.

I worked on extracting contraction timing, activation amplitude, and spectral measurements from wearable EMG. The algorithms had to operate continuously, with limited memory and processing time, while the electrode interface and the wearer’s activity changed.

We separated the processing into an amplitude-and-timing branch and a spectral branch. The first identified contractions. The second analyzed the EMG belonging to each contraction. Coordinating those branches was central to obtaining meaningful measurements.

An amplitude envelope for each muscle

High-pass conditioning reduced slowly varying components before an RMS calculation formed an amplitude envelope. RMS measures signal magnitude over a window while retaining contributions from both positive and negative portions of the EMG waveform.

R[n] = √{(1/N) N−1i=0 x2[ni]}

We then smoothed and detrended the envelope to make contraction boundaries easier to identify. The embedded processing included a 21-sample RMS window, two successive 21-sample smoothing windows, and activity- and channel-dependent detrending lengths of 41, 63, or 125 samples.

Window length controlled the balance between stability and timing. A longer window averages over more of the waveform, while a shorter window follows changes more quickly. Each operation also affects delay, which becomes important when the segmentation output is applied to the raw or filtered EMG.

Movement of a textile electrode relative to the skin can introduce a large, slowly varying component beneath the EMG. We worked on this baseline disturbance through both the electrode interface and digital filtering. FIR and moving-average operations provided ways to separate the slower component from the faster muscle waveform.

The processing also served the communication link. An amplitude envelope preserved contraction timing and magnitude in a compact stream for the phone, while contraction-level spectral analysis used the higher-rate samples on the device. Activity-dependent smoothing controlled how much temporal detail reached the display.

Contraction timing and sample alignment

Segmentation identified the beginning and end of a contraction from the processed envelope. We developed channel-specific analysis for quadriceps and hamstring signals, with additional processing for walking and for gaps between contractions.

The key implementation issue was that a decision about a contraction arrived after the samples that produced it. Filtering and temporal context had already delayed the envelope. We used a FIFO to delay the filtered EMG so that the segmentation decision selected the corresponding portion of the waveform.

That alignment determined which samples entered a contraction-level measurement. It also became important when EMG intervals were associated with acceleration, since muscle activation, physical motion, and the processing delay each contributed to the observed timing.

Measurements from individual contractions

Pedalling produced a sequence of distinct EMG bursts. We extracted the amplitude envelope and detected individual contractions as the signal arrived. Each event then supplied a time interval, an amplitude measurement, and a segment of EMG for spectral analysis.

Cycling EMG, amplitude envelope, and detected contraction events
Cycling EMG and its amplitude envelope plotted against sample index. The lower panel marks 22 detected contractions. The amplitude axis retains the signal scale, and an event is represented by a value of 1.

The selected window contains 22 detected contractions. Successive markers are separated by roughly 640–687 samples, with a median interval of 656 samples. This is a direct way to examine the regularity of the detected pedal-cycle events before converting the intervals to a rate.

This event representation supported several measurements. Successive event times gave a repetition period for cadence. The amplitude within each interval described activation intensity. Comparing intervals across quadriceps and hamstrings described their relative timing, while comparing the corresponding channels on both legs supported a balance measure.

Writing the detected sample indices as nk and the sampling rate as fs, the event period is Tk = (nknk−1)/fs. For one detected event per pedal revolution, cadence follows as 60/Tk in revolutions per minute. The sampling rate and event-to-cycle relationship give the sample interval its physical interpretation.

For a segmented interval containing Nk samples, RMS amplitude summarizes the contraction as Ak = √[(1/Nkx²[n]]. Dividing by a reference amplitude puts successive contractions on a relative scale. Bilateral balance then compares the corresponding left- and right-leg amplitudes, while coordination compares the relative timing of contractions in different muscles.

Timing can also be expressed as a phase within the movement cycle: Δφ = 360° Δt/T. This provides a common basis for comparing muscle activation across changes in cadence.

Acceleration supplied an additional check on the movement associated with a contraction. Sustained muscle activation and periodic limb motion have different temporal signatures. Using both streams helped associate the detected muscle activity with the movement being performed.

Spectral analysis within contractions

Within contractions, we estimated the EMG power spectrum using overlapping Hamming-windowed segments. The embedded spectral routines used separate 432-sample buffers for quadriceps and hamstring channels, a 64-sample window with 32-sample overlap, 40 evaluated frequency coefficients, and an averaging parameter of 30.

Tapering each window reduced spectral leakage at its edges, and averaging reduced the variation between individual spectral estimates. The overlap reused samples while moving the analysis through the contraction. The resulting mean frequency summarized the distribution of power across the evaluated frequencies.

fmean = (∑k fkP[k]) / (∑k P[k])

Here P[k] is estimated power at frequency fk. A change in this quantity describes a change in the spectral distribution. We investigated it as part of fatigue-related processing, alongside contraction amplitude and duration. Interpreting those measurements requires consistent attention to the muscle, contraction conditions, and electrode interface.

EMG and blood-lactate measurements

We also recorded EMG during cycling tests with repeated blood-lactate sampling. This paired a continuous electrical measurement with an independently sampled biochemical measurement and let us examine how their trends evolved during exercise.

EMG amplitude trend compared with blood-lactate samples during cycling
The EMG trend and blood-lactate samples from one cycling recording, each scaled to its own maximum. The markers retain the discrete sampling of the blood measurements.

The illustrated recording shows both quantities rising later in the test. The EMG trend changes continuously, while each blood sample supplies a measurement at a particular point in the recording. Their timing and different sampling rates therefore belong in the comparison.

The comparison contains eight blood-sampling points against a continuously estimated EMG amplitude trend. The points and curve have different temporal support: the blood measurements are discrete observations, while each EMG estimate summarizes a signal interval. Relating them therefore requires attention to sample timing, the duration of the EMG averaging window, and any physiological delay between changes in the two measurements.

The research question was how much information about the changing physiological state could be extracted from the wearable signal. Developing that relationship required paired recordings, consistent electrode calibration, and comparison across participants and exercise conditions. It connected our work on signal acquisition and contraction analysis to physiological experiments.

Relating measurements to a reference contraction

Quadriceps and hamstring channels used separate reference normalizers, with additional scale factors selected by activity. This let the amplitude output be interpreted relative to the reference contraction used for that channel.

The distinction between amplitude, timing, and spectrum was useful throughout the work. RMS described the magnitude of activation over a window, segmentation described when it occurred, and mean frequency described the distribution of spectral power. Combining them gave a richer view of a contraction than any one quantity by itself.

Heartbeat detection in peripheral biosignals

I also worked on heartbeat detection from electrical signals acquired away from the chest. These recordings contained cardiac impulses together with local muscle activity, electrode movement, and electrical interference. The research used multichannel biopotential acquisition at 4 kHz and compared waveform, threshold, and statistical detection methods.

The processing combined band-pass filtering, temporal selection, and a moving-window detector. Once adjacent heartbeat events had been identified at times ti−1 and ti, their interval gave the instantaneous rate.

HRi = 60/(titi−1)

The engineering challenge was identifying the events reliably in the presence of simultaneous EMG and motion. This work led to the heart-rate detection patent, which combines filtering, predictive temporal selection, and heartbeat-event timing.