cyclotone 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +8 -74
- data/Rakefile +37 -1
- data/cyclotone.gemspec +16 -3
- data/exe/cyclotone +12 -0
- data/lib/cyclotone/backends/midi_backend.rb +106 -21
- data/lib/cyclotone/backends/midi_file_backend.rb +182 -24
- data/lib/cyclotone/backends/midi_message_support.rb +111 -28
- data/lib/cyclotone/backends/null_backend.rb +33 -0
- data/lib/cyclotone/backends/osc_backend.rb +105 -17
- data/lib/cyclotone/controls.rb +64 -16
- data/lib/cyclotone/dsl.rb +5 -5
- data/lib/cyclotone/errors.rb +8 -3
- data/lib/cyclotone/event.rb +38 -3
- data/lib/cyclotone/harmony.rb +62 -8
- data/lib/cyclotone/mini_notation/ast.rb +85 -5
- data/lib/cyclotone/mini_notation/compiler.rb +18 -10
- data/lib/cyclotone/mini_notation/parser.rb +168 -34
- data/lib/cyclotone/oscillators.rb +130 -28
- data/lib/cyclotone/pattern.rb +211 -36
- data/lib/cyclotone/scheduler.rb +179 -40
- data/lib/cyclotone/state.rb +0 -1
- data/lib/cyclotone/stream.rb +91 -45
- data/lib/cyclotone/support/deterministic.rb +37 -1
- data/lib/cyclotone/time_span.rb +29 -7
- data/lib/cyclotone/transforms/accumulation.rb +28 -5
- data/lib/cyclotone/transforms/alteration.rb +82 -18
- data/lib/cyclotone/transforms/condition.rb +15 -3
- data/lib/cyclotone/transforms/sample.rb +33 -9
- data/lib/cyclotone/transforms/time.rb +24 -5
- data/lib/cyclotone/transition.rb +54 -42
- data/lib/cyclotone/version.rb +1 -1
- data/lib/cyclotone.rb +1 -0
- data/sig/cyclotone.rbs +99 -0
- metadata +4 -1
data/sig/cyclotone.rbs
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
module Cyclotone
|
|
2
|
+
class Error < StandardError
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
class InvalidRationalError < Error
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
class TimeSpan
|
|
9
|
+
attr_reader start: Rational
|
|
10
|
+
attr_reader stop: Rational
|
|
11
|
+
|
|
12
|
+
def initialize: (untyped start_time, untyped stop_time) -> void
|
|
13
|
+
def duration: () -> Rational
|
|
14
|
+
def midpoint: () -> Rational
|
|
15
|
+
def cycle_number: () -> Integer
|
|
16
|
+
def intersection: (untyped other) -> TimeSpan?
|
|
17
|
+
def includes?: (untyped time) -> bool
|
|
18
|
+
def cycle_spans: (?max_cycles: Integer?) -> Array[TimeSpan]
|
|
19
|
+
def each_cycle_span: (?max_cycles: Integer?) { (TimeSpan) -> void } -> self
|
|
20
|
+
def shift: (untyped amount) -> TimeSpan
|
|
21
|
+
def scale: (untyped factor) -> TimeSpan
|
|
22
|
+
def reverse_within: (untyped cycle_start, ?untyped cycle_length) -> TimeSpan
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
class Event
|
|
26
|
+
attr_reader whole: TimeSpan?
|
|
27
|
+
attr_reader part: TimeSpan
|
|
28
|
+
attr_reader value: untyped
|
|
29
|
+
|
|
30
|
+
def initialize: (whole: TimeSpan?, part: TimeSpan, value: untyped) -> void
|
|
31
|
+
def onset: () -> Rational?
|
|
32
|
+
def offset: () -> Rational?
|
|
33
|
+
def duration: () -> Rational?
|
|
34
|
+
def active_span: () -> TimeSpan
|
|
35
|
+
def with_value: (untyped new_value) -> Event
|
|
36
|
+
def with_span: (?new_whole: TimeSpan?, ?new_part: TimeSpan, ?whole: TimeSpan?, ?part: TimeSpan) -> Event
|
|
37
|
+
def to_h: () -> Hash[Symbol, untyped]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
class Pattern
|
|
41
|
+
def initialize: (?continuous: bool) { (TimeSpan) -> Array[Event] } -> void
|
|
42
|
+
def continuous?: () -> bool
|
|
43
|
+
def query_span: (untyped span) -> Array[Event]
|
|
44
|
+
def query_cycle: (Integer cycle_number) -> Array[Event]
|
|
45
|
+
def query_point: (untyped time) -> untyped
|
|
46
|
+
def query_points: (untyped time) -> Array[untyped]
|
|
47
|
+
def fmap: () { (untyped) -> untyped } -> Pattern
|
|
48
|
+
def merge: (untyped other) -> Pattern
|
|
49
|
+
def merge_left: (untyped other) -> Pattern
|
|
50
|
+
def merge_right: (untyped other) -> Pattern
|
|
51
|
+
def merge_deep: (untyped other) -> Pattern
|
|
52
|
+
|
|
53
|
+
def self.pure: (untyped value) -> Pattern
|
|
54
|
+
def self.silence: () -> Pattern
|
|
55
|
+
def self.atom_at: (untyped value, at: untyped, ?duration: untyped) -> Pattern
|
|
56
|
+
def self.continuous: (?sample: Symbol) { (untyped) -> untyped } -> Pattern
|
|
57
|
+
def self.mn: (String string) -> Pattern
|
|
58
|
+
def self.try_mn: (String string) -> Pattern?
|
|
59
|
+
def self.fastcat: (Array[untyped] patterns) -> Pattern
|
|
60
|
+
def self.cat: (Array[untyped] patterns) -> Pattern
|
|
61
|
+
def self.stack: (Array[untyped] patterns, ?empty: Symbol) -> Pattern
|
|
62
|
+
def self.ensure_pattern: (untyped value, ?strings: Symbol) -> Pattern
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
module Backends
|
|
66
|
+
class MIDIFileBackend
|
|
67
|
+
attr_reader path: String
|
|
68
|
+
attr_reader channel: Integer
|
|
69
|
+
attr_reader ppqn: Integer
|
|
70
|
+
attr_reader bpm: Float
|
|
71
|
+
attr_reader track_mode: Symbol
|
|
72
|
+
|
|
73
|
+
def self.bpm_from_cps: (untyped cps, ?beats_per_cycle: untyped) -> Float
|
|
74
|
+
|
|
75
|
+
def initialize: (
|
|
76
|
+
path: String,
|
|
77
|
+
?bpm: untyped,
|
|
78
|
+
?ppqn: untyped,
|
|
79
|
+
?channel: untyped,
|
|
80
|
+
?track_name: untyped,
|
|
81
|
+
?time_signature: untyped,
|
|
82
|
+
?track_mode: untyped,
|
|
83
|
+
?unsupported_controls: untyped,
|
|
84
|
+
?fractional_notes: untyped
|
|
85
|
+
) -> void
|
|
86
|
+
def begin_capture: (at: untyped) -> self
|
|
87
|
+
def end_capture: () -> self
|
|
88
|
+
def clear: () -> self
|
|
89
|
+
def tempo_change: (at: untyped, bpm: untyped) -> self
|
|
90
|
+
def time_signature_change: (at: untyped, numerator: untyped, denominator: untyped) -> self
|
|
91
|
+
def send_event: (Event event, ?at: untyped, ?cps: untyped, ?slot_id: untyped, **untyped) -> self
|
|
92
|
+
def write!: () -> String
|
|
93
|
+
def flush: () -> self
|
|
94
|
+
def close: () -> self
|
|
95
|
+
def panic: () -> self
|
|
96
|
+
def midi_file_data: () -> String
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cyclotone
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yudai Takada
|
|
@@ -27,6 +27,7 @@ files:
|
|
|
27
27
|
- lib/cyclotone/backends/midi_backend.rb
|
|
28
28
|
- lib/cyclotone/backends/midi_file_backend.rb
|
|
29
29
|
- lib/cyclotone/backends/midi_message_support.rb
|
|
30
|
+
- lib/cyclotone/backends/null_backend.rb
|
|
30
31
|
- lib/cyclotone/backends/osc_backend.rb
|
|
31
32
|
- lib/cyclotone/controls.rb
|
|
32
33
|
- lib/cyclotone/dsl.rb
|
|
@@ -52,6 +53,7 @@ files:
|
|
|
52
53
|
- lib/cyclotone/transforms/time.rb
|
|
53
54
|
- lib/cyclotone/transition.rb
|
|
54
55
|
- lib/cyclotone/version.rb
|
|
56
|
+
- sig/cyclotone.rbs
|
|
55
57
|
homepage: https://github.com/ydah/cyclotone
|
|
56
58
|
licenses:
|
|
57
59
|
- MIT
|
|
@@ -59,6 +61,7 @@ metadata:
|
|
|
59
61
|
source_code_uri: https://github.com/ydah/cyclotone
|
|
60
62
|
changelog_uri: https://github.com/ydah/cyclotone/releases
|
|
61
63
|
rubygems_mfa_required: 'true'
|
|
64
|
+
optional_dependencies: unimidi
|
|
62
65
|
rdoc_options: []
|
|
63
66
|
require_paths:
|
|
64
67
|
- lib
|