Uses Bill Seathares' Dissoncance Curve algorithm in order to compute tunings for a given timbre.
Create a new curve based on arrays of data. This would mostly be used for additive synthesis.
freqs |
An array of signficant frequencies of a timbre. |
amps |
An array of amplitudes for the given frequencies. |
highInterval |
The largest interval to compute in cents. For octave-based systems, you would usually use 1200. Default value is 1902. |
Create a curve based on the timbre of a given FM specification
carrier |
The carrier frequency in Hz |
modulator |
The modulation frequency in Hz |
depth |
The depth (or delta range) of the modulator, in Hz |
highInterval |
The largest interval to compute in cents. For octave-based systems, you would usually use 1200. |
ex:
Create a curve based on the timbre of a given FFT buffer. THIS IS VERY SLOW and uses a lot of system resources
buffer |
An FFT Buffer |
size |
The size of the Bufer in Frames |
cutoff |
The lower cutoff amplitude for a bin. Defaults to -60 dB |
highInterval |
The largest interval to compute in cents. For octave-based systems, you would usually use 1200. |
action |
A function to be evaluated once computing the curve is complete. |
Create a curve based on a Spectrum
spectrum |
a Spectrum |
highInterval |
The largest interval to compute in cents. For octave-based systems, you would usually use 1200. |
Returns a Tuning based on the minima of the Dissonance Curve
Returns a Scale in which the Tuning is the minima of the curve.
size |
The number of degrees of the scale. For size n, it pickes the n most consonant degrees. Defaults to inf, which makes a scale degree for every degree of the Tuning. |
Plot the DissonanceCurve
Deprecated. Use justTuning
Returns a Tuning Related to Sethares' algorithm, but calculated using a just tuning. This does a comparison of every partial at every tuning, but instead of looking at Plomp and Levit's ideas of local consonance, it compares the ratio relationships between the partials. The numerator and denominator of this ratio is summed and then multiplied by the amplitude of the quieter partial.
This algorythm just gives a list of the relative dissonance at all possible tunings. To figure out scale degrees, the most consonant tuning is picked from it's neighbors, given the window size.
The tuning generated by this way and by the Sethares / Plomp and Levit algorithms may have nothing to do with each other.
window |
The idealized step size, in cents. To do normal-ish semitones, this would be set to 100 |
a Tuning
Deprecated. Use justScale
Returns a Scale based on the justTuning.
window |
The window size used to compute the justTuning |
size |
The number of degrees of the scale. For size n, it pickes the n most consonant degrees. Defaults to inf, which makes a Scale degree for every degree of the Tuning. |
a Scale
Uses the same calculation for dissonance as in justTuning, but picks scale degrees based on a given limit. Neither the numerator, nor the denominator may be greater than the limit. The higher the given limit, the more the resultant tuning will be based on the timbre. The lower the limit, the more it will resemble normal, non-timbral just intonation.
The tuning generated by this way and by the Sethares / Plomp and Levit algorithms may have nothing to do with each other.
limit |
The largest allowed numerator or denominator. The higher this number, the greater the relationship between the scale and the timbre. |
size |
The number of ratios present in the tuning |
a Tuning
It it necessary to limit by size because the dissonance curve contains ALL of the just tunings. Returning all tunings under the limit would just return a normal lattice. By including a size, we can limit the resultant tuning to the most timbrally-consonant steps.
Returns a Scale based on the limitedJustTuning.
limit |
The largest allowed numerator or denominator used in computing the tuning |
tuningSize |
The number of ratios present in the tuning. |
scaleSize |
The numner of ratios present in the scale. If this is smaller than the number present in the tuning, it picks the most consonant steps. |
a Scale
Posts the ratios for the just tuning. You must compute the scale first, via either of the two just methods
Adds two DiscconanceCurves together in a meaningful way. This would be useful to figure out a scale that works for two different timbres.
other |
a Spectrum or a DissonanceCurve |
a new DissonanceCurve
Plot a curve:
Get a scale:
To use with a Pbind, let's make a synthdef that uses some of the keywords from event, specifically freq and octave.
Our Pbind is very standard:
The pbind will generate a midinote based on the degree chosen and the scale. This will be a floating point number. When we use this number in the synthDef, it will give us a useful ratio and generate the correct notes.