Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

187
Views
Noise Reduction - Pitchy JS

I have this code which takes live audio of microphone, converts it into frequency and finally displays the time vs frequency graph. It is working fine.

What I need to do? While I am taking audio from the microphone there is noise in the recorded audio which is fluctuating the frequency.

I need to remove / reduce that noise/background disturbance and get a little bit more smoothed output - audio frequency.

CODE

import { PitchDetector } from "https://esm.sh/pitchy@3";

function updatePitch(analyserNode, detector, input, sampleRate) {
    analyserNode.getFloatTimeDomainData(input);
    const [pitch, clarity] = detector.findPitch(input, sampleRate);

    
    Plotly.extendTraces('chart', {y: [[Math.round(pitch * 10) / 10]]}, [0])
        
    document.getElementById("pitch").textContent = `${Math.round(pitch * 10) / 10
        } Hz`;
    document.getElementById("clarity").textContent = `${Math.round(
        clarity * 100
    )} %`;
    window.setTimeout(
        () => {
            updatePitch(analyserNode, detector, input, sampleRate);
        },
        250
    );
}

Plotly.plot(
    'chart', [{
        y: [Math.round(pitch * 10) / 10],
        type: 'line'
    }]
);

document.addEventListener("DOMContentLoaded", () => {
    const audioContext = new window.AudioContext();
    const analyserNode = audioContext.createAnalyser();

    document
        .getElementById("resume-button")
        .addEventListener("click", () => audioContext.resume());

    navigator.mediaDevices.getUserMedia({ audio: true }).then((stream) => {
        audioContext.createMediaStreamSource(stream).connect(analyserNode);
        const detector = PitchDetector.forFloat32Array(analyserNode.fftSize);
        const input = new Float32Array(detector.inputLength);
        updatePitch(analyserNode, detector, input, audioContext.sampleRate);
    });
});
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!