wavesurfer.js

Navigable waveform built on Web Audio and Canvas

README

wavesurfer.js


npm version
npm

Interactive navigable audio visualization using Web Audio and Canvas.

Screenshot


Questions

Have a question about integrating wavesurfer.js on your website? Feel free to ask in our forum: https://github.com/wavesurfer-js/wavesurfer.js/discussions/categories/q-a

Quick start

Install the package:

  1. ```
  2. npm install wavesurfer.js --save

  3. # or

  4. yarn add wavesurfer.js
  5. ```

And import it like so:
  1. ```
  2. import WaveSurfer from 'wavesurfer.js'
  3. ```

If you're not using a package manager, simply insert the script from a CDN:
  1. ```
  2. <script src="https://unpkg.com/wavesurfer.js"></script>
  3. ```

Create a container in your HTML:
  1. ```html
  2. <div id="waveform"></div>
  3. ```

Create an instance of wavesufer.js, passing the container selector and a few options:

  1. ```javascript
  2. var wavesurfer = WaveSurfer.create({
  3.     container: '#waveform',
  4.     waveColor: 'violet',
  5.     progressColor: 'purple'
  6. });
  7. ```

Subscribe to some events:

  1. ```javascript
  2. wavesurfer.on('ready', function () {
  3.     wavesurfer.play();
  4. });
  5. ```

Load an audio file from a URL:

  1. ```javascript
  2. wavesurfer.load('example/media/demo.wav');
  3. ```

Documentation


See the documentation on all available methods, options and events on the homepage.

Projects using wavesurfer.js


For the list of projects using wavesurfer.js, check out

Contributing


Have an idea and want to contribute to wavesurfer.js?
Please first start a discussion in the Ideas section of our forum to coordinate with the maintainers.

Development


Build Status
Coverage Status
Size

Install development dependencies:

  1. ```
  2. npm install
  3. ```
Development tasks automatically rebuild certain parts of the library when files are changed (start – wavesurfer, start:plugins – plugins). Start a dev task and go to localhost:8080/example/ to test the current build.

Start development server for core library:

  1. ```
  2. npm run start
  3. ```

Start development server for plugins:

  1. ```
  2. npm run start:plugins
  3. ```

Build all the files. (generated files are placed in the dist directory.)

  1. ```
  2. npm run build
  3. ```

Running tests only:

  1. ```
  2. npm run test
  3. ```

Build documentation with esdoc (generated files are placed in the doc directory.)
  1. ```
  2. npm run doc
  3. ```

If you want to use the VS Code - Debugger for Chrome, there is already a launch.json with a properly configuredsourceMapPathOverrides for you.

Editing documentation

The homepage and documentation files are maintained in the [gh-pages branch](https://github.com/wavesurfer-js/wavesurfer.js/tree/gh-pages). Contributions to the documentation are especially welcome.

Updating the NPM package

When preparing a new release, update the version in the package.json and have it merged to master. The new version of the package will be published to NPM automatically via GitHub Actions.

Credits


The main maintainer: [Thijs Triemstra](https://github.com/thijstriemstra)


License


License

This work is licensed under a