Skip to content

Instantly share code, notes, and snippets.

@j0nscalet
Created May 25, 2022 06:38
Show Gist options
  • Save j0nscalet/15945b34e97bf4474c4832baebc61d9e to your computer and use it in GitHub Desktop.
Save j0nscalet/15945b34e97bf4474c4832baebc61d9e to your computer and use it in GitHub Desktop.
import fs from 'fs'
import wav from 'node-wav'
import wrtc from 'wrtc'
let buffer = fs.readFileSync("Drifting.wav")
let result = wav.decode(buffer)
let audioSource = new wrtc.nonstandard.RTCAudioSource()
audioSource.onData({
samples: result.channelData.buffer,
sampleRate: 48000,
channelCount: 2,
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment