Add cabpack generation with default mode and file organization
This commit is contained in:
@@ -62,8 +62,9 @@ func PlotIR(ir []float64, sampleRate int, irFileName string) error {
|
||||
}
|
||||
}
|
||||
fmt.Printf("[PlotIR] minDb in plotted range: %.2f dB at %.2f Hz\n", minDb, minDbFreq)
|
||||
irBaseName := filepath.Base(irFileName)
|
||||
p := plot.New()
|
||||
p.Title.Text = "IR Frequency Response (dB, 2048-sample window)"
|
||||
p.Title.Text = fmt.Sprintf("IR Frequency Response: %s", irBaseName)
|
||||
p.X.Label.Text = "Frequency (Hz)"
|
||||
p.Y.Label.Text = "Magnitude (dB)"
|
||||
p.X.Scale = plot.LogScale{}
|
||||
@@ -111,7 +112,7 @@ func PlotIR(ir []float64, sampleRate int, irFileName string) error {
|
||||
|
||||
// --- Time-aligned waveform plot ---
|
||||
p2 := plot.New()
|
||||
p2.Title.Text = "IR Waveform (Time Aligned)"
|
||||
p2.Title.Text = fmt.Sprintf("IR Waveform: %s", irBaseName)
|
||||
p2.X.Label.Text = "Time (ms)"
|
||||
p2.Y.Label.Text = "Amplitude"
|
||||
// Prepare waveform data (only first 10ms)
|
||||
|
||||
@@ -36,6 +36,15 @@ func toMono(data []float64, channels int) []float64 {
|
||||
|
||||
// ReadWAVFile reads a WAV file and returns its PCM data as float64 (resampled to 96kHz mono)
|
||||
func ReadWAVFile(filePath string) (*WAVData, error) {
|
||||
// Check if path is a directory
|
||||
info, err := os.Stat(filePath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to access file %s: %w", filePath, err)
|
||||
}
|
||||
if info.IsDir() {
|
||||
return nil, fmt.Errorf("path %s is a directory, not a WAV file", filePath)
|
||||
}
|
||||
|
||||
file, err := os.Open(filePath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to open file %s: %w", filePath, err)
|
||||
|
||||
Reference in New Issue
Block a user