lambdasound-1.2.0: A libary for generating low-level sounds with high-level combinators
Safe HaskellSafe-Inferred
LanguageGHC2021

LambdaSound.Sampling

Description

This module contains functions to sample sound and to save it in a file. The LambdaSound.Play module exports a function to play sounds directly.

Synopsis

Documentation

sampleSound :: Hz -> Sound T Pulse -> IO (Vector S Pulse) Source #

Samples a sound with the given frequency (usually 44100 is good) with post-processing

This is recommended over sampleSoundRaw if you are unsure

sampleSoundRaw :: Hz -> Sound T Pulse -> IO (Vector S Pulse) Source #

Samples a sound with the given frequency (usually 44100 is good) without post-processing

unsampleSound :: Source r Pulse => Vector r Pulse -> Sound I Pulse Source #

Convert a vector of samples into the Sound datatype so that it can be transformed with the various combinators.

Keep in mind that if you do not exactly match the size of the vector and the needed amount of samples for the sound, then its speed will actually change which will also affect the sound pitch. Also, sub- or supersampling will happen.

unsampleSoundWithHz :: Source r Pulse => Hz -> Vector r Pulse -> Sound T Pulse Source #

Convert a vector of samples into the Sound datatype so that it can be transformed with the various combinators.

Given the sample rate used for the creation of the vector, the resulting sound will have the same duration as the original sound. However, sub- and supersampling will still happen similarly to unsampleSound and changing the Duration also changes the pitch.