chiro-canto/public/scripts/wavesurfer/example/spectrogram/index.html

151 lines
6.3 KiB
HTML
Raw Normal View History

2021-03-31 08:38:30 +02:00
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>wavesurfer.js | Spectrogram plugin</title>
<link href="data:image/gif;" rel="icon" type="image/x-icon" />
<!-- Bootstrap -->
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="../css/style.css" />
<link rel="stylesheet" href="../css/ribbon.css" />
<!-- wavesurfer.js -->
<script src="../../dist/wavesurfer.js"></script>
<!-- spectrogram format renderer -->
<script src="../../dist/plugin/wavesurfer.spectrogram.js"></script>
<!-- App -->
<script src="app.js"></script>
<script src="../trivia.js"></script>
<!-- highlight.js for syntax highlighting in this example -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/default.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</head>
<body itemscope itemtype="http://schema.org/WebApplication">
<div class="container">
<div class="header">
<noindex>
<ul class="nav nav-pills pull-right">
<li><a href="?fill">Fill</a></li>
<li><a href="?scroll">Scroll</a></li>
</ul>
</noindex>
<h1 itemprop="name"><a href="http://wavesurfer-js.org">wavesurfer.js</a><noindex> + Spectrogram</noindex></h1>
</div>
<div id="demo">
<div id="waveform">
<div class="progress progress-striped active" id="progress-bar">
<div class="progress-bar progress-bar-info"></div>
</div>
<!-- Here be waveform -->
</div>
<div id="wave-spectrogram"></div>
<div class="controls">
<button class="btn btn-primary" data-action="play">
<i class="glyphicon glyphicon-play"></i>
Play
/
<i class="glyphicon glyphicon-pause"></i>
Pause
</button>
</div>
</div>
<div class="row marketing">
<div class="col-lg-4">
<h4>wavesurfer.js Spectrogram Plugin</h4>
<p itemprop="about">Adds a simple spectrogram to your <strong>wavesurfer.js</strong> instances.</p>
</div>
<div class="col-lg-8">
<h4>Quick Start</h4>
<noindex><p>
<pre><code>var wavesurfer = WaveSurfer.create({
// your options here
plugins: [
WaveSurfer.spectrogram.create({
wavesurfer: wavesurfer,
container: "#wave-spectrogram",
labels: true
})
]
});
wavesurfer.load('../media/demo.wav');</code></pre>
</p></noindex>
<br />
<h4>Options</h4>
<ul class="markdown-body">
<li><code>wavesurfer</code> - <em>required</em> - a WaveSurfer instance.</li>
<li><code>container</code> - <em>required</em> - the element in which to place the spectrogram, or a CSS selector to find it.</li>
<li><code>fftSamples</code> - number of FFT samples (<code>512</code> by default). Number of spectral lines and height of the spectrogram will be a half of this parameter.</li>
<li><code>frequenciesDataUrl</code> - URL to load spectral data from.</li>
<li><code>labels</code> - Whether or not to display frequency labels.</li>
<li><code>colorMap</code> - Specifies the colormap to be used when rendering the spectrogram.</li>
</ul>
<h4>Generating a colorMap</h4>
The <a href="https://www.npmjs.com/package/colormap">colormap npm</a> can be used to generate a
colormap. In this example, the colormap has been saved to a json file and is retrieved by the
client before initializing the spectrogram.
<noindex><p>
<pre><code>const colormap = require('colormap');
const colors = colormap({
colormap: 'hot',
nshades: 256,
format: 'float'
});
const fs = require('fs');
fs.writeFile('hot-colormap.json', JSON.stringify(colors));
</code></pre>
</p></noindex>
</div>
</div>
<div class="footer row">
<div class="col-sm-12">
<a rel="license" href="https://opensource.org/licenses/BSD-3-Clause"><img alt="BSD-3-Clause License" style="border-width:0" src="https://img.shields.io/badge/License-BSD%203--Clause-blue.svg" /></a>
</div>
<div class="col-sm-12">
<span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/Text" property="dct:title" rel="dct:type">wavesurfer.js</span> by <a href="https://github.com/katspaugh/wavesurfer.js">katspaugh</a> is licensed under a <a rel="license" href="https://opensource.org/licenses/BSD-3-Clause">BSD-3-Clause License</a>.
</div>
</div>
</div>
<div class="github-fork-ribbon-wrapper right">
<div class="github-fork-ribbon">
<a itemprop="isBasedOnUrl" href="https://github.com/katspaugh/wavesurfer.js">Fork me on GitHub</a>
</div>
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-50026819-1', 'wavesurfer.fm');
ga('send', 'pageview');
</script>
</body>
</html>