Hey Community,
i am learning program a simple synthesizer, and i use the Maximilian Library for Osc’s, Envelepes etc…
I managed to get a sinewave responding to my MIDI Input, reacting to velocity, pitch and an fixed envelope.
No Problem so far. If i say now it should be a squarewave, it sounds not really nice, and compared to other softsynths squarewaves it is for sure not a real square. I think i hear some aliasing effect etc…
Maybe someone got an Idea?
here a piece of code, for the moment the envelope and filters etc are commented out, so i can focus on the true squarewave.
void renderNextBlock (AudioBuffer <float> &outputBuffer, int startSample, int numSamples)
{
for (int sample = 0; sample < numSamples; ++sample)
{
sineOsc1Value = osc1Sine.square(783.991);
// envOutput = env1.adsr(sineOsc1Value, env1.trigger);
// filtered = filter1.lores(envOutput, 200, 1);
for (int channel = 0; channel < outputBuffer.getNumChannels(); ++channel)
{
outputBuffer.addSample(channel, startSample, sineOsc1Value);
}
++startSample;
};
}
This Code is copied from the SynthVoice Section of my Synthesizer. The Function is called in the processBlock in the PluginProcessor.cpp
Followed the Tutorials from Joshua Hedge (The Audio Programmer) on Youtube. Thanks by the way for your videos, again
Greetings.
Manuel
EDIT: the frequency is just on a fix value for the moment, it is a Note G.