A JavaScript project for using Web Audio API to do something awesome. [Demo], this demo has loaded a file with above 8.94 MB, so please wait for its loading.
Just clone and build it locally:
git clone https://github.com/aleen42/sound.js.git
Install npm dependencies:
cd sound.js && npm i --no-save
Run the application locally:
npm run sound
The command above will try to load songs of the path: assets/songs/
via command npm run task:load
, after which a file named songList.json
will be created in the assets folder. Then, the command will also create a local server via npm run task:server
. By default, the application can be accessed by http://localhost:9000
.
If you want to load songs locally, you can just paste files with a .mp3
format into the folder: assets/songs/
. After that, remember to run npm run sound
again to build this project.
Notice that: this project is temporarily supported MP3 files, and any file without a extension name .mp3
will not be loaded.
If you don't want to use assets/songs
, you can just override the variable base
array in the file load.js
, to specify where to scan mp3 files recursively.
const base = [
'./assets/songs/',
/** wrong pointer which will cause resources missing error */
'./../music',
/** make a soft link like using `ln -s ./../music ./assets/music` */
'./assets/music/'
];
Notice that: because a resource outside a server root is invisible, so if you are using Linux/Mac OS, remember to make a soft link to a path, which is under the root of this project, or this project will have broken down with a relative path like ./../music/
. If you are using Windows OS, I'm very sorry to say that, you have to copy your directory into this project, so that it can be loaded.
- Oscilloscope visualization based on <Visualizations with Web Audio API >.
- Wave drawing based on the document <Drawing Audio Waveforms>.
- Beat detection based on the document <Beat Detection Using JavaScript and the Web Audio API>.
Have an idea? Found a bug? See how to contribute.
MIT © aleen42