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

226
Views
Import modules not working in javascript file

I installed a few apis via npm. I am trying to import it but get an error that it won't work. If I remove the code everything will work besides,

const visualizer = butterchurn.createVisualizer(audioContext, canvas, {
    width: 800,
    height: 600
});

then, it works.

import butterchurn from "butterchurn";
import butterchurnPresets from "butterchurn-presets";

alert("sup");
//callback
//initalize audio context and get canvas
// initialize audioContext and get canvas

//window.navigator.getUserMedia({audio:true, video:false}, userMediaCallback);

//intialize audioContext and get canvas
let canvas = document.querySelector("#canvas")


let userMediaCallback = stream => {

    let audioContext = new AudioContext()
    let mic = audioContext.createMediaStreamSource(stream);

    const visualizer = butterchurn.createVisualizer(audioContext, canvas, {
        width: 800,
        height: 600
    });

    // get audioNode from audio source or microphone

    visualizer.connectAudio(mic);
    
    // load a preset

    const presets = butterchurnPresets.getPresets();
    const preset = presets['Flexi, martin + geiss - dedicated to the sherwin maxawow'];

    visualizer.loadPreset(preset, 0.0); // 2nd argument is the number of seconds to blend presets

    // resize visualizer

    visualizer.setRendererSize(1600, 1200);

    // render a frame
    
    visualizer.render();
    

}

window.navigator.getUserMedia({audio: true, video: false}, userMediaCallback, console.log);
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!