Skip to content

Commit

Permalink
build(dev): bump prettier from 2.8.8 to 3.0.3 (#175)
Browse files Browse the repository at this point in the history
Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.0.3.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](prettier/prettier@2.8.8...3.0.3)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
dependabot[bot] authored Sep 10, 2023
1 parent cd32fb5 commit dea934c
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 42 deletions.
10 changes: 6 additions & 4 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand All @@ -9,7 +9,9 @@
body {
background: #eee;
color: #111;
font-family: system-ui, -apple-system;
font-family:
system-ui,
-apple-system;
margin: 1rem auto;
max-width: 80ch;
}
Expand Down Expand Up @@ -82,11 +84,11 @@ <h1>Pitchy example</h1>
Math.round(pitch * 10) / 10
} Hz`;
document.getElementById("clarity").textContent = `${Math.round(
clarity * 100
clarity * 100,
)} %`;
window.setTimeout(
() => updatePitch(analyserNode, detector, input, sampleRate),
100
100,
);
}

Expand Down
18 changes: 10 additions & 8 deletions docs/playground.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand All @@ -9,7 +9,9 @@
body {
background: #eee;
color: #111;
font-family: system-ui, -apple-system;
font-family:
system-ui,
-apple-system;
margin: 1rem auto;
max-width: 80ch;
}
Expand Down Expand Up @@ -215,7 +217,7 @@ <h1>Pitchy playground</h1>
lastClarityPercent = Math.round(lastClarityPercent * 1000) / 10;

canvas.innerText = `Last pitch: ${lastPitch.toFixed(
1
1,
)} Hz at ${lastClarityPercent.toFixed(1)}% clarity`;

const filteredPitches = filteredHistory.map(([pitch]) => pitch);
Expand All @@ -238,7 +240,7 @@ <h1>Pitchy playground</h1>
`${lastPitch.toFixed(1)} Hz (${lastClarityPercent.toFixed(1)}%)`,
w / 2,
headingHeight / 2,
w
w,
);

ctx.lineWidth = 1;
Expand Down Expand Up @@ -270,7 +272,7 @@ <h1>Pitchy playground</h1>
`${lastPitch.toFixed(1)} Hz`,
w - labelWidth,
y(lastPitch),
labelWidth
labelWidth,
);
}

Expand Down Expand Up @@ -298,7 +300,7 @@ <h1>Pitchy playground</h1>
sampleRate = analyserNode = inputBuffer = null;
const actualSampleRate = document.getElementById("actual-sample-rate");
const actualInputBufferSize = document.getElementById(
"actual-input-buffer-size"
"actual-input-buffer-size",
);
actualSampleRate.innerText = actualInputBufferSize.innerText = "Unset";

Expand Down Expand Up @@ -346,7 +348,7 @@ <h1>Pitchy playground</h1>
});

const overrideSampleRateInput = document.getElementById(
"override-sample-rate"
"override-sample-rate",
);
overrideSampleRateInput.addEventListener("change", () => {
overrideSampleRate = overrideSampleRateInput.checked;
Expand All @@ -361,7 +363,7 @@ <h1>Pitchy playground</h1>
});

const minClarityPercentInput = document.getElementById(
"min-clarity-percent"
"min-clarity-percent",
);
minClarityPercentInput.addEventListener("change", () => {
minClarityPercent = Number.parseFloat(minClarityPercentInput.value);
Expand Down
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class Autocorrelator {
static forFloat32Array(inputLength) {
return new Autocorrelator(
inputLength,
(length) => new Float32Array(length)
(length) => new Float32Array(length),
);
}

Expand All @@ -53,7 +53,7 @@ export class Autocorrelator {
static forFloat64Array(inputLength) {
return new Autocorrelator(
inputLength,
(length) => new Float64Array(length)
(length) => new Float64Array(length),
);
}

Expand Down Expand Up @@ -113,7 +113,7 @@ export class Autocorrelator {
autocorrelate(input, output = this._bufferSupplier(input.length)) {
if (input.length !== this._inputLength) {
throw new Error(
`Input must have length ${this._inputLength} but had length ${input.length}`
`Input must have length ${this._inputLength} but had length ${input.length}`,
);
}
// Step 0: pad the input array with zeros
Expand Down Expand Up @@ -342,12 +342,12 @@ export class PitchDetector {
// we know of at least one key maximum satisfying this condition (whichever
// key maximum gave us nMax).
const resultIndex = keyMaximumIndices.find(
(i) => this._nsdfBuffer[i] >= this._clarityThreshold * nMax
(i) => this._nsdfBuffer[i] >= this._clarityThreshold * nMax,
);
const [refinedResultIndex, clarity] = refineResultIndex(
// @ts-expect-error resultIndex is guaranteed to be defined
resultIndex,
this._nsdfBuffer
this._nsdfBuffer,
);

// Due to floating point errors, the clarity may occasionally come out to be
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"eslint": "^8.36.0",
"http-server": "^14.1.1",
"npm-run-all": "^4.1.5",
"prettier": "2.8.8",
"prettier": "3.0.3",
"rimraf": "^5.0.1",
"semantic-release": "^21.0.0",
"typescript": "^5.0.2",
Expand Down
12 changes: 6 additions & 6 deletions test/autocorrelator.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ const test = suite("Autocorrelator");
test("constructor throws an error if the input length is too small", () => {
assert.throws(
() => new Autocorrelator(0, (length) => new Float32Array(length)),
"Input length must be at least one"
"Input length must be at least one",
);
assert.throws(
() => new Autocorrelator(-5, (length) => new Float32Array(length)),
"Input length must be at least one"
"Input length must be at least one",
);
});

Expand All @@ -53,7 +53,7 @@ test("autocorrelate throws an error if the input is not of the configured input
const autocorrelator = Autocorrelator.forFloat32Array(5);
assert.throws(
() => autocorrelator.autocorrelate(Float32Array.of(1, 2, 3)),
"Input must have length 5 but had length 3"
"Input must have length 5 but had length 3",
);
});

Expand All @@ -67,7 +67,7 @@ for (const bufferType of inputTypes) {
const assertAutocorrelationIs = (input, expects) => {
const autocorrelator = bufferType.supplier(input.length);
const actual = Array.from(
autocorrelator.autocorrelate(inputType.arrayConverter(input))
autocorrelator.autocorrelate(inputType.arrayConverter(input)),
);

let match = actual.length === expects.length;
Expand All @@ -81,7 +81,7 @@ for (const bufferType of inputTypes) {
}
if (!match) {
assert.unreachable(
`expected autocorrelation of ${input} to be ${expects}, got ${actual}`
`expected autocorrelation of ${input} to be ${expects}, got ${actual}`,
);
}
};
Expand All @@ -92,7 +92,7 @@ for (const bufferType of inputTypes) {
assertAutocorrelationIs([1, 2, 3, 4], [30, 20, 11, 4]);
assertAutocorrelationIs(
[1, -1, 1, -1, 1, -1, 1, -1],
[8, -7, 6, -5, 4, -3, 2, -1]
[8, -7, 6, -5, 4, -3, 2, -1],
);
});
}
Expand Down
18 changes: 9 additions & 9 deletions test/pitch-detector.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ const test = suite("PitchDetector");
test("constructor throws an error if the input length is too small", () => {
assert.throws(
() => new PitchDetector(0, (length) => new Float32Array(length)),
"Input length must be at least one"
"Input length must be at least one",
);
assert.throws(
() => new PitchDetector(-5, (length) => new Float32Array(length)),
"Input length must be at least one"
"Input length must be at least one",
);
});

Expand All @@ -121,7 +121,7 @@ test("findPitch throws an error if the input is not of the configured input leng
const detector = PitchDetector.forFloat32Array(8);
assert.throws(
() => detector.findPitch(Float32Array.of(1, 2, 3), 5),
"Input must have length 8 but had length 3"
"Input must have length 8 but had length 3",
);
});

Expand Down Expand Up @@ -149,7 +149,7 @@ function runTests(
amplitude,
frequency,
sampleRate,
windowSize
windowSize,
) {
/**
* @param {ArrayLike<number>} input
Expand All @@ -162,7 +162,7 @@ function runTests(
};

const input = inputType.arrayConverter(
waveform.generator(windowSize, frequency, amplitude, sampleRate)
waveform.generator(windowSize, frequency, amplitude, sampleRate),
);

const [pitch, clarity] = findPitch(input, sampleRate);
Expand All @@ -171,18 +171,18 @@ function runTests(
const percentError = (100 * Math.abs(pitch - frequency)) / frequency;
assert.ok(
percentError <= 1,
`expected pitch ${pitch} Hz to be within 1% of ${frequency} Hz`
`expected pitch ${pitch} Hz to be within 1% of ${frequency} Hz`,
);

const centsError = Math.abs(1200 * Math.log2(pitch / frequency));
assert.ok(
centsError <= waveform.maxCents,
`expected pitch ${pitch} Hz to be within ${centsError} of ${frequency} Hz`
`expected pitch ${pitch} Hz to be within ${centsError} of ${frequency} Hz`,
);

assert.ok(
clarity >= waveform.minClarity,
`expected clarity ${clarity} to be at least ${waveform.minClarity}`
`expected clarity ${clarity} to be at least ${waveform.minClarity}`,
);
assert.ok(clarity <= 1.0, `expected clarity ${clarity} to be at most 1.0`);
});
Expand Down Expand Up @@ -219,7 +219,7 @@ for (const waveform of waveforms) {
amplitude,
frequency,
sampleRate,
inputSize
inputSize,
);
}
}
Expand Down

0 comments on commit dea934c

Please sign in to comment.