All Projects → frabert → musicplayer-api

frabert / musicplayer-api

Licence: MIT license
Simple wrapper around Web Audio API providing gapless playback

Programming Languages

coffeescript
4710 projects

Projects that are alternatives of or similar to musicplayer-api

PicoAudio.js
A JavaScript library for playing MIDI (Standard MIDI File) on Web.
Stars: ✭ 28 (+75%)
Mutual labels:  music-player, webaudio, webaudio-api
pitch-shifter-chrome-extension
Chrome extension that pitch shifts videos on a page using web audio
Stars: ✭ 21 (+31.25%)
Mutual labels:  webaudio, webaudio-api
websynth
Web Synthesizer From Space
Stars: ✭ 16 (+0%)
Mutual labels:  webaudio, webaudio-api
X-Piano
Now you can make your own piano!
Stars: ✭ 13 (-18.75%)
Mutual labels:  webaudio, webaudio-api
xenpaper
Repo for xenpaper.com
Stars: ✭ 25 (+56.25%)
Mutual labels:  webaudio
musicplayer
musicplayer 音乐播放器框架 简单易懂易扩展 已写了播放器demo和列表播放的demo兼容七牛等第三方Mediaplayer
Stars: ✭ 14 (-12.5%)
Mutual labels:  music-player
webaudio-pitch-tuner
Web Audio API based Pitch Tuner application made with ReactJS.
Stars: ✭ 25 (+56.25%)
Mutual labels:  webaudio-api
crunker
Simple way to merge or concatenate audio files with the Web Audio API.
Stars: ✭ 207 (+1193.75%)
Mutual labels:  webaudio-api
RadioPlayerV3
An Advanced Telegram Bot to Play Radio & Music in Voice Chat. This is Also The Source Code of The Bot Which is Being Used For Playing Radio in @AsmSafone Channel ❤️
Stars: ✭ 232 (+1350%)
Mutual labels:  music-player
moestreamer
macOS menubar music player
Stars: ✭ 17 (+6.25%)
Mutual labels:  music-player
Meaga
一个由Electron和Vue联合打造的本地音乐播放器
Stars: ✭ 36 (+125%)
Mutual labels:  music-player
Oud
🎵 The frontend of Oud, an online music streaming service that is a mimic of Spotify with all its functionalities built using ReactJS, React-Router, Bootstrap.
Stars: ✭ 48 (+200%)
Mutual labels:  music-player
snestracker
Super Nintendo Entertainment System Music Software. Super Famicom Music Software
Stars: ✭ 161 (+906.25%)
Mutual labels:  music-player
Music-Player-UI-React-Native
This is A Music Player UI Page Using React Native With React-Native-Paper.
Stars: ✭ 21 (+31.25%)
Mutual labels:  music-player
TamilVcMusic
A telegram bot for which is help to play songs in vc 🥰 give 🌟 and fork this repo before use 😏
Stars: ✭ 126 (+687.5%)
Mutual labels:  music-player
musicont
React Native & Expo music player application UI
Stars: ✭ 72 (+350%)
Mutual labels:  music-player
cloud-player-desktop
Desktop music player built with electron to play youtube, soundcloud and mixcloud tracks
Stars: ✭ 51 (+218.75%)
Mutual labels:  music-player
Bilibili-MusicPlayer
B站音乐区音频第三方播放器 (Bilibili Third-party online music player for Android) MVVM+Room+LiveData+Retrofit+Exoplayer
Stars: ✭ 19 (+18.75%)
Mutual labels:  music-player
soube
Music player based on electronjs
Stars: ✭ 32 (+100%)
Mutual labels:  music-player
birds
Bird Sound Synthesis based on AM+FM
Stars: ✭ 46 (+187.5%)
Mutual labels:  webaudio

musicplayer-api

musicplayer-api provides a simple way to implement a gapless music player using Web Audio API. It was originally meant to be used in environments such as electron but may eventually work in a browser.

Add it to your package with

npm install musicplayer-api

Example of usage

MusicPlayer = require('musicplayer-api').MusicPlayer

# The constructor automatically creates a new AudioContext
# and GainNode
player = new MusicPlayer()

# The addTrack is responsible of inserting songs in the
# playlist. It also asynchronously loads songs into memory
player.addTrack 'mymusic1.mp3'
player.addTrack 'mywav.wav'

player.play()

API Documentation

When used in node, musicplayer-api exports an object containing the MusicPlayer class. The same object is set to the mp global if used in a browser.

MusicPlayer class

Methods

player.setVolume( value )

Sets the volume to the specified value, where 0 is muted and 1 is default playback intensity.

player.getVolume()

Returns the playback intensity. Normally is 1.

player.toggleMuted()

Toggles between muted and unmuted state.

player.play()

Starts playing or resumes the playback of the current playlist.

player.stop()

Stops playing the current song in the playlist. When play is called again, the song is restarted from the beginning.

player.pause()

Suspends the playback of the current song.

player.playNext()

Skips to the next song in the playlist.

player.addTrack( path )

Adds the specified song to the playlist.

player.insertTrack( index, path )

Adds the specified song in the specified position of the playlist.

player.replaceTrack( index, path )

Replaces the specified track with another one.

player.removeTrack( index )

Removes the specified song from the playlist.

player.removeAllTracks()

Clears the playlist and stops the playback.

player.getSongDuration( index )

Returns the duration in seconds of the specifed song. If no index is provided, 0 is assumed.

player.getSongPosition()

Returns the playing position of the current song. Returns 0 if the playlist is empty or the song hasn't started yet.

player.setSongPosition( position )

Sets the playing position of the current song, expressed in seconds from the beginning. If the playback is stopped before the call, the player is started.

Events

onSongFinished

Called when a song has reached the end.

NOTE: Passes the song's path as an argument.

onPlaylistEnded

Called when the playlist has reached the end.

onPlayerStopeed

Called when the player is stopped programmatically.

onPlayerPaused

Called when the player is paused programmatically.

onTrackAdded

Called when a track is added to the playlist.

NOTE: Passes the track's path as an argument.

onTrackRemoved

Called when a track is removed from the playlist.

onTrackLoaded

Called when a track has finished loading its contents.

NOTE: Passes the track's path as an argument.

onVolumeChanged

Called when the volume is changed programmatically.

NOTE: Passes the volume's value as an argument.

onMuted

Called when the player is muted programmatically.

onUnmuted

Called when the player is unmuted programmatically.

Example

player = new MusicPlayer()
player.onVolumeChanged = (value) =>
  console.log 'Current volume: ' + value.toString()
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].