Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ Then, at the bottom of your `<body>` tag, add the script tag for these meters. I
console.log(`Current volume: ${volume.toFixed(2)}`);
},
{
audioMeterStandard: "peak-sample",
// 10 times per second
peakCallbackDelay: 1000 / 10,
// Optional, map dB values to a normalized range
Expand All @@ -49,7 +48,6 @@ Then, at the bottom of your `<body>` tag, add the script tag for these meters. I

The following options options are supported (the third parameter of the constructor)

- audioMeterStandard (string): Can be either `peak-sample`, or `true-peak` (default: `peak-sample`)
- peakHoldDuration (number): the number, in milliseconds, to hold the peak value before resetting (default: `0`, meaning never reset)

## Frequently encountered problems
Expand Down
3 changes: 1 addition & 2 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async function buildWorklet(fileName) {
input: `./src/${fileName}-processor.ts`,
plugins: [
typescriptPlugin({
include: [`./src/${fileName}*.ts`, './src/global.d.ts'],
include: ['./src/true-peak*.ts', './src/peak-sample*.ts', './src/global.d.ts'],
exclude: ['node_modules', 'lib', '**/*.test.ts'],
lib: ['es2016', 'DOM'],
sourceMap: false,
Expand Down Expand Up @@ -161,7 +161,6 @@ async function buildDocs() {
}

async function buildAll() {
await buildWorklet('peak-sample');
await buildWorklet('true-peak');
await buildMain();
await buildDocs();
Expand Down
10 changes: 4 additions & 6 deletions docs/examples/nodom.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ <h2>Javascript code</h2>
const meterInstance = new webAudioPeakMeter.WebAudioPeakMeter(sourceNode, (volume) =&gt; {
console.log(&#039;Volume callback:&#039;, volume);
}, {
audioMeterStandard: &#039;peak-sample&#039;,
peakCallbackDelay: &#039;immediate&#039;,
peakHoldDuration: 5000,
peakCallbackNormalizeVolume: {
Expand All @@ -107,9 +106,9 @@ <h2>Javascript code</h2>

getPeaks.addEventListener(&#039;click&#039;, () =&gt; {
const peaks = meterInstance.getPeaks();
currentFloat.innerText = displayFloatArray(peaks.current);
currentFloat.innerText = displayFloatArray(peaks.current.map(({ volume }) =&gt; volume));
currentDB.innerText = displayFloatArray(peaks.currentDB);
maxesFloat.innerText = displayFloatArray(peaks.maxes);
maxesFloat.innerText = displayFloatArray(peaks.maxes.map(({ volume }) =&gt; volume));
maxesDB.innerText = displayFloatArray(peaks.maxesDB);
});
</code></pre>
Expand Down Expand Up @@ -152,7 +151,6 @@ <h2>Javascript code</h2>
const meterInstance = new webAudioPeakMeter.WebAudioPeakMeter(sourceNode, (volume) => {
console.log('Volume callback:', volume);
}, {
audioMeterStandard: 'peak-sample',
peakCallbackDelay: 'immediate',
peakHoldDuration: 5000,
peakCallbackNormalizeVolume: {
Expand All @@ -171,9 +169,9 @@ <h2>Javascript code</h2>

getPeaks.addEventListener('click', () => {
const peaks = meterInstance.getPeaks();
currentFloat.innerText = displayFloatArray(peaks.current);
currentFloat.innerText = displayFloatArray(peaks.current.map(({ volume }) => volume));
currentDB.innerText = displayFloatArray(peaks.currentDB);
maxesFloat.innerText = displayFloatArray(peaks.maxes);
maxesFloat.innerText = displayFloatArray(peaks.maxes.map(({ volume }) => volume));
maxesDB.innerText = displayFloatArray(peaks.maxesDB);
});

Expand Down
4 changes: 1 addition & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ <h2>Usage (basic)</h2>
console.log(`Current volume: ${volume.toFixed(2)}`);
},
{
audioMeterStandard: &quot;peak-sample&quot;,
// 10 times per second
peakCallbackDelay: 1000 / 10,
peakCallbackDelay: 1000 / 10,
// Optional, map dB values to a normalized range
peakCallbackNormalizeVolume: {
dbRangeMin: -48,
Expand All @@ -45,7 +44,6 @@ <h2>Usage (basic)</h2>
<h2>Options</h2>
<p>The following options options are supported (the third parameter of the constructor)</p>
<ul>
<li>audioMeterStandard (string): Can be either <code>peak-sample</code>, or <code>true-peak</code> (default: <code>peak-sample</code>)</li>
<li>peakHoldDuration (number): the number, in milliseconds, to hold the peak value before resetting (default: <code>0</code>, meaning never reset)</li>
</ul>
<h2>Frequently encountered problems</h2>
Expand Down
2 changes: 1 addition & 1 deletion docs/web-audio-peak-meter-4.1.0.min.js

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

Loading