Can we teach Stata "yes", "no", and "stop" from labelled recordings, then ask it to identify new clips or reject them? This small user-written experiment uses stored audio templates. Template learning, calibration, and recognition run in Stata/Mata.
Try it
1. Download the ZIP and extract it. Audio, code, and a fitted model are included; no recording or Python installation is needed.
2. In Stata, change the path below to the extracted listening folder and run:
Tested with Stata/MP 16.1 on macOS (Apple Silicon); other platforms are untested. This reads isolated WAV files, not a live microphone.
What should happen?
Look for:
Acceptance does not always mean a correct answer. My saved results were:
Thus, 8 of the 35 accepts were wrong. The noise clips are slices of one synthetic recording. Per-clip labels, decisions, and response text are saved in replay_outputs/evaluation_predictions.csv. Replaying these supplied clips should reproduce the results above.
Try the learning step too
This stores templates from 45 labelled recordings and fits acceptance criteria using 50 separate clips. It writes a rebuilt model to rebuild_01/public_calibrated.mmat; the 95 evaluation clips are excluded from fitting.
Both commands preserve your current dataset. For another run, extract a fresh copy: existing output files/folders are refused.
A remaining question
Can more varied training examples reduce rejected target words without increasing false accepts? If you try this, please report your Stata version, OS, and whether you obtain the same counts.
Audio: Speech Commands v0.02, curated by Pete Warden/Google with volunteer contributions (CC BY 4.0; attribution included). Methods and further examples.
Try it
1. Download the ZIP and extract it. Audio, code, and a fitted model are included; no recording or Python installation is needed.
2. In Stata, change the path below to the extracted listening folder and run:
Code:
cd "/your/path/extracted-repository/listening" do replay.do
What should happen?
Look for:
Code:
PUBLIC_REPLAY_COMPLETE: 95 clips, 35 accepted.
Code:
Input Clips Correct word Wrong accept Rejected yes / no / stop 60 27 5 28 Other words 30 - 3 27 Synthetic noise 5 - 0 5
Try the learning step too
Code:
do rebuild_model.do
Both commands preserve your current dataset. For another run, extract a fresh copy: existing output files/folders are refused.
A remaining question
Can more varied training examples reduce rejected target words without increasing false accepts? If you try this, please report your Stata version, OS, and whether you obtain the same counts.
Audio: Speech Commands v0.02, curated by Pete Warden/Google with volunteer contributions (CC BY 4.0; attribution included). Methods and further examples.
