MCPcopy Create free account
hub / github.com/JunJD/alading / base64ToInt16Array

Function base64ToInt16Array

src/lib/utils.ts:35–40  ·  view source on GitHub ↗
(base64: string)

Source from the content-addressed store, hash-verified

33
34// base64 转 Int16Array
35export function base64ToInt16Array(base64: string): Int16Array {
36 const binary = atob(base64);
37 const bytes = new Uint8Array(binary.length);
38 binary.split('').forEach((char, i) => bytes[i] = char.charCodeAt(0));
39 return new Int16Array(bytes.buffer);
40}
41
42// 将 Int16Array 转换为 WAV 格式的 Buffer
43export function int16ArrayToWavBuffer(int16Array: Int16Array, sampleRate = 16000): Buffer {

Callers 2

messageHandlerFunction · 0.90
SOCKETFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected