fix: remove fake FLAC export format
Removed the non-standard FLAC export option which was causing import issues: **Problem:** - "FLAC" export was actually a custom compressed WAV format - Used fflate (DEFLATE compression) instead of real FLAC encoding - Files couldn't be imported back or opened in other software - No browser-compatible FLAC encoder library exists **Changes:** - Removed FLAC from export format options (WAV and MP3 only) - Removed FLAC quality slider from ExportDialog - Removed audioBufferToFlac function reference - Updated ExportSettings interface to only include 'wav' | 'mp3' - Simplified bit depth selector (WAV only instead of WAV/FLAC) - Updated format descriptions to clarify lossy vs lossless **Export formats now:** - ✅ WAV - Lossless, Uncompressed (16/24/32-bit) - ✅ MP3 - Lossy, Compressed (128/192/256/320 kbps) Users can now successfully export and re-import their audio! 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -6,11 +6,10 @@ import { Button } from '@/components/ui/Button';
|
|||||||
import { cn } from '@/lib/utils/cn';
|
import { cn } from '@/lib/utils/cn';
|
||||||
|
|
||||||
export interface ExportSettings {
|
export interface ExportSettings {
|
||||||
format: 'wav' | 'mp3' | 'flac';
|
format: 'wav' | 'mp3';
|
||||||
scope: 'project' | 'selection' | 'tracks'; // Export scope
|
scope: 'project' | 'selection' | 'tracks'; // Export scope
|
||||||
bitDepth: 16 | 24 | 32;
|
bitDepth: 16 | 24 | 32;
|
||||||
bitrate: number; // For MP3: 128, 192, 256, 320 kbps
|
bitrate: number; // For MP3: 128, 192, 256, 320 kbps
|
||||||
quality: number; // For FLAC: 0-9
|
|
||||||
normalize: boolean;
|
normalize: boolean;
|
||||||
filename: string;
|
filename: string;
|
||||||
}
|
}
|
||||||
@@ -29,7 +28,6 @@ export function ExportDialog({ open, onClose, onExport, isExporting, hasSelectio
|
|||||||
scope: 'project',
|
scope: 'project',
|
||||||
bitDepth: 16,
|
bitDepth: 16,
|
||||||
bitrate: 192, // Default MP3 bitrate
|
bitrate: 192, // Default MP3 bitrate
|
||||||
quality: 6, // Default FLAC quality
|
|
||||||
normalize: true,
|
normalize: true,
|
||||||
filename: 'mix',
|
filename: 'mix',
|
||||||
});
|
});
|
||||||
@@ -81,13 +79,12 @@ export function ExportDialog({ open, onClose, onExport, isExporting, hasSelectio
|
|||||||
</label>
|
</label>
|
||||||
<select
|
<select
|
||||||
value={settings.format}
|
value={settings.format}
|
||||||
onChange={(e) => setSettings({ ...settings, format: e.target.value as 'wav' | 'mp3' | 'flac' })}
|
onChange={(e) => setSettings({ ...settings, format: e.target.value as 'wav' | 'mp3' })}
|
||||||
className="w-full px-3 py-2 bg-background border border-border rounded text-foreground focus:outline-none focus:ring-2 focus:ring-primary"
|
className="w-full px-3 py-2 bg-background border border-border rounded text-foreground focus:outline-none focus:ring-2 focus:ring-primary"
|
||||||
disabled={isExporting}
|
disabled={isExporting}
|
||||||
>
|
>
|
||||||
<option value="wav">WAV (Uncompressed)</option>
|
<option value="wav">WAV (Lossless, Uncompressed)</option>
|
||||||
<option value="mp3">MP3 (Lossy)</option>
|
<option value="mp3">MP3 (Lossy, Compressed)</option>
|
||||||
<option value="flac">FLAC (Lossless)</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -115,8 +112,8 @@ export function ExportDialog({ open, onClose, onExport, isExporting, hasSelectio
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Bit Depth (WAV and FLAC only) */}
|
{/* Bit Depth (WAV only) */}
|
||||||
{(settings.format === 'wav' || settings.format === 'flac') && (
|
{settings.format === 'wav' && (
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-medium text-foreground mb-2">
|
<label className="block text-sm font-medium text-foreground mb-2">
|
||||||
Bit Depth
|
Bit Depth
|
||||||
@@ -167,30 +164,6 @@ export function ExportDialog({ open, onClose, onExport, isExporting, hasSelectio
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* FLAC Quality */}
|
|
||||||
{settings.format === 'flac' && (
|
|
||||||
<div>
|
|
||||||
<label className="block text-sm font-medium text-foreground mb-2">
|
|
||||||
Compression Quality
|
|
||||||
</label>
|
|
||||||
<div className="flex items-center gap-3">
|
|
||||||
<span className="text-xs text-muted-foreground">Fast</span>
|
|
||||||
<input
|
|
||||||
type="range"
|
|
||||||
min="0"
|
|
||||||
max="9"
|
|
||||||
value={settings.quality}
|
|
||||||
onChange={(e) => setSettings({ ...settings, quality: parseInt(e.target.value) })}
|
|
||||||
className="flex-1"
|
|
||||||
disabled={isExporting}
|
|
||||||
/>
|
|
||||||
<span className="text-xs text-muted-foreground">Small</span>
|
|
||||||
</div>
|
|
||||||
<p className="text-xs text-muted-foreground mt-1">
|
|
||||||
Level {settings.quality} (Higher = smaller file, slower encoding)
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* Normalize */}
|
{/* Normalize */}
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import {
|
|||||||
} from '@/lib/history/commands/multi-track-edit-command';
|
} from '@/lib/history/commands/multi-track-edit-command';
|
||||||
import { extractBufferSegment } from '@/lib/audio/buffer-utils';
|
import { extractBufferSegment } from '@/lib/audio/buffer-utils';
|
||||||
import { mixTracks, getMaxTrackDuration } from '@/lib/audio/track-utils';
|
import { mixTracks, getMaxTrackDuration } from '@/lib/audio/track-utils';
|
||||||
import { audioBufferToWav, audioBufferToMp3, audioBufferToFlac, downloadArrayBuffer } from '@/lib/audio/export';
|
import { audioBufferToWav, audioBufferToMp3, downloadArrayBuffer } from '@/lib/audio/export';
|
||||||
|
|
||||||
export function AudioEditor() {
|
export function AudioEditor() {
|
||||||
const [importDialogOpen, setImportDialogOpen] = React.useState(false);
|
const [importDialogOpen, setImportDialogOpen] = React.useState(false);
|
||||||
@@ -746,16 +746,8 @@ export function AudioEditor() {
|
|||||||
});
|
});
|
||||||
mimeType = 'audio/mpeg';
|
mimeType = 'audio/mpeg';
|
||||||
fileExtension = 'mp3';
|
fileExtension = 'mp3';
|
||||||
} else if (settings.format === 'flac') {
|
|
||||||
exportedBuffer = await audioBufferToFlac(buffer, {
|
|
||||||
format: 'flac',
|
|
||||||
bitDepth: settings.bitDepth,
|
|
||||||
quality: settings.quality,
|
|
||||||
normalize: settings.normalize,
|
|
||||||
});
|
|
||||||
mimeType = 'application/octet-stream';
|
|
||||||
fileExtension = 'flac';
|
|
||||||
} else {
|
} else {
|
||||||
|
// WAV export
|
||||||
exportedBuffer = audioBufferToWav(buffer, {
|
exportedBuffer = audioBufferToWav(buffer, {
|
||||||
format: 'wav',
|
format: 'wav',
|
||||||
bitDepth: settings.bitDepth,
|
bitDepth: settings.bitDepth,
|
||||||
|
|||||||
Reference in New Issue
Block a user