This commit is contained in:
afkarxyz
2025-12-19 16:50:43 +07:00
parent 7d0fde3acc
commit 436feb7f7c
10 changed files with 220 additions and 119 deletions
+17 -1
View File
@@ -8,7 +8,8 @@ import {
TrendingUp,
FileAudio,
Clock,
Gauge
Gauge,
HardDrive
} from "lucide-react";
import type { AnalysisResult } from "@/types/api";
@@ -78,6 +79,14 @@ export function AudioAnalysis({
return num.toFixed(2);
};
const formatFileSize = (bytes: number): string => {
if (bytes === 0) return "0 B";
const k = 1024;
const sizes = ["B", "KB", "MB", "GB"];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + " " + sizes[i];
};
// Calculate Nyquist frequency (half of sample rate)
const nyquistFreq = result.sample_rate / 2;
@@ -117,6 +126,13 @@ export function AudioAnalysis({
<span className="text-muted-foreground">Nyquist:</span>
<span className="font-semibold">{(nyquistFreq / 1000).toFixed(1)} kHz</span>
</div>
{result.file_size > 0 && (
<div className="flex items-center gap-1">
<HardDrive className="h-3 w-3 text-muted-foreground" />
<span className="text-muted-foreground">Size:</span>
<span className="font-semibold">{formatFileSize(result.file_size)}</span>
</div>
)}
</div>
{/* Dynamic Range - Single line */}