-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
731 additions
and
425 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import test from 'ava' | ||
import test from "ava"; | ||
|
||
test('sum from native', (t) => { | ||
t.pass() | ||
}) | ||
test("sum from native", (t) => { | ||
t.pass(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,74 @@ | ||
import { readFileSync } from 'node:fs' | ||
import djs from '@discordjs/opus' | ||
import opusscript from 'opusscript' | ||
import mediaplex from '../index.js' | ||
import * as evanOpus from '@evan/opus' | ||
import * as evanOpusWasm from '@evan/opus/wasm/index.mjs' | ||
import * as simdEvanOpus from '@evan/wasm/target/opus/node.mjs' | ||
import { readFileSync } from "node:fs"; | ||
import djs from "@discordjs/opus"; | ||
import opusscript from "opusscript"; | ||
import mediaplex from "../index.js"; | ||
import * as evanOpus from "@evan/opus"; | ||
import * as evanOpusWasm from "@evan/opus/wasm/index.mjs"; | ||
import * as simdEvanOpus from "@evan/wasm/target/opus/node.mjs"; | ||
|
||
export const generatePCMSample = (sampleSize) => { | ||
return readFileSync(new URL(`./data/sample.pcm`, import.meta.url)).subarray(0, sampleSize) | ||
} | ||
return readFileSync(new URL(`./data/sample.pcm`, import.meta.url)).subarray( | ||
0, | ||
sampleSize, | ||
); | ||
}; | ||
|
||
export const generateOpusSample = () => { | ||
return readFileSync(new URL(`./data/sample.opus`, import.meta.url)) | ||
} | ||
return readFileSync(new URL(`./data/sample.opus`, import.meta.url)); | ||
}; | ||
|
||
export const createMediaplexEncoder = (config) => new mediaplex.OpusEncoder(config.SAMPLE_RATE, config.CHANNELS) | ||
export const createDjsEncoder = (config) => new djs.OpusEncoder(config.SAMPLE_RATE, config.CHANNELS) | ||
export const createMediaplexEncoder = (config) => | ||
new mediaplex.OpusEncoder(config.SAMPLE_RATE, config.CHANNELS); | ||
export const createDjsEncoder = (config) => | ||
new djs.OpusEncoder(config.SAMPLE_RATE, config.CHANNELS); | ||
export const createOpusScriptWasmEncoder = (config) => | ||
new opusscript(config.SAMPLE_RATE, config.CHANNELS, opusscript.Application.AUDIO, { | ||
wasm: true, | ||
}) | ||
new opusscript( | ||
config.SAMPLE_RATE, | ||
config.CHANNELS, | ||
opusscript.Application.AUDIO, | ||
{ | ||
wasm: true, | ||
}, | ||
); | ||
export const createOpusScriptAsmEncoder = (config) => | ||
new opusscript(config.SAMPLE_RATE, config.CHANNELS, opusscript.Application.AUDIO, { | ||
wasm: false, | ||
}) | ||
new opusscript( | ||
config.SAMPLE_RATE, | ||
config.CHANNELS, | ||
opusscript.Application.AUDIO, | ||
{ | ||
wasm: false, | ||
}, | ||
); | ||
export const createEvanOpusEncoder = (config) => | ||
new evanOpus.Encoder({ | ||
application: 'voip', | ||
application: "voip", | ||
channels: config.CHANNELS, | ||
sample_rate: config.SAMPLE_RATE, | ||
}) | ||
}); | ||
export const createEvanOpusDecoder = (config) => | ||
new evanOpus.Decoder({ | ||
channels: config.CHANNELS, | ||
sample_rate: config.SAMPLE_RATE, | ||
}) | ||
}); | ||
export const createEvanOpusEncoderWasm = (config) => | ||
new evanOpusWasm.Encoder({ | ||
application: 'voip', | ||
application: "voip", | ||
channels: config.CHANNELS, | ||
sample_rate: config.SAMPLE_RATE, | ||
}) | ||
}); | ||
export const createEvanOpusDecoderWasm = (config) => | ||
new evanOpusWasm.Decoder({ | ||
channels: config.CHANNELS, | ||
sample_rate: config.SAMPLE_RATE, | ||
}) | ||
}); | ||
export const createSimdEvanOpusEncoder = (config) => | ||
new simdEvanOpus.Encoder({ | ||
application: 'voip', | ||
application: "voip", | ||
channels: config.CHANNELS, | ||
sample_rate: config.SAMPLE_RATE, | ||
}) | ||
}); | ||
export const createSimdEvanOpusDecoder = (config) => | ||
new simdEvanOpus.Decoder({ | ||
channels: config.CHANNELS, | ||
sample_rate: config.SAMPLE_RATE, | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.