init commit

This commit is contained in:
2026-01-25 17:13:15 -06:00
commit 1bbfc332d8
27 changed files with 2462 additions and 0 deletions

60
internal/audio/formats.go Normal file
View File

@@ -0,0 +1,60 @@
package audio
import (
"fmt"
"path/filepath"
"strings"
)
// AudioFormat represents a supported audio format
type AudioFormat int
const (
FormatUnknown AudioFormat = iota
FormatMP3
FormatWAV
FormatFLAC
FormatOGG
)
// DetectFormat returns the audio format based on file extension
func DetectFormat(path string) AudioFormat {
ext := strings.ToLower(filepath.Ext(path))
switch ext {
case ".mp3":
return FormatMP3
case ".wav":
return FormatWAV
case ".flac":
return FormatFLAC
case ".ogg":
return FormatOGG
default:
return FormatUnknown
}
}
// String returns the format name
func (f AudioFormat) String() string {
switch f {
case FormatMP3:
return "MP3"
case FormatWAV:
return "WAV"
case FormatFLAC:
return "FLAC"
case FormatOGG:
return "OGG"
default:
return "Unknown"
}
}
// ValidateFormat checks if the file format is supported
func ValidateFormat(path string) error {
format := DetectFormat(path)
if format == FormatUnknown {
return fmt.Errorf("unsupported audio format: %s", filepath.Ext(path))
}
return nil
}