csound-expression-typed-0.2.7.1: typed core for the library csound-expression
Safe HaskellSafe-Inferred
LanguageHaskell2010

Csound.Typed.Control.InstrRef

Description

Imperative csound instruments

Synopsis

Documentation

data InstrRef a Source #

Instrument reference. we can invoke or stop the instrument by the identifier.

newInstr :: Arg a => (a -> SE ()) -> SE (InstrRef a) Source #

Creates a new instrument and generates a unique identifier.

scheduleEvent :: Arg a => InstrRef a -> D -> D -> a -> SE () Source #

Schedules an event for the instrument.

scheduleEvent instrRef delay duration args

The arguments for time values are set in seconds.

turnoff2 :: InstrRef a -> Sig -> Sig -> SE () Source #

Turns off the note played on the given instrument. Use fractional instrument reference to turn off specific instance.

turnoff2 instrRef mode releaseTime

The mode is sum of the following values:

  • 0, 1, or 2: turn off all instances (0), oldest only (1), or newest only (2)
  • 4: only turn off notes with exactly matching (fractional) instrument number, rather than ignoring fractional part
  • 8: only turn off notes with indefinite duration (idur < 0 or MIDI)

releaseTime if non-zero, the turned off instances are allowed to release, otherwise are deactivated immediately (possibly resulting in clicks).

negateInstrRef :: InstrRef a -> InstrRef a Source #

Negates the instrument identifier. This trick is used in Csound to update the instrument arguments while instrument is working.

addFracInstrRef :: D -> D -> InstrRef a -> InstrRef a Source #

Adds fractional part to the instrument reference. This trick is used in Csound to identify the notes (or specific instrument invokation).

newOutInstr :: (Arg a, Sigs b) => (a -> SE b) -> SE (InstrRef a, b) Source #

Creates an insturment that produces a value.

noteOn :: Arg a => D -> D -> InstrRef a -> a -> SE () Source #

Triggers a note with fractional instrument reference. We can later stop the instrument on specific note with function noteOff.

noteOff :: (Default a, Arg a) => D -> D -> InstrRef a -> SE () Source #

Stops a note with fractional instrument reference.