https://github.com/diegovdc/time-time
A Polychronic library for precisely sequencing events in time.
https://github.com/diegovdc/time-time
live-coding music polychrony polyrhythms rhythm sequencer time
Last synced: about 1 month ago
JSON representation
A Polychronic library for precisely sequencing events in time.
- Host: GitHub
- URL: https://github.com/diegovdc/time-time
- Owner: diegovdc
- License: epl-1.0
- Created: 2019-06-28T04:01:43.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2025-09-18T19:41:33.000Z (9 months ago)
- Last Synced: 2026-05-12T23:44:32.470Z (about 1 month ago)
- Topics: live-coding, music, polychrony, polyrhythms, rhythm, sequencer, time
- Language: Clojure
- Homepage:
- Size: 1.66 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# time-tiem
A Polychronic library for precisely sequencing events in time.
The aim of `time-tiem` is to develop low-ish level composable functions for the flexible development of higher level sequencers that can do anything from common sequencing tasks to highly coordinated polytemporality.
The aim includes the development of such higher level constructs.
It is important to note that these sequencing tools are agnostic of medium, so it is possible to sequence audio, video, text or whichever thing that can be put into a function call.
## Usage
### ref-rain
The focus of `ref-rain` is to provide a good live coding experience by allowing the sequencer to be modified in real time without losing track of the following events in it's timeline.
``` clojure
(require '[time-time.dynacan.players.gen-poly :as gp])
(gp/ref-rain
:id :my-sequencer ;; identifier of the sequencer, useful when recompiling (will apply changes on the next event, rather than restarting the sequencer)
:durs [3 2 3 3 2] ;; a vector of durations, this are durations in beats and will run at the tempo specified below.
:tempo 120
:ratio 1 ;; `1/2` will make everything run twice as fast, etc.
:on-event (fn [{:keys [data]}]
;; `data` is the current event data and will print something like:
#_{:durs [3 2 3 3 2]
:index 0
:started-at 1660746728661
:current-event {:dur 3, :event-dur 1500N}
:playing? true
:ratio 1
:dur 3
:on-event (fn [] #_some-function)}
(println data)))
(gp/stop :my-sequencer) ;; stop this sequencer
(gp/stop) ;; stop all sequencers
```
The `on-event` macro is useful for accessing the most commonly required values of an event, and provides the at-index function:
``` clojure
(gp/ref-rain
:id :my-sequencer-2
:durs [3 2 3 3 2]
:tempo 120
:on-event (gp/on-event
;; notice that we just need to pass a function call to execute
(println index
dur ;; event dur as stated in the durs vector
dur-ms ;; duration converted to milliseconds
(at-index [:one :two :three]) ; provided by on-event, get the value at index, will wrap using `mod` if index overflows
(keys data))))
(gp/stop)
```
## Note
This library is a work in progress and mostly a workshop for myself, so the code is not polished as it should. If you are using this library, feel free to let make me aware of so that I can take more care of the code and the documentation.
## License
This program and the accompanying materials are made available under the
terms of the Eclipse Public License 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the Eclipse
Public License, v. 2.0 are satisfied: GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or (at your
option) any later version, with the GNU Classpath Exception which is available
at https://www.gnu.org/software/classpath/license.html.