
Synthesizer.Plain.Oscillator  Portability  requires multiparameter type classes  Stability  provisional  Maintainer  synthesizer@henningthielemann.de 





Description 
Tone generators
Frequencies are always specified in ratios of the sample rate,
e.g. the frequency 0.01 for the sample rate 44100 Hz
means a physical frequency of 441 Hz.


Synopsis 



Documentation 



Oscillators with arbitrary but constant waveforms



oscillator with constant frequency



oscillator with modulated frequency



oscillator with modulated phase



oscillator with modulated shape



oscillator with both phase and frequency modulation



oscillator with both shape and frequency modulation



oscillator with a sampled waveform with constant frequency
This is essentially an interpolation with cyclic padding.



oscillator with a sampled waveform with modulated frequency
Should behave homogenously for different types of interpolation.


shapeFreqModSample :: (C c, C b) => T c (T b a) > [T b a] > c > Phase b > T c > T b > T a  Source 

Shape control is a list of relative changes,
each of which must be nonnegative in order to allow lazy processing.
'1' advances by one wave.
Frequency control can be negative.
If you want to use sampled waveforms as well
then use Wave.sample in the list of waveforms.
With sampled waves this function is identical to HunkTranspose in Assampler.
Example: interpolate different versions
of Wave.oddCosine and Wave.oddTriangle.
You could also chop a tone into single waves
and use the waves as input for this function
but you certainly want to use
Wave.sampledTone or shapeFreqModFromSampledTone instead,
because in the wave information for shapeFreqModSample
shape and phase are strictly separated.


shapePhaseFreqModSample :: (C c, C b) => T c (T b a) > [T b a] > c > T c > T (Phase b) > T b > T a  Source 


shapeFreqModFromSampledTone :: C t => T t y > T t y > t > T y > t > t > T t > T t > T y  Source 

Time stretching and frequency modulation of a pure tone.
We consider a tone as the result of a shape modulated oscillator,
and virtually reconstruct the waveform function
(a function of time and phase) by interpolation and resample it.
This way we can alter frequency and time progress of the tone independently.
This function is identical to using shapeFreqMod
with a wave function constructed by Wave.sampledTone
but it consumes the sampled source tone lazily
and thus allows only relative shape control with nonnegative control steps.
The function is similar to shapeFreqModSample but respects
that in a sampled tone, phase and shape control advance synchronously.
Actually we could reuse shapeFreqModSample with modified phase values.
But we would have to cope with negative shape control jumps,
and waves would be padded locally cyclically.
The latter one is not wanted
since we want padding according to the adjacencies in the source tone.
Note that differently from shapeFreqModSample
the shape control difference 1 does not mean to skip to the next wave,
since this oscillator has no discrete waveforms.
Instead 1 means that the shape alters as fast as in the prototype signal.
Although the shape difference values must be nonnegative
I hesitate to give them the type Number.NonNegative.T t
because then you cannot call this function with other types
of nonnegative numbers like Number.NonNegativeChunky.T.
The prototype tone signal is reproduced if
freqs == repeat (1/period) and shapes == repeat 1.


shapePhaseFreqModFromSampledTone :: C t => T t y > T t y > t > T y > t > t > T t > T t > T t > T y  Source 


Oscillators with specific waveforms


staticSine :: (C a, C a) => a > a > T a  Source 

sine oscillator with static frequency


freqModSine :: (C a, C a) => a > T a > T a  Source 

sine oscillator with modulated frequency


phaseModSine :: (C a, C a) => a > T a > T a  Source 

sine oscillator with modulated phase, useful for FM synthesis



saw tooth oscillator with modulated frequency



saw tooth oscillator with modulated frequency


Produced by Haddock version 2.4.2 