A Webassembly/Javascript port of Lyra, a neural audio codec from Google. It enables audio encoding and decoding with Lyra on web browsers.
npm install lyra-codec --save
import {encodeWithLyra, decodeWithLyra, isLyraReady} from 'lyra-codec'
import {encodeWithLyra, decodeWithLyra, isLyraReady} from 'https://unpkg.com/lyra-codec/dist/lyra_bundle.js'
if (isLyraReady()) {
// Encode with Lyra codec.
const rawAudio = new Float32Array(...);
const encodedAudio = encodeWithLyra(audioArray, kSampleRate);
const decoded = decodeWithLyra(encodedAudio, kSampleRate, rawAudio.length);
} else {
...
}
See Lyra on webassembly for a demo of lyra-js in action, and Playing with Lyra on how to use it for webrtc.