Bluesharp Pitch Detection Examples

This page contains examples demonstrating how to use the bluesharp-pitch-detection npm package for pitch detection, chord recognition, and audio analysis.

Note: These examples are designed to run in a browser environment. Some examples require microphone access and modern browser features like the AudioWorklet API.

Available Examples

Basic Pitch Detection

Demonstrates how to use the YIN pitch detection algorithm to analyze audio data and detect the fundamental frequency (pitch).

Run Example View Source

Algorithm Comparison

Compares different pitch detection algorithms (YIN, MPM, FFT, and Hybrid) on various test signals to demonstrate their strengths and weaknesses.

Run Example View Source

Chord Detection

Shows how to use the chord detection functionality to identify chords from a set of frequencies or audio input.

Run Example View Source

Audio Worklet

Demonstrates how to use the PitchProcessor AudioWorklet for real-time pitch detection in a browser environment.

Run Example View Source

Running the Examples

To run these examples locally, you'll need to:

  1. Clone the repository: git clone https://github.com/egdels/bluesharpbendingapp.git
  2. Navigate to the examples directory: cd bluesharpbendingapp/npm/examples
  3. Start a local server, for example using Node.js: npx http-server
  4. Open your browser and navigate to http://localhost:8080

Example HTML Files

Each example has a corresponding HTML file that loads the JavaScript module. Here's a template for creating these files:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Example Name - Bluesharp Pitch Detection</title>
</head>
<body>
    <h1>Example Name</h1>
    <p><a href="index.html">Back to Examples</a></p>
    
    <div id="results"></div>
    
    <script type="module" src="example-file.js"></script>
</body>
</html>

Additional Resources