Skip to content

Commit

Permalink
Merge pull request katspaugh#424 from thijstriemstra/master
Browse files Browse the repository at this point in the history
  • Loading branch information
katspaugh committed Apr 1, 2015
2 parents 33704ac + 0979564 commit 560798c
Show file tree
Hide file tree
Showing 15 changed files with 52 additions and 21 deletions.
35 changes: 32 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Interactive navigable audio visualization using
[Web Audio](https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html)
and Canvas.

![Screenshot](/example/screenshot.png?raw=true "Screenshot")
![Screenshot](example/screenshot.png?raw=true "Screenshot")

### Browser support
wavesurfer.js works only in modern browsers supporting Web Audio
Expand All @@ -15,8 +15,6 @@ graphics). You can also try
[wavesurfer.swf](https://github.com/laurentvd/wavesurfer.swf) which is
a Flash-based fallback with graphics.



### API in examples

Create an instance:
Expand Down Expand Up @@ -51,6 +49,10 @@ wavesurfer.load('example/media/demo.wav');

See the example code [here](/example/main.js).

For a list of other projects using wavesurfer.js, check out
[the wiki](https://github.com/katspaugh/wavesurfer.js/wiki/Projects)
where you can also add your own project.

### WaveSurfer Options

| option | type | default | description |
Expand Down Expand Up @@ -194,6 +196,33 @@ General events:
* `over` - When mouse moves over the region. Callback will receive a `MouseEvent`.
* `leave` - When mouse leaves the region. Callback will receive a `MouseEvent`.

# Development

[![npm version](https://img.shields.io/npm/v/wavesurfer.js.svg?style=flat)](https://www.npmjs.com/package/wavesurfer.js)
[![npm](https://img.shields.io/npm/dm/wavesurfer.js.svg)]()
[![Build Status](https://travis-ci.org/katspaugh/wavesurfer.js.svg?branch=master)](https://travis-ci.org/katspaugh/wavesurfer.js)

Install `grunt-cli` using npm:

```
npm install -g grunt-cli
```

Install development dependencies:

```
npm install
```

Build a minified version of the library and plugins. This command also checks
for code-style mistakes:

```
grunt
```

Generated files are placed in the `dist` directory.

# Credits

Initial idea by [Alex Khokhulin](https://github.com/xoxulin). Many
Expand Down
2 changes: 1 addition & 1 deletion example/annotation/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link href="data:image/gif;" rel="icon" type="image/x-icon" />

<!-- Bootstrap -->
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">

<link rel="stylesheet" href="../css/style.css" />
<link rel="stylesheet" href="../css/ribbon.css" />
Expand Down
2 changes: 1 addition & 1 deletion example/audio-element/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link href="data:image/gif;" rel="icon" type="image/x-icon" />

<!-- Bootstrap -->
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">

<link rel="stylesheet" href="../css/style.css" />
<link rel="stylesheet" href="../css/ribbon.css" />
Expand Down
2 changes: 1 addition & 1 deletion example/elan/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link href="data:image/gif;" rel="icon" type="image/x-icon" />

<!-- Bootstrap -->
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">

<link rel="stylesheet" href="../css/style.css" />
<link rel="stylesheet" href="../css/ribbon.css" />
Expand Down
2 changes: 1 addition & 1 deletion example/equalizer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link href="data:image/gif;" rel="icon" type="image/x-icon" />

<!-- Bootstrap -->
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">

<link rel="stylesheet" href="../css/style.css" />
<link rel="stylesheet" href="../css/ribbon.css" />
Expand Down
2 changes: 1 addition & 1 deletion example/microphone/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link href="data:image/gif;" rel="icon" type="image/x-icon" />

<!-- Bootstrap -->
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">

<link rel="stylesheet" href="../css/style.css" />
<link rel="stylesheet" href="../css/ribbon.css" />
Expand Down
2 changes: 1 addition & 1 deletion example/panner/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link href="data:image/gif;" rel="icon" type="image/x-icon" />

<!-- Bootstrap -->
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">

<link rel="stylesheet" href="../css/style.css" />
<link rel="stylesheet" href="../css/ribbon.css" />
Expand Down
2 changes: 1 addition & 1 deletion example/playlist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link href="data:image/gif;" rel="icon" type="image/x-icon" />

<!-- Bootstrap -->
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">

<link rel="stylesheet" href="../css/style.css" />
<link rel="stylesheet" href="../css/ribbon.css" />
Expand Down
2 changes: 1 addition & 1 deletion example/spectrogram/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ document.addEventListener('DOMContentLoaded', function () {
}());

wavesurfer.on('ready', function () {
// Init Timeline plugin
// Init spectrogram plugin
var spectrogram = Object.create(WaveSurfer.Spectrogram);

spectrogram.init({
Expand Down
4 changes: 2 additions & 2 deletions example/spectrogram/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link href="data:image/gif;" rel="icon" type="image/x-icon" />

<!-- Bootstrap -->
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">

<link rel="stylesheet" href="../css/style.css" />
<link rel="stylesheet" href="../css/ribbon.css" />
Expand Down Expand Up @@ -97,7 +97,7 @@ <h4>Quick Start</h4>
});
});

wavesurfer.load('example/media/demo.mp3');</code></pre>
wavesurfer.load('example/media/demo.wav');</code></pre>
</p></noindex>

<br />
Expand Down
4 changes: 2 additions & 2 deletions example/split-channels/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>wavesurfer.js | Media Element Example</title>
<title>wavesurfer.js | Split Channel Example</title>

<link href="data:image/gif;" rel="icon" type="image/x-icon" />

<!-- Bootstrap -->
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">

<link rel="stylesheet" href="../css/style.css" />
<link rel="stylesheet" href="../css/ribbon.css" />
Expand Down
2 changes: 1 addition & 1 deletion example/timeline/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link href="data:image/gif;" rel="icon" type="image/x-icon" />

<!-- Bootstrap -->
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">

<link rel="stylesheet" href="../css/style.css" />
<link rel="stylesheet" href="../css/ribbon.css" />
Expand Down
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link href="data:image/gif;" rel="icon" type="image/x-icon" />

<!-- Bootstrap -->
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">

<link rel="stylesheet" href="example/css/style.css" />
<link rel="stylesheet" href="example/css/ribbon.css" />
Expand Down Expand Up @@ -88,7 +88,7 @@ <h1 itemprop="name">wavesurfer.js</h1>
<div class="col-lg-6">
<h4>Web Audio Waveform Visualizer</h4>

<p itemprop="about">Customizable waveform audio visualization built on top of Web Audio API and HTML5 Canvas. With <strong>wavesurfer.js</strong> you can create a cute <a href="https://www.toytalk.com/editors-picks/">HTML5 audio player</a> or <a href="http://moduscreate.com/touch-dj-a-sencha-touch-dj-app/">a sophisticated DJ application</a>.</p>
<p itemprop="about">Customizable waveform audio visualization built on top of Web Audio API and HTML5 Canvas. With <strong>wavesurfer.js</strong> you can create anything from an HTML5 audio player to a sophisticated DJ application. For a list of other projects using wavesurfer.js, check out <a href="https://github.com/katspaugh/wavesurfer.js/wiki/Projects">the wiki</a> where you can also add your own project.</p>

<h4>Compatibility</h4>

Expand All @@ -97,7 +97,7 @@ <h4>Compatibility</h4>
<h4>Download</h4>

<p>
<a class="btn btn-large btn-success" href="dist/wavesurfer.min.js" itemprop="downloadUrl">Download <strong>wavesurfer.min.js</strong> (18 KB)</a>
<a class="btn btn-large btn-success" href="dist/wavesurfer.min.js" itemprop="downloadUrl">Download <strong>wavesurfer.min.js</strong> (20 KB)</a>
</p>
</div>

Expand All @@ -122,7 +122,7 @@ <h4>Quick Start</h4>

<h4>Documentation</h4>

<p>The full list of options and methods can be found in <a href="https://github.com/katspaugh/wavesurfer.js/blob/master/README.md">README</a>.</p>
<p>The full list of options and methods can be found in the <a href="https://github.com/katspaugh/wavesurfer.js/blob/master/README.md">README</a> file.</p>
</div>
</div>

Expand Down
3 changes: 3 additions & 0 deletions src/drawer.canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ WaveSurfer.util.extend(WaveSurfer.Drawer.Canvas, {
bottom: 0,
overflow: 'hidden',
width: '0',
display: 'none',
boxSizing: 'border-box',
borderRightStyle: 'solid',
borderRightWidth: this.params.cursorWidth + 'px',
Expand All @@ -44,6 +45,8 @@ WaveSurfer.util.extend(WaveSurfer.Drawer.Canvas, {
this.waveCc.canvas.height = this.height;
this.style(this.waveCc.canvas, { width: width + 'px'});

this.style(this.progressWave, { display: 'block'});

if (this.progressCc) {
this.progressCc.canvas.width = this.width;
this.progressCc.canvas.height = this.height;
Expand Down
1 change: 0 additions & 1 deletion src/drawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ WaveSurfer.Drawer = {

// if the cursor is currently visible...
if (!immediate && -half <= offset && offset < half) {
// we'll limit the "re-center" rate.
// we'll limit the "re-center" rate.
var rate = 5;
offset = Math.max(-rate, Math.min(rate, offset));
Expand Down

0 comments on commit 560798c

Please sign in to comment.