Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
flow3r firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
highTower
flow3r firmware
Commits
b25433dc
Commit
b25433dc
authored
1 year ago
by
moon2
Browse files
Options
Downloads
Patches
Plain Diff
bl00mbox: simple drums track length somewhat dynamic
parent
6ca136fa
Branches
moon2_applications
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
python_payload/apps/simple_drums/__init__.py
+40
-25
40 additions, 25 deletions
python_payload/apps/simple_drums/__init__.py
python_payload/bl00mbox/_patches.py
+3
-2
3 additions, 2 deletions
python_payload/bl00mbox/_patches.py
with
43 additions
and
27 deletions
python_payload/apps/simple_drums/__init__.py
+
40
−
25
View file @
b25433dc
...
@@ -41,17 +41,24 @@ class SimpleDrums(Application):
...
@@ -41,17 +41,24 @@ class SimpleDrums(Application):
super
().
__init__
(
app_ctx
)
super
().
__init__
(
app_ctx
)
# ctx.rgb(0, 0, 0).rectangle(-120, -120, 240, 240).fill()
# ctx.rgb(0, 0, 0).rectangle(-120, -120, 240, 240).fill()
self
.
blm
=
bl00mbox
.
Channel
()
self
.
blm
=
bl00mbox
.
Channel
()
self
.
seq
=
self
.
blm
.
new
(
bl00mbox
.
patches
.
step_sequencer
)
self
.
num_samplers
=
3
self
.
hat
=
self
.
blm
.
new
(
bl00mbox
.
patches
.
s
ampler
,
"
hihat.wav
"
)
self
.
seq
=
self
.
blm
.
new
(
bl00mbox
.
patches
.
s
tep_sequencer
,
self
.
num_samplers
)
# Dot(10, 10, -30, 0, self._track_col(0)).draw(0,ctx)
self
.
kick
=
self
.
blm
.
new
(
bl00mbox
.
patches
.
sampler
,
"
kick.wav
"
)
self
.
kick
=
self
.
blm
.
new
(
bl00mbox
.
patches
.
sampler
,
"
kick.wav
"
)
# Dot(20, 20, 0, 40, self._track_col(1)).draw(0,ctx)
self
.
hat
=
self
.
blm
.
new
(
bl00mbox
.
patches
.
sampler
,
"
hihat.wav
"
)
self
.
snare
=
self
.
blm
.
new
(
bl00mbox
.
patches
.
sampler
,
"
snare.wav
"
)
self
.
close
=
self
.
blm
.
new
(
bl00mbox
.
patches
.
sampler
,
"
hihat.wav
"
)
# Dot(30, 30, 2, -20, self._track_col(2)).draw(0,ctx)
#self.ride = self.blm.new(bl00mbox.patches.sampler, "hihat.wav")
#self.crash = self.blm.new(bl00mbox.patches.sampler, "kick.wav")
#self.snare = self.blm.new(bl00mbox.patches.sampler, "snare.wav")
self
.
kick
.
sampler
.
signals
.
trigger
=
self
.
seq
.
seqs
[
0
].
signals
.
output
self
.
kick
.
sampler
.
signals
.
trigger
=
self
.
seq
.
seqs
[
0
].
signals
.
output
self
.
hat
.
sampler
.
signals
.
trigger
=
self
.
seq
.
seqs
[
1
].
signals
.
output
self
.
hat
.
sampler
.
signals
.
trigger
=
self
.
seq
.
seqs
[
1
].
signals
.
output
self
.
snare
.
sampler
.
signals
.
trigger
=
self
.
seq
.
seqs
[
2
].
signals
.
output
self
.
close
.
sampler
.
signals
.
trigger
=
self
.
seq
.
seqs
[
2
].
signals
.
output
self
.
track_names
=
[
"
kick
"
,
"
hihat
"
,
"
snare
"
]
#self.ride.sampler.signals.trigger = self.seq.seqs[3].signals.output
#self.crash.sampler.signals.trigger = self.seq.seqs[4].signals.output
#self.snare.sampler.signals.trigger = self.seq.seqs[5].signals.output
self
.
track_names
=
[
"
kick
"
,
"
hihat
"
,
"
close
"
,
"
ride
"
,
"
crash
"
,
"
snare
"
]
self
.
ct_prev
=
captouch
.
read
()
self
.
ct_prev
=
captouch
.
read
()
self
.
track
=
0
self
.
track
=
0
self
.
seq
.
bpm
=
80
self
.
seq
.
bpm
=
80
...
@@ -68,11 +75,17 @@ class SimpleDrums(Application):
...
@@ -68,11 +75,17 @@ class SimpleDrums(Application):
def
_track_col
(
self
,
track
:
int
)
->
Tuple
[
int
,
int
,
int
]:
def
_track_col
(
self
,
track
:
int
)
->
Tuple
[
int
,
int
,
int
]:
rgb
=
(
20
,
20
,
20
)
rgb
=
(
20
,
20
,
20
)
if
track
==
0
:
if
track
==
0
:
rgb
=
(
0
,
255
,
0
)
rgb
=
(
12
0
,
0
,
137
)
elif
track
==
1
:
elif
track
==
1
:
rgb
=
(
0
,
0
,
255
)
rgb
=
(
0
,
75
,
255
)
elif
track
==
2
:
elif
track
==
2
:
rgb
=
(
255
,
0
,
0
)
rgb
=
(
0
,
130
,
27
)
elif
track
==
3
:
rgb
=
(
255
,
239
,
0
)
elif
track
==
4
:
rgb
=
(
255
,
142
,
0
)
elif
track
==
5
:
rgb
=
(
230
,
0
,
0
)
return
rgb
return
rgb
def
draw
(
self
,
ctx
:
Context
)
->
None
:
def
draw
(
self
,
ctx
:
Context
)
->
None
:
...
@@ -83,7 +96,7 @@ class SimpleDrums(Application):
...
@@ -83,7 +96,7 @@ class SimpleDrums(Application):
dots
.
append
(
dots
.
append
(
Dot
(
Dot
(
48
+
groupgap
,
48
+
groupgap
,
40
,
10
+
10
*
self
.
num_samplers
,
int
((
12
*
4
+
groupgap
)
*
(
1.5
-
i
)),
int
((
12
*
4
+
groupgap
)
*
(
1.5
-
i
)),
0
,
0
,
(
0.15
,
0.15
,
0.15
),
(
0.15
,
0.15
,
0.15
),
...
@@ -91,10 +104,10 @@ class SimpleDrums(Application):
...
@@ -91,10 +104,10 @@ class SimpleDrums(Application):
)
)
st
=
self
.
seq
.
seqs
[
0
].
signals
.
step
.
value
st
=
self
.
seq
.
seqs
[
0
].
signals
.
step
.
value
for
track
in
range
(
3
):
for
track
in
range
(
self
.
num_samplers
):
rgb
=
self
.
_track_col
(
track
)
rgb
=
self
.
_track_col
(
track
)
rgbf
=
(
rgb
[
0
]
/
256
,
rgb
[
1
]
/
256
,
rgb
[
2
]
/
256
)
rgbf
=
(
rgb
[
0
]
/
256
,
rgb
[
1
]
/
256
,
rgb
[
2
]
/
256
)
y
=
12
*
(
track
-
1
)
y
=
int
(
12
*
(
track
-
(
self
.
num_samplers
-
1
)
/
2
)
)
for
i
in
range
(
16
):
for
i
in
range
(
16
):
trigger_state
=
self
.
seq
.
trigger_state
(
track
,
i
)
trigger_state
=
self
.
seq
.
trigger_state
(
track
,
i
)
size
=
2
size
=
2
...
@@ -105,11 +118,11 @@ class SimpleDrums(Application):
...
@@ -105,11 +118,11 @@ class SimpleDrums(Application):
x
=
int
(
x
)
x
=
int
(
x
)
dots
.
append
(
Dot
(
size
,
size
,
x
,
y
,
rgbf
))
dots
.
append
(
Dot
(
size
,
size
,
x
,
y
,
rgbf
))
if
(
i
==
st
)
and
(
track
==
0
):
if
(
i
==
st
)
and
(
track
==
0
):
dots
.
append
(
Dot
(
size
/
2
,
size
/
2
,
x
,
24
,
(
1
,
1
,
1
)))
dots
.
append
(
Dot
(
size
/
2
,
size
/
2
,
x
,
15
+
5
*
self
.
num_samplers
,
(
1
,
1
,
1
)))
dots
.
append
(
Dot
(
1
,
4
0
,
0
,
0
,
(
0.5
,
0.5
,
0.5
)))
dots
.
append
(
Dot
(
1
,
7
0
,
0
,
0
,
(
0.5
,
0.5
,
0.5
)))
dots
.
append
(
Dot
(
1
,
4
0
,
4
*
12
+
groupgap
,
0
,
(
0.5
,
0.5
,
0.5
)))
dots
.
append
(
Dot
(
1
,
7
0
,
4
*
12
+
groupgap
,
0
,
(
0.5
,
0.5
,
0.5
)))
dots
.
append
(
Dot
(
1
,
4
0
,
-
4
*
12
-
groupgap
,
0
,
(
0.5
,
0.5
,
0.5
)))
dots
.
append
(
Dot
(
1
,
7
0
,
-
4
*
12
-
groupgap
,
0
,
(
0.5
,
0.5
,
0.5
)))
ctx
.
rgb
(
0
,
0
,
0
).
rectangle
(
-
120
,
-
120
,
240
,
240
).
fill
()
ctx
.
rgb
(
0
,
0
,
0
).
rectangle
(
-
120
,
-
120
,
240
,
240
).
fill
()
for
i
,
dot
in
enumerate
(
dots
):
for
i
,
dot
in
enumerate
(
dots
):
...
@@ -118,15 +131,15 @@ class SimpleDrums(Application):
...
@@ -118,15 +131,15 @@ class SimpleDrums(Application):
ctx
.
font
=
ctx
.
get_font_name
(
4
)
ctx
.
font
=
ctx
.
get_font_name
(
4
)
ctx
.
font_size
=
30
ctx
.
font_size
=
30
ctx
.
move_to
(
0
,
6
5
)
ctx
.
move_to
(
0
,
5
5
)
col
=
[
x
/
255
for
x
in
self
.
_track_col
(
self
.
track
)]
col
=
[
x
/
255
for
x
in
self
.
_track_col
(
self
.
track
)]
ctx
.
rgb
(
*
col
)
ctx
.
rgb
(
*
col
)
ctx
.
text
(
self
.
track_names
[
self
.
track
])
ctx
.
text
(
self
.
track_names
[
self
.
track
])
ctx
.
font_size
=
18
ctx
.
font_size
=
18
ctx
.
move_to
(
0
,
10
2
)
ctx
.
move_to
(
0
,
10
5
)
next_track
=
(
self
.
track
+
1
)
%
3
next_track
=
(
self
.
track
+
1
)
%
self
.
num_samplers
col
=
[
x
/
255
for
x
in
self
.
_track_col
(
next_track
)]
col
=
[
x
/
255
for
x
in
self
.
_track_col
(
next_track
)]
ctx
.
rgb
(
*
col
)
ctx
.
rgb
(
*
col
)
ctx
.
text
(
self
.
track_names
[
next_track
])
ctx
.
text
(
self
.
track_names
[
next_track
])
...
@@ -139,16 +152,18 @@ class SimpleDrums(Application):
...
@@ -139,16 +152,18 @@ class SimpleDrums(Application):
ctx
.
text
(
str
(
self
.
seq
.
bpm
)
+
"
bpm
"
)
ctx
.
text
(
str
(
self
.
seq
.
bpm
)
+
"
bpm
"
)
ctx
.
font_size
=
15
ctx
.
font_size
=
15
ctx
.
rgb
(
0.6
,
0.6
,
0.6
)
ctx
.
move_to
(
0
,
-
85
)
ctx
.
move_to
(
0
,
-
85
)
ctx
.
rgb
(
0.6
,
0.6
,
0.6
)
ctx
.
text
(
"
(hold) stop
"
)
ctx
.
text
(
"
(hold) stop
"
)
ctx
.
move_to
(
0
,
-
100
)
ctx
.
move_to
(
0
,
-
100
)
ctx
.
text
(
"
tap tempo
"
)
ctx
.
text
(
"
tap tempo
"
)
ctx
.
move_to
(
0
,
85
)
ctx
.
move_to
(
0
,
75
)
ctx
.
text
(
"
(hold) clear
"
)
ctx
.
move_to
(
0
,
90
)
ctx
.
text
(
"
next:
"
)
ctx
.
text
(
"
next:
"
)
def
think
(
self
,
ins
:
InputState
,
delta_ms
:
int
)
->
None
:
def
think
(
self
,
ins
:
InputState
,
delta_ms
:
int
)
->
None
:
...
@@ -171,7 +186,7 @@ class SimpleDrums(Application):
...
@@ -171,7 +186,7 @@ class SimpleDrums(Application):
):
):
self
.
seq
.
trigger_toggle
(
self
.
track
,
i
*
4
+
j
)
self
.
seq
.
trigger_toggle
(
self
.
track
,
i
*
4
+
j
)
if
ct
.
petals
[
5
].
pressed
and
not
(
self
.
ct_prev
.
petals
[
5
].
pressed
):
if
ct
.
petals
[
5
].
pressed
and
not
(
self
.
ct_prev
.
petals
[
5
].
pressed
):
self
.
track
=
(
self
.
track
+
1
)
%
3
self
.
track
=
(
self
.
track
-
1
)
%
self
.
num_samplers
if
ct
.
petals
[
0
].
pressed
and
not
(
self
.
ct_prev
.
petals
[
0
].
pressed
):
if
ct
.
petals
[
0
].
pressed
and
not
(
self
.
ct_prev
.
petals
[
0
].
pressed
):
if
self
.
stopped
:
if
self
.
stopped
:
self
.
seq
.
bpm
=
self
.
bpm
self
.
seq
.
bpm
=
self
.
bpm
...
...
This diff is collapsed.
Click to expand it.
python_payload/bl00mbox/_patches.py
+
3
−
2
View file @
b25433dc
...
@@ -149,14 +149,15 @@ class sampler(_Patch):
...
@@ -149,14 +149,15 @@ class sampler(_Patch):
class
step_sequencer
(
_Patch
):
class
step_sequencer
(
_Patch
):
def
__init__
(
self
,
chan
):
def
__init__
(
self
,
chan
,
num_channels
=
4
):
self
.
seqs
=
[]
self
.
seqs
=
[]
for
i
in
range
(
4
):
for
i
in
range
(
num_channels
):
seq
=
chan
.
new_bud
(
56709
)
seq
=
chan
.
new_bud
(
56709
)
seq
.
table
=
[
-
32767
]
+
([
0
]
*
16
)
seq
.
table
=
[
-
32767
]
+
([
0
]
*
16
)
if
len
(
self
.
seqs
):
if
len
(
self
.
seqs
):
self
.
seqs
[
-
1
].
signals
.
sync_out
=
seq
.
signals
.
sync_in
self
.
seqs
[
-
1
].
signals
.
sync_out
=
seq
.
signals
.
sync_in
self
.
seqs
+=
[
seq
]
self
.
seqs
+=
[
seq
]
seq
.
signals
.
bpm
.
value
=
120
self
.
_bpm
=
120
self
.
_bpm
=
120
def
__repr__
(
self
):
def
__repr__
(
self
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment