|Portability||requires multi-parameter type classes|
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.
- type Phase a = a
- static :: C a => T a b -> Phase a -> a -> T b
- freqMod :: C a => T a b -> Phase a -> T a -> T b
- phaseMod :: C a => T a b -> a -> T (Phase a) -> T b
- shapeMod :: C a => (c -> T a b) -> Phase a -> a -> T c -> T b
- phaseFreqMod :: C a => T a b -> T (Phase a) -> T a -> T b
- shapeFreqMod :: C a => (c -> T a b) -> Phase a -> T c -> T a -> T b
- staticSample :: C a => T a b -> [b] -> Phase a -> a -> T b
- freqModSample :: C a => T a b -> [b] -> Phase a -> T a -> T b
- shapeFreqModSample :: (C c, C b) => T c (T b a) -> [T b a] -> c -> Phase b -> T c -> T b -> T a
- shapePhaseFreqModSample :: (C c, C b) => T c (T b a) -> [T b a] -> c -> T c -> T (Phase b) -> T b -> T a
- shapeFreqModFromSampledTone :: C t => T t y -> T t y -> t -> T y -> t -> t -> T t -> T t -> T y
- shapePhaseFreqModFromSampledTone :: C t => T t y -> T t y -> t -> T y -> t -> t -> T t -> T t -> T t -> T y
- staticSine :: (C a, C a) => a -> a -> T a
- freqModSine :: (C a, C a) => a -> T a -> T a
- phaseModSine :: (C a, C a) => a -> T a -> T a
- staticSaw :: C a => a -> a -> T a
- freqModSaw :: C a => a -> T a -> T a
Oscillators with arbitrary but constant waveforms
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.
Shape control is a list of relative changes,
each of which must be non-negative 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
Wave.sample in the list of waveforms.
With sampled waves this function is identical to HunkTranspose in Assampler.
Example: interpolate different versions
You could also chop a tone into single waves
and use the waves as input for this function
but you certainly want to use
because in the wave information for
shape and phase are strictly separated.
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
with a wave function constructed by
but it consumes the sampled source tone lazily
and thus allows only relative shape control with non-negative control steps.
The function is similar to
shapeFreqModSample but respects
that in a sampled tone, phase and shape control advance synchronously.
Actually we could re-use
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
the shape control difference
1 does not mean to skip to the next wave,
since this oscillator has no discrete waveforms.
1 means that the shape alters as fast as in the prototype signal.
Although the shape difference values must be non-negative
I hesitate to give them the type
because then you cannot call this function with other types
of non-negative numbers like
The prototype tone signal is reproduced if
freqs == repeat (1/period) and
shapes == repeat 1.
Oscillators with specific waveforms
sine oscillator with modulated phase, useful for FM synthesis