Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions source/AYUGens/sc/AY.sc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ AY : UGen {

*categories { ^ #["UGens>Oscillators"] }

*freqtotone { |freq|
// Approximate empirical...
//^(109300 / (freq - 3.70727))
^(110300 / (freq - 0.5))
*freqtotone { |freq, s=nil|

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Thanks for looking into this ... Maybe it would be clearer to just pass the sample rate into the freqtotone method? Then we can also use the method in a synthDef (using the SampleRateugen). And if none is given, it can still be calculated as you do it.

Note that usually we call the argument server and there is no need to specify the default to nil, since the default is nil.

var chipTactsPerOutCount;
s = s ?? { Server.default };
// this mirrors ayemu's internal calculation of ChipTacts_per_outcount
chipTactsPerOutCount = 1773400.div(Server.default.sampleRate).div(8);
^(s.sampleRate * chipTactsPerOutCount / (2 * freq)).round
}
}
Loading