Rename filter flags: --highpass to --lowcut, --lowpass to --highcut; clarify docs and usage

This commit is contained in:
Bastian Bührig
2025-07-11 10:21:49 +02:00
parent a113550aee
commit 0cb60d884c
5 changed files with 124 additions and 1 deletions

24
main.go
View File

@@ -65,6 +65,14 @@ func main() {
Usage: "Fade-out duration in milliseconds to apply at the end of the IR (default 5)",
Value: 5.0,
},
&cli.Float64Flag{
Name: "highcut",
Usage: "High-cut filter (low-pass) cutoff frequency in Hz (applied to recorded sweep, optional)",
},
&cli.Float64Flag{
Name: "lowcut",
Usage: "Low-cut filter (high-pass) cutoff frequency in Hz (applied to recorded sweep, optional)",
},
},
Action: func(c *cli.Context) error {
// Read sweep WAV file
@@ -82,8 +90,22 @@ func main() {
log.Printf("Sweep: %d samples, %d channels", len(sweepData.PCMData), sweepData.Channels)
log.Printf("Recorded: %d samples, %d channels", len(recordedData.PCMData), recordedData.Channels)
// Optionally filter the recorded sweep
recordedFiltered := recordedData.PCMData
recSampleRate := recordedData.SampleRate
highcutHz := c.Float64("highcut")
lowcutHz := c.Float64("lowcut")
if lowcutHz > 0 {
log.Printf("Applying low-cut (high-pass) filter to recorded sweep: %.2f Hz", lowcutHz)
recordedFiltered = convolve.ApplyHighpassButterworth(recordedFiltered, recSampleRate, lowcutHz)
}
if highcutHz > 0 {
log.Printf("Applying high-cut (low-pass) filter to recorded sweep: %.2f Hz", highcutHz)
recordedFiltered = convolve.ApplyLowpassButterworth(recordedFiltered, recSampleRate, highcutHz)
}
log.Println("Performing deconvolution...")
ir := convolve.Deconvolve(sweepData.PCMData, recordedData.PCMData)
ir := convolve.Deconvolve(sweepData.PCMData, recordedFiltered)
log.Printf("Deconvolution result: %d samples", len(ir))
log.Println("Trimming silence...")