modularity

This commit is contained in:
2025-09-30 14:20:50 +02:00
parent c16b3738ea
commit 304627b248
26 changed files with 892 additions and 198 deletions

View File

@ -0,0 +1,25 @@
import { encodeWAV } from '../../lib/bytebeat/wavEncoder'
import type { BitDepth } from '../../lib/bytebeat/types'
export type { BitDepth }
export interface ExportOptions {
sampleRate: number
bitDepth?: BitDepth
}
export function exportToWav(
samples: Float32Array,
options: ExportOptions
): Blob {
const bitDepth = options.bitDepth || 8
return encodeWAV(samples, options.sampleRate, bitDepth)
}
export function createDownloadUrl(blob: Blob): string {
return URL.createObjectURL(blob)
}
export function revokeDownloadUrl(url: string): void {
URL.revokeObjectURL(url)
}