Skip to content

gam::Saw output range: has DC offset and exceeds 1.0 #51

Description

@younkhg

output of below program is:

min: -0.625428, max: 1.02889

is there a way to normalize this output to [-1.0 : 1.0] ?

#include "Gamma/Domain.h"
#include "Gamma/Oscillator.h"

#include <cfloat>
#include <iostream>

using namespace std;

int main()
{
    gam::Domain::master().spu(44100.0f);
    gam::Saw<> saw;
    saw.freq(440.0f);

    float max_s = -FLT_MAX;
    float min_s = FLT_MAX;

    for (int i = 0; i < 44100; i += 1)
    {
        float s = saw();
        if (s > max_s) max_s = s;
        if (s < min_s) min_s = s;
    }

    cout << "min: " << min_s << ", max: " << max_s << endl;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions