# AudioDataLayer

The AudioDataLayer allows you to add information for audio output such like sample rate.


API Reference

# Type

The AudioDataLayer is of the type audioData.

# Example

import SosGetResult from 'osh-js/core/datasource/sos/SosGetResult.datasource.js';
import AudioDataLayer from 'osh-js/core/ui/layer/AudioDataLayer';
import {Mode} from 'osh-js/core/datasource/Mode';

let audioDataSource = new SosGetResult("alex-audio", {
    endpointUrl: "sensiasoft.net/sensorhub/sos",
    offeringID: "urn:android:device:dd90fceba7fd5b47-sos",
    observedProperty: "http://sensorml.com/ont/swe/property/AudioFrame",
    startTime: "2021-04-12T10:48:45Z",
    endTime: "2021-04-12T10:49:45Z",
    mode: Mode.REPLAY,
    tls: true
});

const dataSynchronizer = new DataSynchronizer({
  replaySpeed: 1.0,
  masterTimeRefreshRate: 250,
  startTime: "2021-04-12T10:48:45Z",
  endTime: "2021-04-12T10:49:45Z",
  dataSources: [
      audioDataSource
  ]
});

let audioView = new AudioView({
    name: "Audio",
    css: 'audio-css',
    container: 'audio-chart-container',
    gain: 5,
    playSound: true,
    layers: [
        new AudioDataLayer({
            dataSourceId: audioDataSource.id,
            getSampleRate: (rec) => rec.sampleRate,
            getFrameData: (rec) => rec.samples,
            getTimestamp: (rec) => rec.timestamp
        })
    ]
});