question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Turn Spectro into a library

See original GitHub issue

At the moment Spectro just builds to a demo. It should be turned into a library, with the existing demo being moved into a demo or examples folder.

I imagine the API looking something like this:

// Creates a spectrogram attached to the given canvas, provides automatic handling
// of when the canvas is resized
const canvas = document.getElementById('spectrogram-canvas');
const spectrogram = new Spectrogram(canvas);

// Change display parameters of the spectrogram
spectrogram.updateRenderSettings({
    zoom: 1.5,
    minFrequencyHz: 0,
    maxFrequencyHz: 12000,
    scale: 'mel',
    color: /* object representing a color gradient */
});

// Start recording from mic, will prompt for permissions and return a promise once
// recording has started
await spectrogram.recordFromMic();

// Play audio file, can take URL or File object with option to mute output
await spectrogram.playAudioFile(file, mute = true);

// Manual API where audio data is streamed to the spectrogram
const renderAudioBuffer = await spectrogram.streamAudio();
// Call renderAudioBuffer() each time there is an audio buffer to render, returns a
// promise
// Calling renderAudioBuffer() after a call to stop() is an error

// Stop recording from mic or playing audio file
await spectrogram.stop();

// Add event listener to handle state changes
spectrogram.addStateChangeEventListener((state) => {
    // state can be one of 'stopped', 'playing-mic', 'playing-file', or
    // 'playing-custom'
});

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
calebj0sephcommented, Mar 16, 2021

@gokgozf Sorry for the late reply, haven’t really touched any of my Github projects since COVID all started. Now that I’m getting back into things, I’m hoping to make Spectro into a reusable library with an npm package while also keeping this repository maintained. I’ve started by upgrading all of the dependencies, next I’m going to be refactoring the codebase into a library while putting the current demo in a separate directory that uses the new library. No ETA yet as I haven’t worked with the code in a year, but hopefully not too long!

0reactions
rechmbrscommented, Mar 27, 2021

@calebj0seph the sliding DFT can be used to drop m samples and pickup p samples. Most often m = p = 1.

Please contact me at rechmbrs [at] gmail [dot] com to follow on with this. I have a number of other parts to discuss. We can then bring results back here for others.

RONC

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to make a spectral library for a labeled DIA ... - YouTube
Spectronaut Tutorial - How to make a spectral library for a labeled DIA experiment using Pulsar ; Study Looking at Protein Level Degradation: ......
Read more >
Spectronaut™ Tutorial - How to make a spectral library for a ...
Tejas Gandhi from our R&D team walks you through the relevant search and library settings so that you can take advantage of labeled...
Read more >
Building Color Libraries with your SpectroDensitometer
SpectroDens Calibration Procedure: Press the green button to turn unit “on.” Use up arrow to go to “Calibration.” ; Create Color Book/Library: Connect...
Read more >
Support for Spectro 1 by Variable - Color Muse
A: Once the Spectro 1 device has been received, the user can scan and save color standards then periodically check against the color...
Read more >
Library Searching - Spectroscopy Online
Regardless of the computer, a library search is performed by mathematically comparing your unknown spectrum to each of the spectra in a ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found