Simplify normalizedIntensity calculation
This commit is contained in:
parent
a61f80cde4
commit
99dd16199d
|
|
@ -1,4 +1,4 @@
|
||||||
import { pipe, sum } from "ramda";
|
import { map, pipe, sum } from "ramda";
|
||||||
import { Interval } from "../ast";
|
import { Interval } from "../ast";
|
||||||
import { ConstantIntensity } from "../Intensity";
|
import { ConstantIntensity } from "../Intensity";
|
||||||
import { average } from "./average";
|
import { average } from "./average";
|
||||||
|
|
@ -32,12 +32,6 @@ const fourthRoot = (x: number) => Math.pow(x, 1 / 4);
|
||||||
|
|
||||||
export const normalizedIntensity = (intervals: Interval[]): ConstantIntensity => {
|
export const normalizedIntensity = (intervals: Interval[]): ConstantIntensity => {
|
||||||
return new ConstantIntensity(
|
return new ConstantIntensity(
|
||||||
pipe(
|
pipe(intervalsToIntensityNumbers, rollingAverages, map(fourthPower), average, fourthRoot)(intervals),
|
||||||
intervalsToIntensityNumbers,
|
|
||||||
rollingAverages,
|
|
||||||
(averages) => averages.map(fourthPower),
|
|
||||||
average,
|
|
||||||
fourthRoot,
|
|
||||||
)(intervals),
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue