GithubHelp home page GithubHelp logo

Comments (5)

brnl avatar brnl commented on June 29, 2024

According to the FPS I found that the frame time is now kinda hard coded to 60FPS:

output/vis.c line 320

void vis_blit() {
    bf_blit(buffer_final, 15, rotate);
}

Changing 15 to something lower, increases the FPS.

I've also changed vis_osc to make it more crisp, but that is totally a personal taste!

output/vis.c line 188

void vis_osc(struct audio_data *audio, axes *ax_l, axes *ax_r, rgba osc_c) {

    // oscilloscope waveform plotter to framebuffer
    ax_l->y_min = -32766;
    ax_r->y_min = -32766;
    ax_l->y_max = 32766;
    ax_r->y_max = 32766;

    // bf_blur(buffer_final);
    // bf_shade(buffer_final, 0.8);    // 0.8 is not bad
    bf_clear(buffer_final);         // No blur&fade; just clear the buffer

    bf_plot_osc(buffer_final, *ax_l, audio->in_l, audio->in_r, audio->FFTbufferSize, osc_c);
    // vis_sleep(2e9 / 3000);   // No sleep in Brooklyn
}

from bellini.

brnl avatar brnl commented on June 29, 2024

For the 45 degrees CCW rotation, I've modified the for-loop to calculate the new pixel locations. But I do had to use ChatGPT for this, haha!

output/sdlplot.c line 479

    // Calculate the center point
    double rotation_center_x = ax.screen_x + ax.screen_w / 2.0;
    double rotation_center_y = ax.screen_y + ax.screen_h / 2.0;
    
    for (uint32_t i = 0; i < num_points - 1; i++) {
        double original_x = (double)(h * (data_x[i] - ax.y_min) / range) + ax.screen_x + dx;
        double original_y = (double)(h * (data_y[i] - ax.y_min) / range) + ax.screen_y + dy;

        // Shift the point to the rotation center before rotating
        double shifted_x = original_x - rotation_center_x;
        double shifted_y = original_y - rotation_center_y;

        // Rotate the shifted point
        double rotated_x = shifted_x * cos(45 * M_PI / 180) - shifted_y * sin(45 * M_PI / 180);
        double rotated_y = shifted_x * sin(45 * M_PI / 180) + shifted_y * cos(45 * M_PI / 180);

        // Shift the rotated point back to the original position
        x = (uint32_t)(rotated_x + rotation_center_x);
        y = (uint32_t)(rotated_y + rotation_center_y);

        bf_set_pixel(buff, x, y, c);
    }

from bellini.

brnl avatar brnl commented on June 29, 2024

Thanks again for the insanely amazing foundation you have laid out for me. This is an absolute dream!

from bellini.

atisharma avatar atisharma commented on June 29, 2024

Sorry for the delay, I was on holiday.

I'm glad you like the project.

I found that the Readme and the default config could use some help in clarifying some items (like which font to choose) and maybe guidance on the shem device? However, I found that 'pulse' and 'auto' works fine for me. I'll create a PR for that, if you're open to that?

Please, feel free.

The framerate of the OSC is a bit low... Do you think this is due to using pulsaudio as the input or is there another way to improve performance?

It's pretty good for me and may be hardware/setup dependent. I'm using alsa. If I know more about your setup then I can try to reproduce. Please open a separate issue specific to this.

Also, is it me or is the OSC rotated 45 degrees? I would expect a mono sound to be a straight vertical line.

Mono sound is generally rendered by stereo playback with equal signal to the left & right channels. The x-axis the the left channel and y-axis is the right channel (or reversed - can't remember). So, mono looks like a line at 45 degrees. As you observe, changing this would break compatibility with what others would expect.

According to the FPS I found that the frame time is now kinda hard coded to 60FPS

Yes, pretty much it is, as that's all my hardware can manage.

from bellini.

atisharma avatar atisharma commented on June 29, 2024

Closed as no activity. Please reopen if necessary.

from bellini.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.