Giter Club home page Giter Club logo

swave's Introduction

Swave Quality Gate Status

Swave is a Javascript audio player library with waveform visualization.

Live Demo: https://bogdan-cornianu.github.io/swave/examples/

Installation

npm install swave

Usage

let swave = new Swave({audioUrl: 'url...'});
swave.play();

Swave uses Web Audio APIs for visualizations, HTMLAudioElement for audio streaming and a Canvas element to draw the sound bars.
The first argument of the constructor is the html element where the canvas should be drawn.
The second argument is a configuration object:

  • audioUrl: required, the url for the audio to be played
  • autoPlay: false by default
  • crossOrigin: "anonymous" by default
  • showControls: false by default. If enabled, will display the audio element's playback controls

Swave exposes several methods which you can use to build an audio player:

  • play(): starts playing the audio
  • stop(): stops playing the audio
  • pause(): pauses the current playing audio
  • setVolume(number): values between 0.1 and 1
  • enableVisualization(HTMLElement): shows the sound bars
  • disableVisualization(): hides the sound bars
  • getDuration(): the length of the audio, in seconds
  • setCurrentTime(number): set the current time of the audio
  • getCurrentTime(): get the time of the audio as it plays
  • changeAudio(string): the new url of the audio

Contributing

If you find any bugs or have ideas of how Swave can be improved, please open an issue at https://github.com/bogdan-cornianu/swave/issues
If you would like to contribute code please have a look at our open issues, pick something you like and have fun :)

  • clone the repo
  • npm install to install the dev dependencies
  • npm run start will start the webpack dev server
  • npm run build will build the production bundle
  • fix a bug, implement a feature
  • open a pull request

Credits

Cosmin Seviciu https://github.com/ZetCoby

swave's People

Contributors

bogdan-cornianu avatar cosmin-seviciu avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

swave's Issues

Fix import issue

Right now after swave is imported, to initialize it we need to do new Swave.Swave(...)
We need to fix it so we only need to do new Swave(...)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.