make autoscale default
This commit is contained in:
parent
7522b2eca6
commit
5f1746ee05
1 changed files with 8 additions and 4 deletions
12
src/main.rs
12
src/main.rs
|
|
@ -33,6 +33,7 @@ impl Params {
|
|||
};
|
||||
}
|
||||
"multiply" => {
|
||||
params.autoscale = false;
|
||||
params.multiply = iter
|
||||
.next()
|
||||
.expect("multiply parameter expects a value.")
|
||||
|
|
@ -59,7 +60,7 @@ impl Default for Params {
|
|||
channel: 2,
|
||||
multiply: 5.0,
|
||||
integrate: false,
|
||||
autoscale: false,
|
||||
autoscale: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -81,10 +82,10 @@ invocation: `infraconv <input csv file> <input samples/s> <output wav file> [<ou
|
|||
output params are any as follows:
|
||||
|
||||
- `speed <number>` speed multiplier: outputHz will be n * inputHz.
|
||||
- `multiply <number>` data multiplier: amplitude is multiplied by n. 5 is default.
|
||||
- `multiply <number>` data multiplier: amplitude is multiplied by n. autoscale is default.
|
||||
- `channel <x|y|z>` specifies which accelerometer channel to covert. z is default.
|
||||
- `integrate` sets integration mode, where the input is integrated first to enhance low frequencies that may not be picked up correctly.
|
||||
- `autoscale` automatically sets the multiplier based on the input.
|
||||
- `autoscale` automatically sets the multiplier based on the input. (this is the default. parameter is still accepted for compatibility)
|
||||
|
||||
when using integrate mode, multiply may need to be set to a lower number.\
|
||||
"
|
||||
|
|
@ -114,7 +115,10 @@ when using integrate mode, multiply may need to be set to a lower number.\
|
|||
}
|
||||
|
||||
if params.autoscale {
|
||||
params.multiply = 1.0 / get_scale(&samples);
|
||||
let scale = get_scale(&samples);
|
||||
if scale > 0.0 {
|
||||
params.multiply = 1.0 / scale;
|
||||
}
|
||||
}
|
||||
println!("infraconv: Multiply = {}", params.multiply);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue