Rename filter flags: --highpass to --lowcut, --lowpass to --highcut; clarify docs and usage
This commit is contained in:
24
main.go
24
main.go
@@ -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...")
|
||||
|
||||
Reference in New Issue
Block a user