For Developers

Build a sound-reactive page
with a few lines of JS

AiryMedia Trigger is an audio-trigger detection engine that runs in the browser. Sound picked up by the microphone is matched on the device, and a callback fires the moment a pre-registered sound is detected. No recorded audio is ever sent to a server.

Integration example

An integration example of the JS SDK as used in real deployments (the API is subject to change).

// The SDK is an ES module; the delivery URL is shown in the console's SDK information panel
const { AiryMediaTrigger } = await import(SDK_URL);

// The appKey is issued per campaign
const amt = new AiryMediaTrigger({ appKey: 'YOUR_APP_KEY' });

// Fires every time a registered sound is detected
amt.on('trigger', (ev) => {
  // ev = { method, value, timestamp, extras }
  showCoupon(ev.value); // e.g. show a coupon, start an effect, hand off to LINE
});

amt.on('error', (err) => {
  console.error(err.code, err.message);
});

// start() covers mic permission, auth, engine loading and listening
await amt.start();

// Stopping also releases the microphone
await amt.stop();

What happens after detection is up to you, in plain JavaScript. It can be embedded in existing sites, landing pages, LINE mini apps, and in-app WebViews.

Detection events and errors

The trigger event

Fires every time a registered sound is detected. value is the identifier you assigned when registering the audio — branch on it to decide what to show. The event also carries the detection method (method), the detection time (timestamp) and method-specific details (extras).

Where sounds from several campaigns may overlap, it is safer to ignore any value you did not expect and keep listening.

The error event and start() exceptions

Errors are distinguished by err.code: mic_permission (microphone not granted), entitlement_denied (appKey, origin or contract state), engine_load (failed to load the detection engine) and config (incorrect usage).

A denied microphone and a misconfiguration call for very different guidance on screen, so we recommend branching your messaging on the code.

Two detection methods

Acoustic fingerprinting (EFP2)

Register your existing audio in the CMS as-is and it becomes recognizable. No editing of the source required — already-aired commercials and existing BGM can be used as triggers directly.

Acoustic watermarking

Embeds a signal inaudible to the human ear into the audio. Identifier design is highly flexible — the same track can act as a different trigger per venue or per time slot.

* The two methods can be combined. Both are deterministic matching against registered sounds — not AI speech recognition that listens to conversations.

Requirements & preconditions

  • HTTPS required (microphone access works only in a secure context). In local development localhost works over http, but a LAN IP address (http://192.168.x.x) does not
  • The URL of the page you publish must be registered in the CMS. Calls from an unregistered domain fail authentication (localhost needs no registration, so local development works as-is). Only the scheme and host are stored; the path is ignored
  • Supported browsers: current Chrome / Safari / Firefox / Edge
  • User permission for microphone use is required (the permission-prompt UX affects results)
  • In the browser, it runs while the page is in the foreground. To react in the background or on the lock screen, app integration is available — please contact us
  • For app integration: iOS 15.0+ / latest Android System WebView
  • Recognition accuracy may drop in highly reverberant environments (large facilities, station concourses, etc.)

* Network requirements (CDN domain allowlisting, etc.) and preparation details are covered in the onboarding manual provided at deployment.

From CMS setup to going live

How you create an event in the management console (AiryMedia Trigger CMS), register audio, and get the appKey your code needs. The screens below are the real console, with the appKey and the SDK delivery URL masked. The console is currently available in Japanese only.

  1. Create an event and choose the detection type

    An "event" is the container for one campaign. The detection type you pick here — Fingerprint or Watermark — determines how the audio is handled from then on. Choose Fingerprint to use existing audio as-is; choose Watermark to embed a signal and control identifiers in fine detail.

    The CMS "create new event" screen. An event name is filled in and the detection type dropdown shows Fingerprint. Other fields cover maximum length in seconds, delivery deadline, event period and venue.
    The detection type is fixed when the event is created. Delivery stops once the deadline passes.
  2. Upload the audio and decide the identifier

    Register the audio you want to act as a trigger. With Fingerprint you type the "metadata" yourself — that string is what comes back as value on the trigger event. It is returned URL-encoded, so run decodeURIComponent on it if it contains non-ASCII characters.

    Watermark has no metadata field. On upload, each audio file is assigned a numeric ID automatically, and that number becomes the value.

    The audio upload screen for a Fingerprint event, with an audio name filled in and a metadata field containing sample_bgm_01, showing an encoded length counter of 13 / 800. Supported formats are WAV and MP3.
    Audio registration for Fingerprint. Metadata is capped at 800 characters after encoding.
  3. Wait for processing to finish

    Uploaded audio is processed server-side for recognition (long files can take tens of minutes). For Fingerprint, running "create / update packeddb" flips the event status to complete and delivery starts.

    For Watermark, each file is processed individually and the watermarked audio becomes downloadable as it completes. What you actually play at the venue or on air is that downloaded file — the original audio will not be detected. Fingerprint uses the original audio unchanged.

    The audio list of a Watermark event. The registered audio has an assigned numeric ID and a status of "processing"; the leftmost watermarked-audio column shows a dash while processing is still running.
    Watermark assigns a numeric ID per audio file — that number is the value you receive on detection. The leftmost column shows a dash while processing runs, and turns into a download button once it completes.
  4. Put the issued appKey in your code

    An appKey is issued per event and shown in the "SDK information" panel on the event page. As in the integration example above, pass the appKey to new AiryMediaTrigger({ appKey }) and you are up and running.

    The detail screen of a Fingerprint event. The audio list shows the registered metadata, and the SDK information panel below has SDK URL and APIKEY fields. The APIKEY, SDK URL and uploader values are masked out.
    The appKey appears in the SDK information panel (masked in this image), together with the SDK delivery URL.
  5. Register the URL you will publish on

    Finally, register the URL of the page that loads the SDK. Calls from an unregistered domain fail authentication. Only the scheme and host are stored; the path is ignored. localhost needs no registration, so local development works without it. If you use separate production and staging domains, register each one.

    The CMS list of URLs that may use the SDK. A note says localhost does not need to be registered, one registered entry for https://example.com is listed, and there is an add-URL button.
    Recognition can only start from pages on a registered URL with this appKey.

* Once live, trigger counts (how many times a registered sound was recognized) are available in the CMS reports. Always test under conditions close to the real playback environment (venue, broadcast, store) before going live.

Start with a free trial

Free from application until the end of the following month, up to 10,000 total triggers