Code Monkey home page Code Monkey logo

syzygy's Introduction

S Y Z Y G Y

Syzygy is a timed event dispatching engine for live-coding AV systems.

It aims to be a robust and extensible reimplementation of the TidalCycles pattern engine.

syzygy's People

Contributors

sleexyz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

syzygy's Issues

Exploit free monoid to defer monoidal computations

Currently, embedded in the type of Signal is a free monoid:

newtype Signal a = mkSignal { signal :: Interval -> [a] }

This means we have all the means to defer monoidal operations until we actually process the data.

Support Deterministic Randomness

The best solution in my mind is to use a PRNG. Then we can build deterministic "coin flip" signals, without losing out on referential transparency (and therefore the ability to extract events at different sample rates in parallel, etc)

Composable Backends, via ParamMap

Syzygy backends should be nicely composable.

One way is to define a shared datatype for all backends (Map String (Float | String | Int)), and have each backend know how to consume that datatype.

Implement a clock drift correcting mechanism

We should start with a test that for a continuously running signal querying process, there is no clock drift.

TODO:

  • Write a way to test clock drift
  • implement clock drift correcting mechanism
  • figure out what happens when bpm changes
  • investigate if now absolute timestamps are better than relative timestamps for the MIDI backend

MIDI Backend

Output

  • Support basic MIDI out
  • Support sending NoteOn and NoteOff
  • Support sending Control messages
  • Support multiple channels
  • Allow sub midi clock tick precision.

Input

  • Support MIDI in (dynamic patterns!)

SuperDirt Backend

  • Connect to SuperDirt
  • Support sound
  • Absolute Timestamps
  • Support n
  • Support speed

MIDI Backend - Ensure new NoteOn's cancel previous NoteOff's

Pathological case:

Given the following code, sig1 will have audio for the entire beat, while sig2 will "blip" mometarily. That is because in sig2, the NoteOff of the short event fires right after the second NoteOn fires.

sig1 :: Signal Word8
sig1 = mconcat
  [ embed 60 
  ]

sig2 :: Signal Word8
sig2 = mconcat
  [ embed 60
  , shift (-0.01) $ nest [ embed 60, mempty, mempty, mempty, mempty, mempty, mempty, mempty ]
  ]

The desired behavior of sig2 is the sound that gets drawn out for the entire beat, i.e. that the early NoteOff gets cancelled.

Otherwise, brief events will be penalize the user by interrupting their long events.

Figure out applicative semantics

pure

Do we really want pure to be a periodic embedding in time?
ec6f2b8#diff-1dac8f014dcbad886e10623e125742adR16

If it is a single-time event, then

  • what is its support?
    • [0, 1]? Why?
    • [0, infinity]? How do we encode that?

<*>

I'm not really comfortable with the current semantics of ap to be the applicative binary operator.

Example: ec6f2b8#diff-0951c5a3c5a6aa64b078d2fd55e035b6R110

ap right now throws out the temporal structure of the left signal, in favor of the right one. That is, we toss out the time data associated with the events of the left signal. The only
thing we keep from the left signal is the multiplicity of events, simply captured in a list.


https://en.wikibooks.org/wiki/Haskell/Applicative_functors#ZipList comes to mind as a lawful applicative instance that is what we're looking for, since pure is a periodic lifting.

So the focus instead should be on defining a zip :: Signal a -> Signal b -> Signal (a, b) instead.

Proposal: `type Signal e m a = ReaderT (Rational, Rational) (WriterT ([Event e]) m)) a`

Originally posed as a solution to #14


In order to embed IO actions that affect the actual signal graph, i.e. aleatoric signal transformers, we need to make our signal type monadic. This approach deviates from Tidal in that we introduce a new type parameter, rather than riding on top of the Event type parameter.

Pros:

  • dynamic signal transformers

Cons:

  • event extraction is no longer guaranteed deterministic, if the underlying monad is non-deterministic.
  • this means if IO is somewhere in the base monad, we can only extract events once.
    • No concurrent backends for different render targets.
    • No non-realtime event visualization

This is how the type change would look like:

Current implementation

type Signal e = (Rational, Rational) -> [Event e]

Proposed implementation

type Signal e a = (Rational, Rational) -> ([Event e], a)

or

type Signal e m a = (Rational, Rational) -> ([Event e], m a)

Do we use mtl, and get something like the following?

type Signal e m a = ReaderT (Rational, Rational) (WriterT ([Event e]) m) a

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.