Detecting Audio Anomalies with Multimodal Embeddings
Detect anomalous sounds without training a model: compare audio clips to stored site profiles built with Amazon Nova Multimodal Embeddings on Amazon Bedrock.
Listening for the unusual
Audio anomaly detection is the job of telling an unusual sound apart from the normal sound of a place. A factory monitors its pumps and fans for the change in sound that comes before a bearing fails. A care facility listens for a fall or a call for help in a resident's room. A city listens for gunshots. A security company listens to monitored sites at night for breaking glass, a forced door, or someone damaging property. In each case, almost all of the audio is ordinary, and the system has to find the rare clip that needs a person's attention.
The problem is harder than it sounds. "Normal" is different at every site: a bakery at 4 a.m. sounds nothing like a warehouse at 4 a.m., and the same building sounds different in summer, when the air conditioning runs, than in winter. The anomalies themselves are rare, so there is little labeled data for them, and many of them never happen at a given site at all. The audio quality also varies. Some microphones record full-bandwidth audio, and others send their audio over a phone line or a compressed link that removes much of the signal. Both kinds of error cost money. A false alarm takes an operator's time and can send a guard or the police to an empty building, and a missed alarm is a break-in nobody responds to.
How it is done today
Most systems use one of three approaches:
- Rules and dedicated sensors. A sound-level threshold, or a sensor tuned to one sound, such as an acoustic glass-break detector that listens for a specific pattern. These are cheap and fast, but each one detects one kind of event, and a loud nominal noise in the right frequency range sets them off.
- Trained classifiers. A model, often a neural network on spectrograms, trained on labeled examples of each sound it needs to recognize. This handles many sound types, but it needs labeled training data and machine learning expertise to build and maintain.
- Anomaly models trained on normal sound. A model, such as an autoencoder, learns what a site or a machine normally sounds like and flags anything it reconstructs poorly. This needs no labeled anomalies, but it needs a training run for each site or machine, and it flags any change, including harmless ones.
The two trained approaches share a cost that grows with every site. Because normal sound differs by site, a common design gives each site its own output class: one class per site that means "a harmless sound here", plus a shared class for "alarm". That design works until you add the next site. A new site changes the model's output layer, a changed output layer means retraining the whole model, and retraining moves every existing site's scores against the thresholds that were tuned for it. Onboarding cost grows with each new customer, and each new customer puts the accuracy of the existing sites at risk.
A different approach: off-the-shelf multimodal embedding models
A multimodal embedding model turns text, images, video, or audio into a vector, a list of numbers that places similar inputs close together. These models are trained once by their provider on large, general data, and you call them as an API. If such a model places one site's normal sounds close together and places breaking glass somewhere else, you can detect anomalies by comparing vectors, with no training at all.
The design moves site identity out of the model and into a vector store. Each audio clip becomes an embedding. For each site, the embeddings of a sample of its normal sounds are averaged into one vector, the site's profile. One pooled alarm profile is built the same way from alarm sounds, because an alarm sounds much the same at every site. When a new clip arrives, the system compares it with its site's profile and with the alarm profile. Adding a site means writing one row to the vector store. Nothing is retrained, and the existing sites' scores do not change.
The open question is whether a frozen embedding model, one that has never been trained on your sounds, separates them well enough to trust. In my test it told sites apart well, but it missed too many alarms once the audio was reduced to telephone quality.
Example: detecting anomalous sounds at monitored sites
In this example, each monitored site has a microphone, and the system must suppress the site's ordinary sounds and escalate break-ins to an operator. Breaking glass stands in for a break-in, because it is the break-in sound with public labeled recordings.

The model
I used Amazon Nova Multimodal Embeddings on Amazon Bedrock (
amazon.nova-2-multimodal-embeddings-v1:0 , us-east-1), which embeds text, images, video, and audio into the same vector space. I used it frozen: nothing was trained or fine-tuned. An audio request looks like this:import base64, json, boto3
bedrock = boto3.client("bedrock-runtime", region_name="us-east-1")
def embed(wav_path, dim=1024): body = { "schemaVersion": "nova-multimodal-embed-v1", "taskType": "SINGLE_EMBEDDING", "singleEmbeddingParams": { "embeddingPurpose": "CLASSIFICATION", "embeddingDimension": dim, "audio": { "format": "wav", "source": {"bytes": base64.b64encode(open(wav_path, "rb").read()).decode()}, }, }, } resp = bedrock.invoke_model( modelId="amazon.nova-2-multimodal-embeddings-v1:0", body=json.dumps(body) ) return json.loads(resp["body"].read()) # embedding vector is in the responseThe request sends the audio inline as base64 under
source.bytes . If the API rejects inline audio for your clips, upload them to Amazon S3 and use {"s3Location": {"uri": "s3://..."}} as the source instead. In my demo, each call took about 430 ms per clip.The data
I used ESC-50 , a public set of 2,000 five-second environmental sound clips in 50 classes, with 40 clips per class. Its license is CC BY-NC , and I used it only to measure; nothing was trained on it or shipped from it. If you need audio you can reuse more freely, the ESC-10 subset of ESC-50 is licensed CC BY, though it has no glass-breaking class.
Eight sound classes stood in for the normal background of eight sites: washing machine, vacuum cleaner, engine, creaking door, can opening, keyboard typing, clock ticking, and water drops. Glass breaking was the alarm class. For each class, half of the clips built the profile and the other half were the test set. I repeated this with 7 different random splits and report the averages.
The decision rules
Every comparison uses cosine similarity on L2-normalized vectors. A profile is the normalized mean of a site's normalized enrollment embeddings.
import numpy as np
def l2(v): return v / np.linalg.norm(v)
def profile(vectors): # one row per site in the vector store return l2(np.mean([l2(v) for v in vectors], axis=0))
def suppress(clip, site_profile, alarm_profile): """Nominal check: the site is known, so compare to that site only.""" return np.dot(l2(clip), site_profile) > np.dot(l2(clip), alarm_profile)
def escalate(clip, all_site_profiles, alarm_profile): """Alarm check: a break-in can happen anywhere, so the alarm profile must beat the BEST-matching site, not just one.""" best_site = max(np.dot(l2(clip), p) for p in all_site_profiles) return np.dot(l2(clip), alarm_profile) > best_siteThe alarm rule is strict on purpose. A missed break-in is the failure you cannot ship, so the alarm profile has to beat every site's profile, not an average.
I also measured site discrimination: whether a clip from one site scores closest to that site's profile, out of all eight. Chance is 1 in 8, or 12.5%. If the embeddings put all background noise in one undifferentiated cluster, this number would sit near chance. For each nominal clip I also recorded the margin, the clip's similarity to its own site's profile minus its similarity to the alarm profile. A thin margin means a small change in the audio could flip the decision, so the margin shows how much room a threshold has.
Wideband and telephone-quality audio
Much alarm audio does not arrive at studio quality, because it comes over a phone line or a compressed link. I ran every test twice: once on the original 44.1 kHz audio, and once on a narrowband copy at 8 kHz with a 300-3,400 Hz passband, which imitates a telephone channel.
ffmpeg -i clip.wav -ar 8000 -ac 1 -af "highpass=f=300,lowpass=f=3400" clip_8k.wavPass/fail gates, set before running
- Site discrimination above 70%. Otherwise the profiles do not carry per-site information.
- Missed alarms at or below 2%. This is a floor for clean public data, not a production target.
- Narrowband loses less than 10 points on every metric.
Cost of the test
The test used 360 clips per band, 40 from each of the nine classes, so both bands together took about 720 embedding calls of about five seconds of audio each. The full run, including the settings comparison below, took about 2,160 calls. I cached every embedding on disk by model, dimension, purpose, and file, so re-running the analysis or adding more random splits cost nothing. Before the full run, I made one call to confirm the model was enabled in my account, then ran a quick smoke test on 10 clips per class at 256 dimensions.
Results
Metric | Wideband 44.1 kHz | Narrowband 8 kHz | Change |
|---|---|---|---|
Nominal sounds suppressed | 99.6% | 99.5% | -0.2 |
Alarms escalated | 97.9% | 87.9% | -10.0 |
Missed alarms | 2.1% | 12.1% | +10.0 |
Site discrimination | 93.0% | 88.5% | -4.6 |
Gate | Target | Result |
|---|---|---|
1. Profiles carry site information | above 70% | Pass: 93.0% wideband, 88.5% narrowband (chance is 12.5%) |
2. Alarms survive | at most 2% missed | Wideband 2.1%, borderline. Narrowband 12.1%, fail |
3. Narrowband holds | under 10 points lost | Fail at the line: alarms dropped exactly 10.0 |
The profiles worked. A frozen model that had never seen a label told eight sites apart 88-93% of the time, against 12.5% by chance, and suppression of nominal sounds stayed at 99.5% even on narrowband audio. Per-site classes in a model's output layer are a design choice, not a requirement: you can onboard a site by writing a row.
Break-in detection did not hold up on telephone-quality audio. There, 1 in 8 alarms was suppressed, and missed alarms rose from about 2% to about 12%. The obvious settings did not change that:
Configuration | Wideband alarms | Narrowband alarms | Change |
|---|---|---|---|
1024 dimensions, CLASSIFICATION | 97.9% | 87.9% | -10.0 |
3072 dimensions, CLASSIFICATION | 97.1% | 87.1% | -10.0 |
1024 dimensions, AUDIO_RETRIEVAL | 97.9% | 87.9% | -10.0 |
More dimensions did not help, and changing
embeddingPurpose made no difference to the decisions at 1024 dimensions.The likely cause is physical. Breaking glass is mostly high-frequency energy, and a 3,400 Hz low-pass filter removes the part of the signal that identifies it. The nominal sounds in this test (motors, typing, water, creaking) sit lower in the spectrum and pass through the same filter, so one side of the decision degrades and the other does not. The information may still be in the narrowband signal, but a general model trained mostly on broadband audio does not find it. If you already have an audio classifier trained on your own channel, you can use it as the encoder instead: remove its classification head and build profiles from its last hidden layer. That also needs no new training, and the model already knows your audio.
The demo: add a site with about ten calls
I built a small web app on the same code to show the design working live. Profiles and clip vectors are stored in an Amazon DynamoDB table (pay-per-request, created with Terraform), with one
PROFILE#<site_id> row per site, and every decision is written to a second table with its scores, margin, and verdict. In the demo I enroll the pooled alarm profile and two sites, classify a few test clips against them, then enroll a sound class the system has never heard, which takes about 10 Bedrock calls, and classify a clip from it right away. One row is written, nothing is retrained, and the existing sites' scores do not change.Limits of this test
The alarm numbers rest on small counts. ESC-50 has only 40 glass-breaking clips, so each split tested 20, and misses ranged from 0 to 5 of 20 per split. The direction and size of the narrowband drop are clear; the exact percentage is not. The sites are also the easy version of the problem, because each one is a different kind of sound. Telling one building's compressor from another building's compressor is harder. The MIMII dataset is the better test: it has 16 kHz recordings of several units of the same machine type, such as pumps 00, 02, 04, and 06, each with normal and abnormal sounds, so each unit can stand in for a site and its abnormal clips for the alarm. MIMII is licensed CC BY-SA 4.0. My test harness already supports it, but I have not run it yet.
Breaking glass is the only break-in sound I tested. Forced doors, prying, and other damage are lower in frequency and may survive narrowband audio better, but that is untested. The phone line is simulated by a filter, while an actual phone channel adds a codec and line noise. I did not test how many clips a site needs for a stable profile, and I did not measure production cost or latency.
Cleanup
To remove the demo resources, run
terraform destroy . It deletes both DynamoDB tables and the IAM policy. Point-in-time recovery and deletion protection are off by default because the demo stores throwaway test data; turn them on before you store anything you want to keep.Try it on your own audio
Start by finding out the sample rate your microphones deliver, because it decides the answer: on wideband audio a frozen embedding model came close to passing, and on 8 kHz audio it did not. Then pick a few sites, enroll a profile for each from a sample of their normal sounds, and run your own recorded alarms and nominal sounds through the decision rules above. Set your pass/fail gates before you run, as I did here, so the results decide the question.
If you don't yet have recordings of break-ins from your own sites, the MIVIA audio events dataset is the closest public match I found: it has glass breaking, gunshots, and screams recorded on a surveillance audio device at six noise levels. Its terms are not published, so request access early.
If your audio is narrowband, compare Nova with an encoder trained on your own channel, using the same profiles and rules. You can also swap in another audio embedding model on Bedrock, such as TwelveLabs Marengo, which accepts audio in us-east-1, without changing the rest of the code.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article