Skip to content

4.4.0: run models that take sound (includes 4.3.0) - #28

Merged
hamza-aamer merged 4 commits into
mainfrom
feature/audio-prediction
Nov 26, 2026
Merged

hamza-aamer merged 4 commits into
mainfrom
feature/audio-prediction

Conversation

@hamza-aamer

@hamza-aamer hamza-aamer commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Run models that take sound (manifest schema 2). Part of edge-ml/edge-ml#100. Needs edge-ml/ml#95 and #96.

Version 4.4.0, including the unreleased 4.3.0 (labels over time ranges). Merging to main publishes 4.4.0 to npm.

  • addAudio / addPcm16 take sound at any rate, which goes through a streaming windowed-sinc resampler (anti-aliased) to the model's rate.
  • Sensors go on a time grid as in training. predict aligns sound and sensors in time.
  • New: predictInputs, isReady, windowMs, audioSampleRate, edgeML.Resampler.
  • Training options take preset and audio.
  • The schema-1 path is unchanged.
  • examples/example-audio-web classifies the microphone live.

Checked:

  • Jest: 82 passed, using backend-exported fixtures with Python reference scores, plus resampler tone, alias and chunking tests.
  • The browser bundle check passes.
  • Live against a local stack: a mixed_cnn model streamed a held-out subject (44.1 kHz WAV + accelerometer) and got 325/325 windows right.
  • Browser mic demo in Chromium with a fake 44.1 kHz microphone: chopping 19/19, talking 21/23, standing 18/23.

- sendDataset takes labels over time ranges; addLabels adds them to an
  existing dataset
- a label for the whole dataset was dropped for a dataset that only holds
  recordings; with recordings the labels are now sent last, so that label
  covers them too
OnnxPredictor reads manifest schema 2 (models with a sound input, or
several inputs, and windows of a fixed duration):
- addAudio / addPcm16 take sound at any sample rate; it is mixed to mono
  and converted to the model's rate by a streaming windowed-sinc resampler
  that filters out what would alias.
- Sensors are interpolated onto the model's grid, as in training, and
  predict() classifies the latest window of sound and sensors, aligned in
  time. predictInputs classifies given windows; isReady tells when enough
  is buffered.
Sensor models (schema 1) take the same path as before.

Training options take preset and audio. Exports Resampler. Adds
examples/example-audio-web, which classifies the microphone live, and
fixtures exported by the backend with Python reference scores.

Part of edge-ml/edge-ml#100
The Flutter library's fixtures are made with the same script.

Part of edge-ml/edge-ml#100
Includes the unreleased 4.3.0 (labels over time ranges).
@hamza-aamer
hamza-aamer marked this pull request as ready for review November 26, 2026 03:38
@hamza-aamer hamza-aamer changed the title 4.4.0: run models that take sound 4.4.0: run models that take sound (includes 4.3.0) Nov 26, 2026
@hamza-aamer
hamza-aamer merged commit 50f0fd3 into main Nov 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant