EECS 3641 · Digital phonocardiogram · model band 20–500 Hz

From a heart sound to a decision, on a Raspberry Pi.

How much accuracy survives the hardware?

A bench instrument built to measure one thing: how much murmur-detection accuracy survives when a recording is played through real hardware and classified live, set against the model’s offline score on the same file.

FIG. 1 · 9979_TV.wav · tricuspid

Example · not live

Point at the plot, or focus it and use the arrow keys (Shift for 100 ms steps).

Dataset label, not a model output: Murmur, holosystolic, grade III/VI. Time in seconds from the start of the file; amplitude in file units (full scale ±1). S1/S2 ticks and hatched murmur bands: CirCor expert segmentation, annotated 0.54–5.66 s. Test split, held out. CirCor DigiScope, PhysioNet 2022, ODC-By 1.0.Heart sounds sit at 20–500 Hz; laptop and phone speakers barely reproduce them. Use headphones.

FIG. 2 · One path through eleven stages

  1. Dataset fileCirCor · 4 kHz
  2. Speaker, simulated, awaiting partssimulated, awaiting parts
  3. Coupler, simulated, awaiting partssimulated, awaiting parts
  4. Silicone, simulated, awaiting partssimulated, awaiting parts
  5. Microphone, simulated, awaiting partssimulated, awaiting parts
  6. Conditioning, simulated, awaiting partssimulated, awaiting parts
  7. ADC, simulated, awaiting partssimulated, awaiting parts
  8. Raspberry Pi5 s windows
  9. Features26 per window
  10. Classifierrandom forest
  11. Monitorweb display

Solid: runs todayDashed: not running yet

Stages

  1. Dataset file
  2. Speaker, simulated, awaiting parts
  3. Coupler, simulated, awaiting parts
  4. Silicone, simulated, awaiting parts
  5. Microphone, simulated, awaiting parts
  6. Conditioning, simulated, awaiting parts
  7. ADC, simulated, awaiting parts
  8. Raspberry Pi
  9. Features
  10. Classifier
  11. Monitor
  • 20–500

    Hz · model band

  • 5

    s · analysis window

  • 26

    features / window

  • 3641

    split seed · by child

01 · What you are looking at

A phonocardiogram is the sound of a heart, drawn.

Each beat makes two short sounds. S1 comes as the valves between the upper and lower chambers close at the start of a contraction; S2 as the outflow valves close at its end.

A murmur is an extra whooshing sound, made by turbulent blood flow, heard between or over those two. Telling a harmless murmur from a serious one is a clinician’s job. This instrument asks only whether one is present, and it is not a medical device.

FIG. 3 · One heartbeat, with and without a murmur

0–800 ms from the start of S1

One heartbeat, with and without a murmurTwo real recordings of a single heartbeat on the same time scale, from 0 to 800 milliseconds after the start of S1. Top, recording 49568_MV, labelled no murmur: S1 120 ms, Systole 180 ms, S2 100 ms, Diastole 400 ms. Bottom, recording 9979_TV, labelled murmur: S1 153 ms, Systole 138 ms, S2 127 ms, Diastole 199 ms. The difference is in systole, between S1 and S2, drawn as a teal outline in the top beat and a hatched band in the bottom beat. In the top beat the sound there averages 0.03 of the beat's peak, a quiet gap. In the bottom beat it averages 0.30 of that beat's peak, and the dataset labels this child's murmur holosystolic (filling the whole systole).No murmurDataset label, not a model outputS1lub — mitral andtricuspid valvescloseSystoleventricles contract andpump blood outS2dub — aorticand pulmonaryvalves closeDiastoleventricles relax and refillQuiet gapthe gap between S1 and S2 stays quiet0100200300400500600700800ms+peak0−peakCirCor 49568_MV · mitral · no murmur0 ms = start of S1 · this beat lasts 800 msMurmurDataset label, not a model outputS1SystoleS2DiastoleMurmurfills the whole systole (holosystolic, as labelled in the dataset)0100200300400500600700800ms+peak0−peakCirCor 9979_TV · tricuspid · murmur grade III/VI0 ms = start of S1 · this beat lasts 618 ms

Scroll sideways to see the whole drawing

Murmur, dataset labelSystole of a beat labelled no murmurS1 and S2, dataset segmentation

Two real recordings, one heartbeat each: 49568_MV.wav (mitral site, labelled no murmur) above 9979_TV.wav (tricuspid site, labelled murmur, grade III/VI). The labels are the dataset’s, not a model output. Time is in milliseconds from the start of S1, and each trace is scaled to its own largest value, so compare shapes, not loudness. The part boundaries are the expert-reviewed S1/S2 segmentation of the dataset and the hatch is its murmur label. The sound is filtered to 20–500 Hz, the band the final system keeps.

The beats are at 5.42–6.22 s of 49568_MV and 3.66–4.28 s of 9979_TV. 8 samples at the loudest S1 peak of 9979_TV touch full scale. In murmur recordings the dataset’s S1/S2 borders can be less sharp, so some of the murmur can fall inside the S1 and S2 brackets. CirCor DigiScope Phonocardiogram Dataset, PhysioNet 2022, ODC-By 1.0.

Murmur absent

Dataset label, not a model output

Recorded at the pulmonary valve of a child with no murmur, so no bands are drawn and only the normal S1 and S2 sounds are marked.

FIG. 4 · 84987_PV.wav · pulmonary

