step_sequencer 1.0.9 → 1.1.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/lib/step_sequencer/repl.rb +142 -3
- data/lib/step_sequencer/sound_builder/default_effects/combine.rb +1 -1
- data/lib/step_sequencer/sound_builder/default_effects/gain.rb +1 -1
- data/lib/step_sequencer/sound_builder/default_effects/loop.rb +1 -1
- data/lib/step_sequencer/sound_builder/default_effects/overlay.rb +1 -1
- data/lib/step_sequencer/sound_builder/default_effects/pitch.rb +1 -1
- data/lib/step_sequencer/sound_builder/default_effects/slice.rb +1 -1
- data/lib/step_sequencer/sound_builder/default_effects/speed.rb +1 -1
- data/lib/step_sequencer/sound_builder/effects_component_protocol.rb +1 -1
- data/lib/step_sequencer/sound_builder.rb +1 -1
- data/lib/step_sequencer/sound_player.rb +1 -1
- data/lib/step_sequencer/tests.rb +4 -4
- data/lib/step_sequencer.rb +1 -0
- data/lib/version.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1a99a39b5af66339839e11d3bfeba26a8ed4e90
|
4
|
+
data.tar.gz: a87451ab93c254931775e24a6e6f67504c5293e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1e463dcc91df228ad719392a574ef81f0beb2fb51d0d9ba21a4b3ea33925be0155c49d9af5b204c5768be3151c58cf072efbd31a102a205b0af550216621a37
|
7
|
+
data.tar.gz: 8f7d39fbcb03d282d1708fb4881813fbaaa12b53b310375e87b44a033708f834320ee1d5dc0058cbea1ca30f66353d5e193d5a8838673b9cd4306bfa93dd45e1
|
data/lib/step_sequencer/repl.rb
CHANGED
@@ -3,12 +3,151 @@ class StepSequencer::REPL
|
|
3
3
|
# Makes all the instance methods of Helpers available to REPL
|
4
4
|
# The binding.pry here is not a remnant of bug-hunting,
|
5
5
|
# this is how the REPL starts
|
6
|
-
def self.
|
7
|
-
self::Helpers.new.instance_exec
|
6
|
+
def self.run
|
7
|
+
self::Helpers.new.instance_exec do
|
8
|
+
docs
|
9
|
+
Pry.start(self)
|
10
|
+
end
|
8
11
|
end
|
9
12
|
|
10
13
|
class Helpers
|
11
|
-
|
14
|
+
|
15
|
+
HelpSections = {
|
16
|
+
play: "
|
17
|
+
Usage: play #{"\"<path>\"".blue}
|
18
|
+
- plays the file in its own thread using mpg123
|
19
|
+
- hides the output
|
20
|
+
",
|
21
|
+
combine: "
|
22
|
+
Usage: combine #{"\"[<paths>]\"".blue}
|
23
|
+
- note that this combines them sequentially.
|
24
|
+
for concurrent playback, use overlay
|
25
|
+
- returns a single path.
|
26
|
+
",
|
27
|
+
gain: "
|
28
|
+
Usage: gain #{"\"<path>\"".blue}, #{"<value>".blue}
|
29
|
+
- <value> is a float, e.g. 0.5 for half and 2.0 for double
|
30
|
+
- returns a single path
|
31
|
+
",
|
32
|
+
loop: "
|
33
|
+
Usage: loop #{"\"<path>\"".blue}, #{"<num_times>".blue}
|
34
|
+
- <num_times> can be a int or a float. if it's a float, then the last
|
35
|
+
loop will include only part of the original sample.
|
36
|
+
- returns a single path
|
37
|
+
|
38
|
+
",
|
39
|
+
overlay: "
|
40
|
+
Usage: overlay #{"\"[<paths>]\"".blue}
|
41
|
+
- combines files so they play on top of one another
|
42
|
+
- returns a single path
|
43
|
+
",
|
44
|
+
pitch: "
|
45
|
+
Usage: pitch #{"\"<path>\"".blue}, #{"<value>".blue}, #{"<speed_correct>".blue}
|
46
|
+
- <value> here is a integer/float, e.g. 0.5 for half and 2.0 for double.
|
47
|
+
- <speed_correct> defaults to true. It will prevent the pitch shift from
|
48
|
+
changing the speed.
|
49
|
+
- returns a single path
|
50
|
+
",
|
51
|
+
scale: "
|
52
|
+
Usage: scale #{"\"<path>\"".blue}, #{"<inverse>".blue}
|
53
|
+
- This will generate 12 notes of the equal temperament tuning
|
54
|
+
- <inverse> defaults to false. If true then the generated notes will
|
55
|
+
be downtuned from the original (descending).
|
56
|
+
",
|
57
|
+
slice: "
|
58
|
+
Usage: slice #{"\"<path>\"".blue} #{"<start>".blue} #{"<end>".blue}
|
59
|
+
- <start> and <end> are floats referring to a number of seconds.
|
60
|
+
Providing values of 2.0 and 3.5 would create a 1.5 second slice
|
61
|
+
- returns a single path
|
62
|
+
",
|
63
|
+
speed: "
|
64
|
+
Usage: speed #{"\"<path>\"".blue} #{"<value>".blue}
|
65
|
+
- <value> is a integer/float, e.g. 0.5 for half and 2.0 for double
|
66
|
+
- returns a single path
|
67
|
+
"
|
68
|
+
}
|
69
|
+
|
70
|
+
def docs(section=nil)
|
71
|
+
section = section.to_sym if section
|
72
|
+
if section && (doc = self.class::HelpSections[section])
|
73
|
+
puts HelpSections[section]
|
74
|
+
elsif section
|
75
|
+
puts "
|
76
|
+
docs section #{section} not found.
|
77
|
+
Enter #{"docs".blue} to see a list of sections
|
78
|
+
".red
|
79
|
+
else
|
80
|
+
puts "
|
81
|
+
StepSequencer
|
82
|
+
#{"================"}
|
83
|
+
|
84
|
+
Usage: docs #{"\"command\"".blue}
|
85
|
+
where #{"command".blue} is one of:
|
86
|
+
#{self.class::HelpSections.keys.join(", ")}
|
87
|
+
"
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def builder
|
92
|
+
StepSequencer::SoundBuilder
|
93
|
+
end
|
94
|
+
|
95
|
+
def combine(paths)
|
96
|
+
builder.build(
|
97
|
+
sources: paths, effect: :Combine
|
98
|
+
)
|
99
|
+
end
|
100
|
+
|
101
|
+
def gain(path, val)
|
102
|
+
builder.build(
|
103
|
+
sources: [path], effect: :Gain, args: [value: val]
|
104
|
+
)[0]
|
105
|
+
end
|
106
|
+
|
107
|
+
def loop(path, times)
|
108
|
+
builder.build(
|
109
|
+
sources: [path], effect: :Loop, args: [times: val]
|
110
|
+
)[0]
|
111
|
+
end
|
112
|
+
|
113
|
+
def overlay(paths)
|
114
|
+
builder.build(
|
115
|
+
sources: paths, effect: :Overlay
|
116
|
+
)
|
117
|
+
end
|
118
|
+
|
119
|
+
def pitch(path, val, speed_correct=true)
|
120
|
+
builder.build(
|
121
|
+
sources: [path], effect: :Pitch,
|
122
|
+
args: [{times: val, speed_correction: speed_correct}]
|
123
|
+
)[0]
|
124
|
+
end
|
125
|
+
|
126
|
+
def scale(path, inverse)
|
127
|
+
builder.build(
|
128
|
+
sources: [path], effect: :Scale,
|
129
|
+
args: [{scale: :equal_temperament, inverse: inverse}]
|
130
|
+
)[0]
|
131
|
+
end
|
132
|
+
|
133
|
+
def slice(path, start_time, end_time)
|
134
|
+
builder.build(
|
135
|
+
sources: [path], effect: :Slice,
|
136
|
+
args: [{start_time: start_time, end_time: end_time}]
|
137
|
+
)[0]
|
138
|
+
end
|
139
|
+
|
140
|
+
def speed(path, val)
|
141
|
+
builder.build(
|
142
|
+
sources: [path], effect: :Speed,
|
143
|
+
args: [{value: val}]
|
144
|
+
)[0]
|
145
|
+
end
|
146
|
+
|
147
|
+
def play(path)
|
148
|
+
Thread.new { `mpg123 #{path} 2> /dev/null` }
|
149
|
+
end
|
150
|
+
|
12
151
|
end
|
13
152
|
|
14
153
|
end
|
data/lib/step_sequencer/tests.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# =============================================================================
|
2
2
|
# A custom test runner. The tests themselves are in test_cases.rb
|
3
3
|
# Usage: StepSequencer::Tests.run
|
4
|
-
# The
|
4
|
+
# The public method run_test_collection can also be used; it's more modular.
|
5
5
|
# =============================================================================
|
6
6
|
|
7
7
|
class StepSequencer::Tests
|
@@ -24,13 +24,13 @@ class StepSequencer::Tests
|
|
24
24
|
# shared 'around' hook for tests
|
25
25
|
def self.run_test_case(test_class, fn_name, test_case)
|
26
26
|
speak_fn_name fn_name
|
27
|
-
puts fn_name
|
27
|
+
puts fn_name.yellow
|
28
28
|
test_class.method(fn_name).source.display
|
29
29
|
test_case.call
|
30
30
|
end
|
31
31
|
|
32
32
|
class << self
|
33
|
-
|
33
|
+
public
|
34
34
|
|
35
35
|
def builder_tests
|
36
36
|
StepSequencer::Tests::TestCases::Builder
|
@@ -86,7 +86,7 @@ class StepSequencer::Tests
|
|
86
86
|
|
87
87
|
# Helpers made available to test cases (if they include the module)
|
88
88
|
module TestCaseHelpers
|
89
|
-
|
89
|
+
public
|
90
90
|
def asset_path(name)
|
91
91
|
Gem.find_files("step_sequencer/test_assets/#{name}.mp3")[0]
|
92
92
|
end
|
data/lib/step_sequencer.rb
CHANGED
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: step_sequencer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- max pleaner
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.10'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: colored
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.2'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.2'
|
69
83
|
description: ''
|
70
84
|
email: maxpleaner@gmail.com
|
71
85
|
executables:
|