Refactor plotting logic into separate package and update .gitignore
- Move PlotIR function from pkg/convolve to pkg/plot package - Update main.go to use new plot package - Clean up convolve package imports - Add comprehensive .gitignore entries for test files and generated outputs - Allow only recorded.wav and sweep.wav in testfiles directory - Ignore all generated audio files and plot images
This commit is contained in:
15
main.go
15
main.go
@@ -6,6 +6,7 @@ import (
|
||||
"os"
|
||||
|
||||
"valhallir-deconvolver/pkg/convolve"
|
||||
"valhallir-deconvolver/pkg/plot"
|
||||
"valhallir-deconvolver/pkg/wav"
|
||||
|
||||
"github.com/urfave/cli/v2"
|
||||
@@ -78,6 +79,10 @@ func main() {
|
||||
Usage: "Cut filter slope in dB/octave (12, 24, 36, 48, ...; default 12)",
|
||||
Value: 12,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "plot-ir",
|
||||
Usage: "Plot the generated regular IR waveform to ir_plot.png",
|
||||
},
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
// Read sweep WAV file
|
||||
@@ -185,6 +190,16 @@ func main() {
|
||||
return err
|
||||
}
|
||||
|
||||
// Plot IR waveform if requested
|
||||
if c.Bool("plot-ir") {
|
||||
log.Printf("Plotting IR waveform to ir_plot.png...")
|
||||
err := plot.PlotIR(ir, sampleRate, c.String("output"))
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to plot IR: %v", err)
|
||||
}
|
||||
log.Printf("IR plot saved as ir_plot.png")
|
||||
}
|
||||
|
||||
// Generate MPT IR if requested
|
||||
if c.Bool("mpt") {
|
||||
log.Println("Generating minimum phase transform...")
|
||||
|
||||
Reference in New Issue
Block a user