Point at the plot, or focus it and use the arrow keys (Shift for 100 ms steps).

Test split, held out. A 2.5 s excerpt from 0 s, recorded at the pulmonary site.
Murmur present · holosystolic, grade III/VI

Dataset label, not a model output

Recorded at the tricuspid valve, where this child's murmur is loudest; the shaded bands mark the murmur (harsh, holosystolic) between S1 and S2.

FIG. 5 · 9979_TV.wav · tricuspid

Point at the plot, or focus it and use the arrow keys (Shift for 100 ms steps).

Test split, held out. A 2.5 s excerpt from 0.55 s, recorded at the tricuspid site.

Both excerpts cover the same 2.5 s of time, and each is scaled to its own range, so compare their shape rather than their loudness: the stretch between S1 and S2 is quiet in the first and filled with sound in the second. Time is in seconds from the start of each file; amplitude is in file units (full scale ±1). S1/S2 ticks and hatched murmur bands come from the dataset’s expert segmentation. CirCor DigiScope Phonocardiogram Dataset, PhysioNet 2022, ODC-By 1.0.

02 · The question

How much accuracy is lost when a heart sound passes through real hardware compared with the model’s offline score on the same file?

The project does not try to beat published murmur-detection accuracy. It measures something the reviewed literature does not report: how much accuracy is lost when the input arrives through a real analog front end.

Each held-out file is played through the hardware and classified live. The result is compared with the model’s offline score on the same files, from the same model and the same threshold, so the difference between the two is the cost of the hardware.

03 · Stage by stage

One path through eleven stages.

Each held-out file goes down it one at a time, from the dataset file to the monitor. Stages light as you read: solid means it runs today, dashed means it does not exist yet.

Stages

  1. Dataset file
  2. Speaker, simulated, awaiting parts
  3. Coupler, simulated, awaiting parts
  4. Silicone, simulated, awaiting parts
  5. Microphone, simulated, awaiting parts
  6. Conditioning, simulated, awaiting parts
  7. ADC, simulated, awaiting parts
  8. Raspberry Pi
  9. Features
  10. Classifier
  11. Monitor

The file

A heart-sound recording from the CirCor DigiScope dataset: a .wav file sampled at 4 kHz. Each held-out file is played, one at a time, through the hardware. The same file also has an offline score, which is what the model gives it in software, computed during training. That number is what the live result is compared with.

  • Runs today

Through the hardware

Here the file becomes sound. A loudspeaker plays it inside a 3D-printed coupler, through a cast silicone layer that stands in for skin, to a microphone. The front end, designed by the project’s hardware lead, runs the microphone signal through an instrumentation amplifier, a 20 Hz high-pass filter, a 500 Hz low-pass filter, a 60 Hz notch and a variable-gain stage, into a PCM1808 ADC that turns it back into numbers. It is designed and simulated, and waiting for parts. The circuit is on the Hardware tab of How it works.

  • Simulated, awaiting parts

On the Pi

The signal ends up on the Raspberry Pi. It cuts the signal into 5 s analysis windows, takes 13 MFCCs from each 20–40 ms frame within 20–500 Hz and summarises each window as 26 numbers: the mean and standard deviation of every coefficient. A random forest scores each window, and the share of its trees voting murmur is the window’s score. A recording’s decision is the mean over its windows against a fixed threshold of 0.32, and the monitor shows the waveform, the decision and the share of trees that agree with it (its confidence).

  • Runs today

04 · The experiment

Same files, same model, same threshold.

Both panels use the same bench: 160 recordings, one per held-out child, 80 with a murmur and 80 without. The threshold, 0.32, is fixed from training and never tuned to the hardware result. Only the offline baseline exists so far.

Offline baseline · software, from training

The model's score on the held-out files.

ROC AUC1 is perfect · 0.5 is chance
0.724Bench set, n = 160
SensitivityMurmurs flagged
0.7195% CI 0.61–0.80 · 57 of 80
SpecificityNo-murmur recordings cleared
0.6895% CI 0.57–0.77 · 54 of 80
AccuracyShare of recordings classified right
0.6995% CI 0.62–0.76 · 111 of 160
Confusion matrixDataset label down, model answer across
Confusion matrix, offline baseline, bench set. Rows are the dataset label; columns are the model's answer.
Predicted murmurPredicted absent
Murmur, 8057found23missed
Absent, 8026false alarm54cleared

Through the hardware · live

The same files, played and classified live.

ROC AUC1 is perfect · 0.5 is chance
Not measured
SensitivityMurmurs flagged
Not measured
SpecificityNo-murmur recordings cleared
Not measured
AccuracyShare of recordings classified right
Not measured
Confusion matrixDataset label down, model answer across
Not measured
Hardware pending

Not measured

Needs the speaker, coupler, silicone, microphone, front end and ADC.

  • Source · results/injected__bench.json
  • Bench set, n = 160, one recording per held-out child
  • Wilson 95% intervals
  • Threshold 0.32, fixed from training, never tuned to the hardware result

For scale: a model that always answers “absent” scores 0.50 accuracy on this balanced set. This one finds 57 of 80 recordings with a murmur, but clears only 54 of 80 recordings without one (26 false alarms), and it finds 31 of 51 recordings with a soft grade I/VI murmur.

A third run, simulated bandpass, applies a software filter to the files. It is not the hardware, so it is always labelled simulated and never merged into this comparison.

See the simulated run on Data & AI