Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CZ Oscillators: add anti-aliased versions #64

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

magnetophon
Copy link
Contributor

@magnetophon magnetophon commented Dec 17, 2020

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

@magnetophon
Copy link
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
Contributor Author

Any news on this?

@sletz
Copy link
Member

sletz commented Apr 13, 2021

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

@magnetophon
Copy link
Contributor Author

I tested by ear.

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

@sletz
Copy link
Member

sletz commented Apr 13, 2021

Yes this could be great.

@josmithiii
Copy link
Collaborator

josmithiii commented Apr 14, 2021

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
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
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.

None yet

3 participants