Signal Scaling¶
Functions for mapping values between ranges and automatic gain control.
- pyminidsp.scale(value, oldmin, oldmax, newmin, newmax)[source]¶
Map a single value from one range to another.
Map a single value from one range to another.
Example:
scale(5.0, 0.0, 10.0, 0.0, 100.0)returns50.0.
- pyminidsp.scale_vec(a, oldmin, oldmax, newmin, newmax)[source]¶
Map every element of a vector from one range to another.
Map every element of a vector from one range to another.
- pyminidsp.fit_within_range(a, newmin, newmax)[source]¶
Fit values within [newmin, newmax].
Fit values within
[newmin, newmax]. If all values already fit, they are copied unchanged. Otherwise the entire vector is rescaled.