Karya, built on 2023-08-29T07:47:28 (patch 7a412d5d6ba4968ca4155ef276a062ccdeb9109a)
Safe HaskellSafe-Inferred

Synth.Shared.Config

Description

Shared config to coordinate between the sequencer and im subsystems.

Synopsis

Documentation

type ChunkNum = Int Source #

Index into the audio chunks for a single instrument render. This is the same as ChunkNum.

data Config Source #

Constructors

Config 

Fields

  • imDir :: IO.FilePath

    All of the data files used by the Im backend are based in this directory. Everything in here should be temporary files, used for communication or caching.

  • synths :: Map SynthName Synth
     

Instances

Instances details
Show Config Source # 
Instance details

Defined in Synth.Shared.Config

Eq Config Source # 
Instance details

Defined in Synth.Shared.Config

Methods

(==) :: Config -> Config -> Bool #

(/=) :: Config -> Config -> Bool #

data Synth Source #

Constructors

Synth 

Fields

Instances

Instances details
Show Synth Source # 
Instance details

Defined in Synth.Shared.Config

Methods

showsPrec :: Int -> Synth -> ShowS #

show :: Synth -> String #

showList :: [Synth] -> ShowS #

Eq Synth Source # 
Instance details

Defined in Synth.Shared.Config

Methods

(==) :: Synth -> Synth -> Bool #

(/=) :: Synth -> Synth -> Bool #

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.

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

notesFilename Source #

Arguments

:: 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.

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.

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.

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.

progress

data Message Source #

Instances

Instances details
Generics.Generic Message Source # 
Instance details

Defined in Synth.Shared.Config

Associated Types

type Generics.Rep Message :: Type -> Type #

Show Message Source # 
Instance details

Defined in Synth.Shared.Config

FromJSON Message Source # 
Instance details

Defined in Synth.Shared.Config

ToJSON Message Source # 
Instance details

Defined in Synth.Shared.Config

type Generics.Rep Message Source # 
Instance details

Defined in Synth.Shared.Config

data Payload Source #

Constructors

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 emitMessage afterwards.

Instances

Instances details
Generics.Generic Payload Source # 
Instance details

Defined in Synth.Shared.Config

Associated Types

type Generics.Rep Payload :: Type -> Type #

Show Payload Source # 
Instance details

Defined in Synth.Shared.Config

FromJSON Payload Source # 
Instance details

Defined in Synth.Shared.Config

ToJSON Payload Source # 
Instance details

Defined in Synth.Shared.Config

type Generics.Rep Payload Source # 
Instance details

Defined in Synth.Shared.Config

type Generics.Rep Payload = Generics.D1 ('Generics.MetaData "Payload" "Synth.Shared.Config" "main" 'False) ((Generics.C1 ('Generics.MetaCons "RenderingRange" 'Generics.PrefixI 'False) (Generics.S1 ('Generics.MetaSel ('Maybe.Nothing :: Maybe.Maybe Symbol) 'Generics.NoSourceUnpackedness 'Generics.SourceStrict 'Generics.DecidedStrict) (Generics.Rec0 RealTime) Generics.:*: Generics.S1 ('Generics.MetaSel ('Maybe.Nothing :: Maybe.Maybe Symbol) 'Generics.NoSourceUnpackedness 'Generics.SourceStrict 'Generics.DecidedStrict) (Generics.Rec0 RealTime)) Generics.:+: Generics.C1 ('Generics.MetaCons "WaveformsCompleted" 'Generics.PrefixI 'False) (Generics.S1 ('Generics.MetaSel ('Maybe.Nothing :: Maybe.Maybe Symbol) 'Generics.NoSourceUnpackedness 'Generics.SourceStrict 'Generics.DecidedStrict) (Generics.Rec0 [ChunkNum]))) Generics.:+: (Generics.C1 ('Generics.MetaCons "Warn" 'Generics.PrefixI 'False) (Generics.S1 ('Generics.MetaSel ('Maybe.Nothing :: Maybe.Maybe Symbol) 'Generics.NoSourceUnpackedness 'Generics.SourceStrict 'Generics.DecidedStrict) (Generics.Rec0 Stack.Stack) Generics.:*: Generics.S1 ('Generics.MetaSel ('Maybe.Nothing :: Maybe.Maybe Symbol) 'Generics.NoSourceUnpackedness 'Generics.SourceStrict 'Generics.DecidedStrict) (Generics.Rec0 Text)) Generics.:+: Generics.C1 ('Generics.MetaCons "Failure" 'Generics.PrefixI 'False) (Generics.S1 ('Generics.MetaSel ('Maybe.Nothing :: Maybe.Maybe Symbol) 'Generics.NoSourceUnpackedness 'Generics.SourceStrict 'Generics.DecidedStrict) (Generics.Rec0 Text))))

pathToBlockId :: IO.FilePath -> Id.BlockId Source #

Infer namespace/block from ...imcache$scorePath$scoreFname$namespace$block/$instrument