Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synthesizer.Structure
Synopsis
- newtype Channel = Channel {
- timeline :: [SoundEvent]
- type Frequency = Double
- type Length = Double
- type PhaseLength = Int
- type Sample = Double
- type SamplingRate = Int
- data SoundEvent = SoundEvent {
- startTime :: Time
- eventLength :: Length
- samples :: SamplingRate -> [Sample]
- newtype SynSound = SynSound {}
- type Time = Double
- addChannel :: SynSound -> Channel -> SynSound
- addToNewChannel :: SynSound -> [SoundEvent] -> SynSound
- getAllEvents :: SynSound -> [SoundEvent]
- getAllEventsDuring :: SynSound -> (Time, Time) -> [SoundEvent]
- soundToSamples :: SynSound -> SamplingRate -> [Sample]
Documentation
Constructors
Channel | |
Fields
|
type PhaseLength = Int Source #
type SamplingRate = Int Source #
data SoundEvent Source #
Constructors
SoundEvent | |
Fields
|
Instances
Eq SoundEvent Source # | Eq instance for SoundEvents. It should be noted that this isn't 100% sound, as if the needed samples for generating sounds are exactly the same but a sample after that is different, this will return equality even if it really isn't. However functionally these two events are the same, since at maximum that amount of samples will be used when generating the sound from them. So there is no practical difference in this context |
Defined in Synthesizer.Structure | |
Show SoundEvent Source # | |
Defined in Synthesizer.Structure Methods showsPrec :: Int -> SoundEvent -> ShowS # show :: SoundEvent -> String # showList :: [SoundEvent] -> ShowS # |
addToNewChannel :: SynSound -> [SoundEvent] -> SynSound Source #
Adds SoundEvents to a new channel.
getAllEvents :: SynSound -> [SoundEvent] Source #
Gets all events currently in the synthesizer.
getAllEventsDuring :: SynSound -> (Time, Time) -> [SoundEvent] Source #
Gets all events that overlap with a time period of (startTime, endTime). | Passing an endTime that is before the startTime will result in no events being returned.
soundToSamples :: SynSound -> SamplingRate -> [Sample] Source #
Converts the sound structure to a list of samples with a certain sampling rate.
The worst-case time complexity of the algorithm is O(n log n)
, where n is the amount of sound events.