Coder Social home page Coder Social logo

music-player's Introduction

music-player

Plays habbo trax music

Test it out at https://dank074.github.io/music-player/

Usage

npm install @dank074/music-player

Listening for events

You can listen for specific events emmited by the music player. Available events are:

  • "playing"
  • "stopped"
  • "paused"
  • "loading"
  • "time"
  • "songended"

example:

const player = new MusicPlayer( 'https://flash.nitrodev.co/dcr/hof_furni/mp3/sound_machine_sample_%sample%.mp3');

player.on("playing", (currentTime, totalTime) => {
    console.log("now playing at time" + currentTime + "/" + totalTime);
});

player.on("time", (pos) => {
    console.log("current time: " + pos);
})

Running example

  1. build the trax player library by running npm install && npm run build in the main directory. This will create the built files in the dist directory
  2. navigate to /example directory and run npm install && npm run start This will start the example

Trax track format

The track string follows the following format:

There can be 1 to n channels in a track. Channels are split by the : character.

Each channel consists of channel entries which are split by the ; character.

A channel entry describes the sound id and duration of the sound, split by the , character. Duration is in blocks, and each block is 2 seconds long.

For example, the track 1:4,4:2:3,2;2,1: results in the following:

Second: 0 1 2 3 4 5 6 7
channel 1: 4 4 4 4 4 4 4 4
channel 2: 3 3 3 3 2 2

music-player's People

Contributors

dank074 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

davydevries

music-player's Issues

not perfect yet lmao

the habstep breaks this

1:672,12;673,2;0,2;672,12;673,2;0,2;672,12;0,12;672,4;673,2;0,2;672,12;672,3;0,1;672,12;673,2;0,10;672,12;673,2;0,2;672,12;673,2:2:671,44;0,4;671,48;0,22;18,2;0,7;81,3:3:0,8;675,38;0,18;675,22;675,1;0,5;675,4;0,23;20,8;21,1;20,6;21,1:4:0,12;670,4;0,15;20,4;26,1;20,3;21,1;20,4;26,1;0,2;20,1;21,3;20,1;21,1;20,1;21,1;0,1;20,6;21,1;73,12;20,1;73,2;73,1;0,1;670,4;0,18;670,4;0,4;670,4;0,4;670,4;0,4;670,4:5:0,16;676,12;676,3;0,1;676,12;676,3;0,5;676,8;685,4;676,20;676,2;0,2;676,14;0,2;676,12;676,3;0,1;676,4;676,3;0,1;676,4;676,3:6:0,32;670,28;0,4;670,8;0,4;670,4;0,8;670,8;0,1;43,1;0,6;669,40:7:0,31;15,1;0,8;681,1;0,5;680,2;678,2;679,2;678,2;679,2;678,2;679,2;678,2;679,2;684,4;681,1;0,1;683,2;684,4;681,1;0,1;683,2;684,2;682,2;684,6;683,2;684,2;682,2;684,8;0,8;36,2;0,10;36,2;0,2;36,2;0,2;36,2:8:0,14;15,1;17,1;0,1;56,2;0,11;18,2;0,12;686,4;0,27;15,1;0,3;18,2;0,19;677,4;0,12;81,3;0,1;674,16;674,3:meta,1;c,1

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.