Composition

Erie offers two primary options for concatenation-based composition: sequence and overlay.

Sequence: concatenate streams serially

Multiple streams concatenated using sequence are played one by one.

JSON

{
  ...
  "sequence" : [
    { ... },
    { ... },
  ]
  ...
}

JavaScript

let stream1 = new Erie.Stream();
...
let stream2 = new Erie.Stream();
...

let sequence = new Erie.Sequence(stream1, stream2);
// alternatively
let sequence = new Erie.Sequence([stream1, stream2]);

Overlay: play streams parallelly

Multiple streams joined using overlay are played simultaneously together. Note: using a speech encoding channel may result in uncoordinated scheduling.

JSON

{
  ...
  "overlay" : [
    { ... },
    { ... },
  ]
  ...
}

JavaScript

let stream1 = new Erie.Stream();
...
let stream2 = new Erie.Stream();
...

let overlay = new Erie.Overlay(stream1, stream2);
// alternatively
let overlay = new Erie.Overlay([stream1, stream2]);

Patterns

Erie supports the following patterns for composing multiple streams.

  • ✅ A sequence of overlays and/or streams
  • ✅ An overlay of streams (without a repeat channel by overlay)

The following patterns are not supported (mostly because it may cause unexpected browser malfunctioning).

  • ❌ An overlay of sequencess. Use sequences of overlay instead.
  • ❌ An overlay of streams (with a repeat channel by overlay).
© Hyeok Kim