Stream Streaming

A streaming stream shares most of the properties with a static stream.

To make a sonification for streaming data, set stream: true in your data property.

Some limitations:

  • No overlay is supported (yet).
  • Sequnece stream is purposefully not supported.

Streaming sonification properties

There are two new properties at a top-level spec: playback and notify. For data, you can provide an optional test data. For tone, you can specify a base tone (default: false).

playback property

Setting the playback property allows for playing some historical data points. If not provided, no playback will happen (same as setting init_by: 'manual')

Property type Description
init_by 'manual'|'conditional'|'always' (Optional, default: 'always') How to initiate a playback ('manual': manually–not going to be played unless indicated, 'conditional': when a set condition is met, 'always': always before playing the new data points).
condition ExprString (Optional) A condition statement for when to play historical data points (see transform-filter for how to write a condition).
limit number|datetime (Optional, default: 5) The number of historical items to play at a time. If the unit is 'time' then it has to be date-time format.
unit 'datum'|'instance'|'time' (Optional, default: 'instance') The unit of playback limit ('datum': individual data points regardless of when they were received; 'instance': data sets received together, 'time': up to a certain time that data have been received). They will be queried as instances.
speed number (Optional, default: 2) Speed factor for playback. The higher, the faster.

notify property

You can specify five notification settings: incoming (to signal new incoming data points), beforePlayback (to indicate there is a playback), afterPlayback (to indicate the playback is finished), beforePlay (to singal new data points being played), afterPlay (to mark that the play is done), next (to indicate a next sound). Each playback item can be either speech, sampling, and chime (default). To not play a notification, set it null.

speech notify

Property type Description
speech string (Required) A natural language speech for anouncement.
loudness number[0-1] (Optional, default: 1) The loudness of the speech.
pitch number (Optional, default value follows the browser/TTS function’s setting) The pitch of the speech.
language BCP47Expression (Optional, default: 'en-US') The language for the speech
speechRate number (Optional, default: 1.75) The speed of the speech. The higher, the faster.

sampling notify

Property type Description
sample string (Required) A URL for the sampled sound.
loudness number[0-1] (Optional, default: 1) The loudness of the sound.
detune number (Optional, deafult: 0) The amount of detune for the sound.

chime notify (default)

Property type Description
chime ChimeName (Required) The name of a chime to use.
loudness number[0-1] (Optional, default: 1) The loudness of the sound.

Supported chime names: 'beforePlay', 'afterPlay', 'beforePlayback', 'afterPlayback', 'incoming', and 'next'. They are mapped to the corresponding notification items. (Custom chime will be supported in the future.)

Cases

Case 1: discrete sound without base tone

JSON

{
  "title": "...",
  "description": "...",
  "data": {
    "stream": true,
    "test": {"values": [ ... ]}
  },
  "transform": [...],
  "tick": [ ... ],
  "tone": { "continued": false },
  "encoding" : { ... },
  "config": { ... },
  "playback": {
    "init_by": "always",
    "limit": 3,
    "unit": "instance",
    "speed": 2
  },
  "notify": {
    "beforePlay": {
      "speech": "Playing",
      "language": "en-US"
    }
  }
}

JavaScript

let stream = new Erie.Stream();
stream.title.set("...");
stream.description.set("...");
stream.data.set(...);
stream.transform.add(...);
stream.tone = new Erie.Tone();
stream.tone.continued(false); // optinal.
... 
stream.playback = new Erie.Playback('always', 'instance', 3, 2) // init_by, unit, limit, speed, (condition)
stream.notify.beforePlay = new Erie.Notify("speech");
stream.notify.beforePlay.speech("Playing").language("en-US");

Case 2: continuous sound with a base tone

JSON

{
  "title": "...",
  "description": "...",
  "data": {
    "stream": true,
    "test": {"values": [ ... ]}
  },
  "transform": [...],
  "tick": [ ... ],
  "tone": {
    "continued": true,
    "hasBaseTone": true
  },
  "encoding" : {
    "pitch": { "value": 220, ... },
    "loudness": { "value": 0.2, ... } // base values
  },
  "config": { ... },
  "playback": {
    "init_by": "conditional",
    "condition": "datum.value > 5"
  }
}

JavaScript

let stream = new Erie.Stream();
stream.title.set("...");
stream.description.set("...");
stream.data.set(...);
stream.transform.add(...);
stream.tone = new Erie.Tone();
stream.tone.continued(true).hasBaseTone(true); // optinal.
...
stream.encoding.pitch = new PitchChannel();
stream.encoding.pitch.value(220);
stream.encoding.loudness = new LoudnessChannel();
stream.encoding.loudness.value(0.2);
stream.playback = new Erie.Playback('conditional') // init_by
stream.playback.condition("datum.value > 5");
© Hyeok Kim