Skip to content

Christilut/webKeyFinder

 
 

Repository files navigation

Introduction

webKeyFinder is a browser application for musical key detection. webKeyFinder works with an audio stream or audio files.

Audio Stream / Live Detection

Using an AudioWorkletProcessor, incoming audio stream is recorded in pulse-code modulation format. Once roughly one second of audio is recorded, the chuck is sent to a web worker running the key finder WebAssembly module. Message passing and analysis repeats until key detection is ended.

Audio File / File Analysis

To prepare for analysis, audio files are first decoded into pulse-code modulation format. Once decoding is done, one second chunks are sent to the web worker running the key finder WebAssembly module. Message passing and analysis repeats until whole audio file is exhausted.

In contrast to live analysis, key detection workload for audio files can be processed in parallel. Once decoding is completed on the main thread, each audio file in the queue works with a dedicated web worker.

Installation

Prerequisites

emscripten

source ./<emsdk-directory>/emsdk.env.sh

curl

sudo apt-get update
sudo apt-get install curl

yarn

Clone the repository

git clone [email protected]:dogayuksel/webKeyFinder.git
cd webKeyFinder

Install dependencies and build the project

Following command will fetch FFTW3 and libKeyFinder and build them using emscripten. Afterwards, will build the project itself using the dependencies.

make

(ALTERNATIVE) Run using the pre-compiled wasm module

You can run the project only by bundling the web modules and using the existing pre-compiled wasm modules.

make build-web

Run the server

make serve

Clean Dependencies

If you want to install dependencies from scratch again, you can clean them with the following command.

make clean_deps

Development

  • Just kill the server and run `make` again. This should rebuild the changed parts. Then you can run `make serve` to see your changes.
  • If you have troubles with make recognizing the changes, you can run `make clean` to delete built files and repeat the previous step.

Acknowledgments

This project is possible thanks to the emscripten library which allowed me to compile, libKeyFinder (originally written by Ibrahim Sha’ath) and its dependency FFTW for the browser.

About

Musical Key Detection in the browser

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 78.7%
  • TypeScript 15.4%
  • CSS 2.6%
  • C++ 1.5%
  • Makefile 1.4%
  • HTML 0.2%
  • Other 0.2%