ParentContentsIndex
Sound.Hommage.Signal
Contents
Mono and Stereo Values
Signal datatype
Description
Dieses Module stellt Datentypen und Funktionen zum Umgang mit Mono- und Stereodaten zur Verfügung. Speziell im Falle des Öffnens einer WAV-Datei ist erst zur Laufzeit bekannt, ob es sich um eine Mono- oder Stereodatei handelt, hier wird der Typ Signal benötigt.
Synopsis
type Mono = Double
data Stereo = (:><:) !Double !Double
leftStereo :: Stereo -> Mono
rightStereo :: Stereo -> Mono
stereoToMono :: Stereo -> Mono
monoToStereo :: Mono -> Stereo
balance :: Double -> Stereo -> Stereo
data Signal
= Mono [Mono]
| Stereo [Stereo]
readWavSignal :: FilePath -> IO Signal
openWavSignal :: FilePath -> Signal
writeWavMono :: FilePath -> [Mono] -> IO ()
writeWavStereo :: FilePath -> [Stereo] -> IO ()
writeWavSignal :: FilePath -> Signal -> IO ()
writeTracks :: FilePath -> [Signal] -> IO ()
signalToMono :: Signal -> [Mono]
signalToStereo :: Signal -> [Stereo]
eitherSignal :: ([Mono] -> a) -> ([Stereo] -> a) -> Signal -> a
liftSignal :: ([Mono] -> [Mono]) -> Signal -> Signal
mergeSignal :: Signal -> Signal -> Signal
mergeSignals :: [Signal] -> Signal
multSignal :: Signal -> Signal -> Signal
infiniteSignal :: Double -> Signal -> Signal
Mono and Stereo Values
type Mono = Double
A mono value.
data Stereo
A stereo value with left and right part. It is an instance of class Num and Fractional.
Constructors
(:><:) !Double !Double
Instances
Typeable Stereo
Num Stereo
Fractional Stereo
Eq Stereo
Show Stereo
Sound (Play [Stereo])
Sound [Stereo]
Sound Stereo
Sound (Track [Stereo])
(Sound a) => Effect (Play [Stereo] -> a)
Effect ([Stereo] -> [Stereo])
Effect ([Stereo] -> [Stereo])
leftStereo :: Stereo -> Mono
Access to the left part of a Stereo value.
rightStereo :: Stereo -> Mono
Access to the right part of a Stereo value.
stereoToMono :: Stereo -> Mono
Converts a Stereo value to a Mono value (Double)
monoToStereo :: Mono -> Stereo
Converts a Mono value (Double) to a Stereo value
balance :: Double -> Stereo -> Stereo
The range of the Double value must be between -1 and 1. If it is below 0 the left channel is turned down, if it is greater than 0 the right channel is turned down. NOTE: This function should be replaced by a better one.
Signal datatype
data Signal
A Signal is either a list of Mono values or a list of Stereo values.
Constructors
Mono [Mono]
Stereo [Stereo]
Instances
Typeable Signal
Trackable Signal
Sound (Play Signal)
Sound Signal
Sound (Track Signal)
(Sound a) => Effect (Play Signal -> a)
Effect (Play (Signal -> Signal))
Effect (Play (Signal -> Signal))
Effect (Signal -> Signal)
Effect (Signal -> Signal)
readWavSignal :: FilePath -> IO Signal
Reads a Signal from a WAV-File.
openWavSignal :: FilePath -> Signal
Opens a Signal from a WAV-File.
writeWavMono :: FilePath -> [Mono] -> IO ()
Writes a list of mono values to a WAV-File.
writeWavStereo :: FilePath -> [Stereo] -> IO ()
Writes a list of stereo values to a WAV-File.
writeWavSignal :: FilePath -> Signal -> IO ()
Writes a Signal to a WAV-File.
writeTracks :: FilePath -> [Signal] -> IO ()
signalToMono :: Signal -> [Mono]
Transfroms a signal to a list of mono values.
signalToStereo :: Signal -> [Stereo]
Transfroms a signal to a list of stereo values.
eitherSignal :: ([Mono] -> a) -> ([Stereo] -> a) -> Signal -> a
liftSignal :: ([Mono] -> [Mono]) -> Signal -> Signal
Applies the function to the input signal. If it is a stereo signal, the function is applied to both channels seperately.
mergeSignal :: Signal -> Signal -> Signal
The sum of two signals
mergeSignals :: [Signal] -> Signal
The sum of a set of signals. If all signals are mono, the result will be mono. Otherwise it will be stereo.
multSignal :: Signal -> Signal -> Signal
Multiplies two signals.
infiniteSignal :: Double -> Signal -> Signal
The Double value is added to the input signal (offset). The resulting signal will be infinie in any case.
Produced by Haddock version HADDOCK_VERSION