Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments #1

Open
mfcc64 opened this issue Jun 24, 2018 · 8 comments
Open

Comments #1

mfcc64 opened this issue Jun 24, 2018 · 8 comments

Comments

@mfcc64
Copy link
Owner

mfcc64 commented Jun 24, 2018

No description provided.

@Erudition
Copy link

This is awesome! What is the cause of all of the "holes" in the waterfall output? Is that a rendering artifact, or some actual property of the music?

@mfcc64
Copy link
Owner Author

mfcc64 commented Mar 22, 2019

That's because of interference between frequencies.

@brucerothwell
Copy link

Awesome work on this! I have been searching for something nice like this that I can incorporate into a website I am developing, for live audio streaming. All that I have found are either ones that will play an audio stream from a URL, but the animation does not work, or the animation works, but only seems to play a file loaded from the local computer. Do you know of a tweek that would make this work with an audio stream URL? (this is the URL: http://de1.internet-radio.com:8106/stream )

@mfcc64
Copy link
Owner Author

mfcc64 commented Apr 14, 2019

Probably, this is CORS issue. Maybe, try it with audio stream from your website instead of external website.

Thank's.

@brucerothwell
Copy link

Thx for responding! If you mean running your code on the server the stream originates from, that is not possible — it is a streaming server I do not have access to.

What is CORS?

@brucerothwell
Copy link

Thx again.

With another bit of code, I’ve been able to get audio and a visualizer working, but is so basic, not looking anything nice like yours.

Part of what I did was add the audio.crossdomain =“anonymous”; line.

What I’d really like to donis get your visualizer working with my ausio stream.

Also, is there an option for not showing the musical scale, and just show the waveform?

@mfcc64
Copy link
Owner Author

mfcc64 commented Apr 15, 2019

Probably, you want to use showcqtbar.js from scratch.
Here is an example:

// include showcqtbar.js
// prepare audio_ctx, canvas, canvas_ctx, analyser_l, analyser_r
var bar_v = 17;
var sono_v = 17;
var cqt = new ShowCQTBar(audio_ctx.sampleRate, canvas.width, canvas.height - 4, /* add 4 pixels axis */
                         bar_v, sono_v, 1);

analyser_l.fftSize = cqt.fft_size;
analyser_r.fftSize = cqt.fft_size;

var buffer_l = cqt.get_input_array(0);
var buffer_r = cqt.get_input_array(1);
var line_buffer = cqt.get_output_array();
var canvas_buffer = canvas_ctx.createImageData(canvas.width, canvas.height);

function draw() {
    requestAnimationFrame(draw);
    analyser_l.getFloatTimeDomainData(buffer_l);
    analyser_r.getFloatTimeDomainData(buffer_r);
    cqt.calc();

    for (var y = 0; y < canvas.height; y++) {
        cqt.render_line(y, 255 /* opaque */);
        canvas_buffer.data.set(line_buffer, 4 * canvas.width * y);
    }

    canvas_ctx.putImageData(canvas_buffer, 0, 0);
}

requestAnimationFrame(draw);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants