Skip to content

CZ Oscillators: add anti-aliased versions#64

Open
magnetophon wants to merge 1 commit into
grame-cncm:masterfrom
magnetophon:CZ
Open

CZ Oscillators: add anti-aliased versions#64
magnetophon wants to merge 1 commit into
grame-cncm:masterfrom
magnetophon:CZ

Conversation

@magnetophon

@magnetophon magnetophon commented Dec 17, 2020

Copy link
Copy Markdown
Contributor

Is there any way to decrease the amount of repeated text, mostly in the comments?

@magnetophon magnetophon force-pushed the CZ branch 4 times, most recently from de6de50 to d5e2cef Compare December 17, 2020 22:35
@magnetophon

Copy link
Copy Markdown
Contributor Author

The current fund2freq implementation doesn't update when the fund jumps.
I wrote an algorithm to avoid that, but I'm not sure if there's enough benefit to warrant the added complexity.

fund2freq(fund) = delta*ma.SR
with {
  rawDelta = fund-fund';
  absDelta = abs(rawDelta);
  jump = absDelta>0.5;
  posDelta =  select2(jump,absDelta,1-absDelta);
  delta = posDelta*select2(isPos,-1,1);
  isPos = (rawDelta>=0)
          <: select2( jump, _, (1-_) );
};

@magnetophon

Copy link
Copy Markdown
Contributor Author

Any news on this?

@sletz

sletz commented Apr 13, 2021

Copy link
Copy Markdown
Member

Do you have any example code, showing the anti-aliased effect ? Any picture?

@magnetophon

Copy link
Copy Markdown
Contributor Author

I tested by ear.

Should I write some code that does a sweep and then make a screenshot of the spectrum?

@sletz

sletz commented Apr 13, 2021

Copy link
Copy Markdown
Member

Yes this could be great.

@josmithiii

josmithiii commented Apr 14, 2021

Copy link
Copy Markdown
Collaborator

In case it's useful, here is the test program I wrote for the existing alias-suppressed sawtooth oscillators and their derivatives:

// bandlimited sawtooth tests
ol = library("oscillators.lib");
ba = library("basics.lib");
amp = 1;
freq = 100;
process = par(i,6,i*0.1+ol.sawN(i+1,freq));
// Use faust2octave to look at 20*log10(abs(fft(faustout)))'

@magnetophon

Copy link
Copy Markdown
Contributor Author

@josmithiii Thanks, but I don't get it.
Isn't that just 6 detuned saws at about 100Hz?
How does that help to show anti-aliassing?

@josmithiii

Copy link
Copy Markdown
Collaborator

Here is an example together with the spectrum from Octave (it's GIF but GitHub is complaining about it - will try again if it's no good):

amp = 1;
freq = 1200;
//offset = 0.1; // for visual separation in time domain
offset = 0;
process = par(i,6,i*offset+ol.sawN(i+1,freq));

tsaw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants