synthesizer-core-0.6: Audio signal processing coded in Haskell: Low level part

Safe HaskellNone




sample :: C a => T a v -> T v -> T a vSource

sampledTone :: C a => T a v -> T a v -> a -> T v -> a -> T a vSource

We assume that a tone was generated by a shape modulated oscillator. We try to reconstruct the wave function (with parameters shape control and phase) from a tone by interpolation.

The unit for the shape control parameter is the sampling period. That is the shape parameter is a time parameter pointing to a momentary shape of the prototype signal. Of course this momentary shape does not exist and we can only guess it using interpolation.

At the boundaries we repeat the outermost shapes that can be reconstructed entirely from interpolated data (that is, no extrapolation is needed). This way we cannot reproduce the shape at the boundaries because we have no data for cyclically extending it. On the other hand this method guarantees a nice wave shape with the required fractional period.

It must be length tone >= Interpolation.number ipStep + Interpolation.number ipLeap * ceiling period.