"One sensor hears the crowd; the other interviews a single voice. Do not ask the crowd to name the speaker, and do not ask the interview to describe the room."
A Discerning AI Agent
Prerequisites
This section assumes the measurement-model view of a sensor as a spatially weighted, lossy transducer from Chapter 2, and the Nyquist and anti-aliasing vocabulary of Chapter 3. The amplitude and bandwidth anchors for EMG among the other biosignals were set in Chapter 28; read that first if the numbers below feel unmoored. No physiology background is required. Every biological term is introduced here, and the amplitude and frequency figures are engineering order-of-magnitude anchors, not clinical thresholds.
The Big Picture
Electromyography reads the electrical command that fires skeletal muscle, but there are two utterly different ways to place the electrode, and the choice determines what your model can and cannot learn. A surface electrode sits on the skin and picks up the blurred, summed voltage of hundreds of motor units through layers of fat and connective tissue. An intramuscular electrode, a fine wire or needle pushed into the muscle belly, sits millimeters from a handful of fibers and resolves the crisp firing of individual motor units. Same physiology, same units, radically different information. One is a smeared population average that any wearable can capture; the other is a sharp single-unit view that requires a clinician and a puncture. Almost every design decision in this chapter, from feature choice to whether decomposition is even possible, follows from which of the two you are holding.
One signal source, two ways to eavesdrop
The generator is the same in both cases. A motoneuron in the spinal cord commands a motor unit, one neuron plus all the muscle fibers it innervates, and every time it fires, those fibers depolarize together and emit a motor unit action potential (MUAP). Force is graded by two knobs: recruiting more motor units, and firing each one faster. What differs between surface and intramuscular EMG is not the source but the pickup geometry, and geometry is destiny because muscle tissue is a volume conductor that attenuates and low-pass-filters potential as it spreads.
Surface EMG (sEMG) places two electrodes on the skin over a muscle and measures their voltage difference. Because the electrode is centimeters of tissue away from most active fibers, and because tissue smears high spatial frequencies, each surface electrode integrates over a large detection volume containing many motor units. The result is loud in aggregate (up to several millivolts), broadband from roughly 20 to 450 Hz, and inherently a population statistic. It is noninvasive, painless, repeatable, and wearable, which is exactly why it dominates prosthetics, ergonomics, and consumer neuromotor interfaces, the subject of Chapter 27.
Intramuscular EMG (iEMG) inserts a conductor directly into the muscle: a hypodermic needle electrode for diagnostic recording, or a pair of thin insulated fine wires hooked into the tissue for research and deep-muscle access. Now the electrode sits inside the detection volume, dominated by the few fibers nearest its exposed tip. The recorded MUAPs are sharp, high-bandwidth (energy extends past 1 kHz, so sampling climbs to 5000 to 10000 Hz to respect Nyquist as taught in Chapter 3), and selective enough that a clinician can watch a single motor unit recruit and fire. The price is that it is invasive, uncomfortable, positionally unstable, and cannot be worn home.
Key Insight
The defining axis is not amplitude, it is selectivity: how many motor units contribute meaningfully to one channel. Surface EMG deliberately trades selectivity for reach, blurring many units into a smooth envelope that estimates whole-muscle effort. Intramuscular EMG trades reach for selectivity, isolating individual units at the cost of representing only a tiny, position-dependent sample of the muscle. This is a bias-variance tradeoff wearing a lab coat: sEMG gives you a low-variance, high-bias picture of the population; iEMG gives you a high-fidelity, high-variance picture of a few members. No filter converts one into the other, because the missing information was never captured.
Crosstalk: the price surface EMG pays for reach
Because a surface electrode's detection volume is large, it does not respect anatomical boundaries. Activity from a neighboring muscle bleeds into the channel meant for the target muscle, a corruption called crosstalk. When you record the forearm flexors for a hand-close command, the extensors a centimeter away contaminate the trace, and no amount of gain fixes it because the interfering signal is real voltage from a real muscle. Crosstalk is the single most consequential difference in information quality between the two modalities: intramuscular electrodes are largely immune because their tiny detection volume rarely reaches across a fascial plane, while surface electrodes are chronically vulnerable. This is why Section 32.6 devotes itself to artifact and crosstalk handling, and why any sEMG model claiming to read one muscle in isolation deserves suspicion.
The physics is a rapid falloff of potential with distance. Treat each active fiber as a source whose surface contribution decays roughly as an inverse power of the source-to-electrode distance \(r\). The measured channel is the sum over all fibers weighted by that decay,
$$ v(t) \;=\; \sum_{i} \frac{s_i(t)}{(1 + r_i/\lambda)^{p}}, $$where \(s_i\) is fiber \(i\)'s action potential, \(\lambda\) is a tissue length scale, and the exponent \(p\) (around 2 to 3 for surface pickup) controls how sharply distant sources are suppressed. For an intramuscular tip, the nearest fibers have \(r_i \to 0\) and dominate the sum; for a surface electrode, thousands of moderately distant fibers each contribute a little, and the many weak, distant terms are exactly the crosstalk. The short model below turns this equation into an experiment you can run.
import numpy as np
rng = np.random.default_rng(0)
# 400 fibers scattered in a muscle cross-section; a second muscle sits 12 mm away.
n = 400
x = rng.uniform(-8, 8, n) # mm, lateral position within/near target
y = rng.uniform(-8, 8, n) # mm, depth
in_target = np.abs(x) < 5 # fibers belonging to the target muscle
def channel_weights(ex, ey, lam=3.0, p=2.5):
r = np.sqrt((x - ex)**2 + (y - ey)**2) # source-to-electrode distance
return 1.0 / (1.0 + r / lam)**p
def crosstalk_fraction(ex, ey):
w = channel_weights(ex, ey)
return w[~in_target].sum() / w.sum() # energy share from the wrong muscle
surface = crosstalk_fraction(ex=0.0, ey=10.0) # electrode on skin, above the muscle
intra = crosstalk_fraction(ex=0.0, ey=0.0) # tip inside the target belly
print(f"surface crosstalk fraction: {surface:.2f}")
print(f"intramuscular crosstalk fraction: {intra:.2f}")
ey to sweep electrode depth and watch selectivity trade against invasiveness.As Listing 32.1 makes concrete, moving the electrode from the skin into the belly does not merely raise amplitude; it collapses the crosstalk fraction, because the inverse-power weighting now favors a few close fibers over the distant crowd. That single number, the share of energy arriving from the wrong source, is the quantitative heart of the surface-versus-intramuscular choice.
In Practice: the clinic that needed both
A movement-disorders lab investigates a patient whose hand tremor might arise in either of two adjacent forearm muscles. A wrist-worn surface band, the kind used for gesture control, shows tremor-band bursts but cannot say which muscle leads, because its wide detection volume merges both. The neurologist switches to a fine-wire intramuscular electrode placed under ultrasound guidance into each muscle in turn. Now single motor units are visible, their firing precisely time-locked, and the lab identifies the driving muscle and its firing rate. The surface recording was right that something oscillated and completely unable to localize it; the intramuscular recording localized it but sampled only a pinhole of tissue and could not be worn for the multi-day monitoring the clinicians also wanted. The two modalities were not competitors but a division of labor: sEMG for coverage and repeatability, iEMG for the decisive single-unit question.
What each modality lets a model do
The pickup geometry decides which learning problems are even well posed. Because sEMG delivers a smooth, high-signal-to-noise envelope of population activity, it is ideal for estimating effort, timing of muscle onset, and coarse movement intent, the tasks that drive prosthetic and gesture control in Section 32.3 and fatigue estimation in Section 32.4. It is a natural fit for the classical envelope and spectral features of Section 32.2 and for the deep time-series models of Chapter 13. What sEMG cannot natively do is name individual motor units, because they are summed away before the electrode ever sees them.
Intramuscular EMG, by contrast, makes motor-unit decomposition tractable: because MUAPs arrive sharp and separable, algorithms can cluster them by shape and recover each unit's firing train, the fine-grained neural code behind a contraction. This is the reference modality for neurophysiology and for validating what surface methods only estimate. The frontier reunites the two: high-density surface EMG (HD-sEMG), a grid of dozens to hundreds of closely spaced skin electrodes, samples the spatial voltage field densely enough that blind-source-separation methods can decompose some motor units noninvasively, recovering a slice of the intramuscular view without a needle.
Research Frontier
Noninvasive motor-unit decomposition from HD-sEMG is the active bridge between the two modalities. Convolutive blind source separation, notably the convolution-kernel-compensation family and gradient-based variants, inverts the volume-conductor mixing to recover individual firing trains from electrode grids, and wrist-worn HD-sEMG bands (the direction popularized by neural-interface efforts such as the CTRL-labs wristband acquired by Meta) push this toward consumer hardware. The open problems are real: decomposition remains sensitive to electrode shift, sweat, and contraction level, recovers only the larger superficial units rather than the full pool, and lacks the leakage-safe cross-subject evaluation that Section 32.5 and Chapter 65 insist on. Treat a paper's decomposition accuracy as provisional until it is validated against concurrent intramuscular ground truth on held-out subjects.
The Right Tool
Hand-writing a robust sEMG front end, band-pass to the 20 to 450 Hz window, a mains-notch, rectification, and a linear-envelope smoother, is roughly 40 to 60 lines that are easy to misorder (notch before or after rectification changes the result). The neurokit2 library collapses the clean-and-envelope path to two lines:
import neurokit2 as nk
clean = nk.emg_clean(emg, sampling_rate=2000) # band-pass + mains handling
signals, info = nk.emg_process(emg, sampling_rate=2000) # amplitude envelope + onsets
neurokit2.emg_process replaces about 50 lines of surface-EMG preprocessing with one call that returns a labeled envelope and detected activation onsets. It is built for the surface, population-level view; it will not decompose motor units, because that information is not present in a single sEMG channel. Match the tool to the modality, and validate its default band against your own sampling rate.Choosing between them
The decision reduces to a short checklist. Reach for surface EMG when you need noninvasive, repeatable, wearable recording; when the question is about whole-muscle effort, timing, or gross intent; and when the target muscle is superficial and reasonably isolated from crosstalk. Reach for intramuscular EMG when you need single-motor-unit resolution, when the muscle is deep or small (where a surface electrode would record mostly its neighbors), or when crosstalk immunity is non-negotiable, accepting that the recording is invasive, position-sensitive, and unrepeatable across days. And reach for HD-sEMG when you want to push toward intramuscular-grade information (a spatial field, partial decomposition) while staying on the skin, accepting more electrodes, more compute, and a decomposition you must validate. The rest of this chapter mostly lives in the surface world, because that is where deployable neuromuscular AI lives, but every surface claim should be read against what an intramuscular recording would have shown.
Exercise
Modify Listing 32.1 so the neighboring muscle sits at three distances (6, 12, and 24 mm) and sweep the surface electrode depth ey from 2 mm to 14 mm. Plot the crosstalk fraction against depth for each separation. In two or three sentences, explain why a thicker layer of subcutaneous fat (larger ey) worsens crosstalk even though it also weakens the target signal, and state what this predicts about surface EMG quality on lean versus higher-adiposity forearms.
Self-Check
1. Both modalities record the same MUAPs from the same motor units. Why can only the intramuscular recording resolve individual units, and what specifically is lost at the skin?
2. Why does intramuscular EMG demand a higher sampling rate than surface EMG, and which chapter's principle sets that floor?
3. A colleague proposes fixing surface-EMG crosstalk with a sharper band-pass filter. Explain in one sentence why frequency filtering cannot remove crosstalk, and name the modality change that can.
What's Next
In Section 32.2, we take the surface signal this section has characterized and turn it into numbers a model can use: the amplitude envelope, the spectral features whose median frequency shifts as a muscle tires, and the time-domain descriptors that survive the noisy, non-stationary reality of skin-mounted electrodes.