chuck
chuck copied to clipboard
Gen17 only deals with input signals with amplitude range 0-1
Hi,
I noticed that the UGen Gen17 only deals with input signals that go from 0 to 1. Even if the example suggests that a SinOsc can be used as a input, that produces an unwanted distorted signal. This seems to be due to the code in genX_tick() at row 1212 in ugen_osc.cpp:
// if input
if( ugen->m_num_src ) {
in_index = in;
// gewang: moved this to here
if( in_index < 0. ) in_index = -in_index;
//scaled_index = (in_index + 1.) * 0.5 * genX_tableSize; //drive with oscillator, [-1, 1]
scaled_index = in_index * genX_tableSize; //drive with phasor [0, 1]
} else {
scaled_index = 0.;
}
I'd say if this won't get fixed, we could consider updating the example.
cheers, Mario
Even scaling the input so that has an amplitude range of 0-1, there are still issues when trying to produce specific partials. A simple example is when using:
[0.,0,0,0, 1 ] => g17.coefs;
and a SinOsc as input. This produces aliasing. When connecting the ChucK output to a scope it's clear that the generated waveform contains discontinuities.