drop python backend layer

This commit is contained in:
2026-06-09 00:42:41 -07:00
parent 2bfa1e9269
commit 21a56e187e
17 changed files with 373 additions and 397 deletions
+12 -15
View File
@@ -1,3 +1,5 @@
import { renderKeyboardTrack } from './audio/export';
import type { SampleCache } from './audio/sampleCache';
import type { LegacySwitchType, Marker, Project, SwitchType } from './types';
import { app, setActiveSwitch, setMarkers, setSelectedIds } from './store.svelte';
@@ -50,24 +52,19 @@ export function loadProject(data: Project & { version?: number; switch?: string
setSelectedIds(new Set());
}
export async function exportAudio(duration: number) {
/**
* Export keyboard SFX only as a WAV file (no video audio).
* Rendered client-side at 1× via OfflineAudioContext.
*/
export async function exportAudio(duration: number, cache?: SampleCache) {
const project = buildProject();
const response = await fetch('/api/export/audio', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
duration,
switch: project.switch,
markers: project.markers,
}),
const blob = await renderKeyboardTrack({
duration,
switchType: project.switch,
markers: project.markers,
cache,
});
if (!response.ok) {
const detail = await response.text();
throw new Error(detail || 'Audio export failed');
}
const blob = await response.blob();
const url = URL.createObjectURL(blob);
const anchor = document.createElement('a');
anchor.href = url;