Safe Haskell | Safe-Inferred |
---|
Shared config to coordinate between the sequencer and im subsystems.
Synopsis
- type ChunkNum = Int
- data Config = Config {}
- getConfig :: IO.IO Config
- getLogFilename :: String -> IO.IO IO.FilePath
- config :: Path.AppDir -> Config
- data Synth = Synth {
- synthName :: !IO.FilePath
- binary :: !IO.FilePath
- type SynthName = Text
- nessName :: SynthName
- samplerName :: SynthName
- sampler :: Synth
- samplerRoot :: Path.Relative
- unsafeSamplerRoot :: IO.FilePath
- faustName :: SynthName
- faust :: Synth
- ness :: Synth
- notesParentDir :: IO.FilePath
- cacheDir :: IO.FilePath
- samplingRate :: Int
- type SamplingRate = 44100
- chunkSize :: AudioT.Frames
- blockSize :: AudioT.Frames
- chunkSeconds :: Int
- startLatency :: AudioT.Frames
- thruPort :: Socket.PortNumber
- notesFilename :: IO.FilePath -> IO.FilePath -> Id.BlockId -> Synth -> IO.FilePath
- notesDirectory :: IO.FilePath -> IO.FilePath -> Id.BlockId -> IO.FilePath
- outputDirectory :: IO.FilePath -> IO.FilePath -> Id.BlockId -> IO.FilePath
- chunkPath :: IO.FilePath -> IO.FilePath -> Id.BlockId -> ScoreT.Instrument -> ChunkNum -> IO.FilePath
- chunkName :: ChunkNum -> IO.FilePath
- isOutputLink :: IO.FilePath -> Maybe.Maybe ChunkNum
- playFilename :: IO.FilePath -> Id.BlockId -> IO.FilePath
- idFilename :: Id.Ident a => a -> IO.FilePath
- clearUnusedInstruments :: IO.FilePath -> HashSet ScoreT.Instrument -> IO.IO ()
- instrumentToDir :: ScoreT.Instrument -> IO.FilePath
- dirToInstrument :: IO.FilePath -> ScoreT.Instrument
- listDir :: IO.FilePath -> IO.IO [IO.FilePath]
- data Message = Message {
- _blockId :: !Id.BlockId
- _trackIds :: !(Set Id.TrackId)
- _instrument :: !ScoreT.Instrument
- _payload :: !Payload
- data Payload
- = RenderingRange !RealTime !RealTime
- | WaveformsCompleted ![ChunkNum]
- | Warn !Stack.Stack !Text
- | Failure !Text
- emitMessage :: HasCallStack => Message -> IO.IO ()
- parseMessage :: Text -> Maybe.Maybe Message
- pathToBlockId :: IO.FilePath -> Id.BlockId
Documentation
Index into the audio chunks for a single instrument render.
This is the same as ChunkNum
.
getLogFilename :: String -> IO.IO IO.FilePath Source #
config :: Path.AppDir -> Config Source #
Synth | |
|
samplerRoot :: Path.Relative Source #
Base directory for sampler patches.
unsafeSamplerRoot :: IO.FilePath Source #
This is samplerRoot, but as an absolute path.
Technically, Path.get_app_dir is in IO, so I can't get an absolute path without IO. However, I need to put the absolute path in the Thru play msgs (ultimately since play_cache runs with an unknown CWD), and it gets really annoying to try to get a Path.AppDir into the thru function's closure. So unsafePerformIO it is. I could probably just put that on app_dir, but this is the only thing that actually needs it.
notesParentDir :: IO.FilePath Source #
All serialized notes are in im / notesParentDir.
cacheDir :: IO.FilePath Source #
All rendered output is in im / cacheDir.
samplingRate :: Int Source #
All im synths render at this sampling rate, and the sequencer sets the start time by it.
type SamplingRate = 44100 Source #
chunkSize :: AudioT.Frames Source #
Save an audio chunk and checkpoint in this many frames.
A smaller size will lead to more checkpoints, which means finer grained caching, but more overhead saving the intermediate states. So a slower synthesizer with smaller state should use small chunks, fast rendering or large state imply large chunks. I could in theory adjust this per synthesizer, though currently karya relies on it being constant.
blockSize :: AudioT.Frames Source #
Number of frames in each audio block. A chunk corresponds to the output file size, and the block is the internal processing size.
To make sure checkpoint states line up with the file boundaries, this must
divide into chunkSize
.
chunkSeconds :: Int Source #
startLatency :: AudioT.Frames Source #
play_cache delays play start by this many frames, so MIDI output should also be delayed by this much to match.
It has to cue up the sample streaming, which means it has to find and seek to the right file. If playback starts immediately then the first chunk gets cut off, which cuts off note attacks.
cache files
:: IO.FilePath | |
-> IO.FilePath | Path to the score, relative to the save dir. This should uniquely identify this score. |
-> Id.BlockId | |
-> Synth | |
-> IO.FilePath |
Write serialized notes to this file.
notesDirectory :: IO.FilePath -> IO.FilePath -> Id.BlockId -> IO.FilePath Source #
outputDirectory :: IO.FilePath -> IO.FilePath -> Id.BlockId -> IO.FilePath Source #
Top level output for for a block render. It will have directories below it for each instrument.
chunkPath :: IO.FilePath -> IO.FilePath -> Id.BlockId -> ScoreT.Instrument -> ChunkNum -> IO.FilePath Source #
Get the filename for a particular checkpoint.
chunkName :: ChunkNum -> IO.FilePath Source #
isOutputLink :: IO.FilePath -> Maybe.Maybe ChunkNum Source #
This relies on the format from chunkName
.
playFilename :: IO.FilePath -> Id.BlockId -> IO.FilePath Source #
This is text sent over MIDI to tell play_cache which directory to play from. Relative to imDir/cacheDir.
idFilename :: Id.Ident a => a -> IO.FilePath Source #
clearUnusedInstruments :: IO.FilePath -> HashSet ScoreT.Instrument -> IO.IO () Source #
Delete output links for instruments that have disappeared entirely. This often happens when I disable a track.
instrumentToDir :: ScoreT.Instrument -> IO.FilePath Source #
There is a subdirectory for each instrument. There has to be a direct correspondance with ScoreT.Instrument, because clearUnusedInstruments uses it.
listDir :: IO.FilePath -> IO.IO [IO.FilePath] Source #
progress
Message | |
|
Instances
RenderingRange !RealTime !RealTime | |
WaveformsCompleted ![ChunkNum] | Completed waveforms. |
Warn !Stack.Stack !Text | |
Failure !Text | A failure will cause karya to log the msg and mark the track as
incomplete. It should be fatal, so don't do any |
Instances
emitMessage :: HasCallStack => Message -> IO.IO () Source #
parseMessage :: Text -> Maybe.Maybe Message Source #
pathToBlockId :: IO.FilePath -> Id.BlockId Source #
Infer namespace/block from ...imcache$scorePath$scoreFname$namespace$block/$instrument