axeldelafosse / webKeyFinder

Musical Key Detection in the browser

Home Page:https://keyfinder.live

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

Refer to system overview for more details.

Instructions

webKeyFinder consists of two packages. key-finder-wasm provides the web worker for audio key analysis. key-finder-web consumes key-finder-wasm and provides the interfaces to run the key analysis on audio streams and audio files.

key-finder-wasm already includes the built artifacts, key-finder-web can be run without compiling the wasm module.

key-finder-wasm

Prerequisites

emscripten

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

curl

sudo apt-get update
sudo apt-get install curl

Installation

Following command will fetch FFTW3 and libKeyFinder and compile it using emscripten.

yarn build:wasm

key-finder-web

Prerequisites

yarn

Install dependencies

yarn install

Build

yarn build:web

Serve Locally

yarn serve

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

https://keyfinder.live

License:GNU General Public License v3.0


Languages

Language:TypeScript 62.5%Language:JavaScript 14.9%Language:CSS 10.7%Language:C++ 6.1%Language:Makefile 3.6%Language:Dockerfile 1.3%Language:HTML 0.9%