|
|
in news:606753c7$1@news.povray.org William F Pokorny wrote:
> I'm not aware of any such feature
Bill, Tor Olav,
Usefull suggestions, as allways. Thanks! But I'm just not sure either one
of the ways is what I'm thinkin' of. I.i.r.c It was something Thorsten
mentioned / showed when functions where introduced.
Anyway I'll study your suggestions. For now I "fixed" it by calling
another function. Works fine, no hurries.
/*:Ramp Oscilator, goes from 0 to 1 over 1 Frequency period
Not for direct sound use because of DC.
*/
#declare Ramp = function(Freq, Amp, Tick, SRate){
Amp * mod(Tick, 1/(Freq/SRate)) * (Freq/SRate)
}
/*:Triangle wave Oscilator*/
#declare TriangleOsc = function(Freq, Amp, Tick, SRate){
(select (
Ramp(Freq, 1, Tick, SRate) - 0.25,
Ramp(Freq, 1, Tick, SRate) * 4,
select(
Ramp(Freq, 1, Tick, SRate) - 0.75,
2 - Ramp(Freq, 1, Tick, SRate) * 4,
Ramp(Freq, 1, Tick, SRate) * 4 - 4
)
)) * Amp
}
Cheers,
Ingo
Post a reply to this message
|
|