Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
endless-sequencer
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
rorist
endless-sequencer
Commits
bc57ce02
Commit
bc57ce02
authored
1 year ago
by
rorist
Browse files
Options
Downloads
Patches
Plain Diff
Fixed bpm and don't use sleep for the seq
parent
822f449e
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
__init__.py
+19
-6
19 additions, 6 deletions
__init__.py
with
19 additions
and
6 deletions
__init__.py
+
19
−
6
View file @
bc57ce02
...
...
@@ -40,6 +40,8 @@ class EndlessSequencer(Application):
# 'close.wav' ]
self
.
current_sample
=
None
self
.
current_note
=
0
self
.
startTime
=
time
.
ticks_ms
()
self
.
bpm
=
120
#self.sample_names = ['kick.wav', 'snare.wav', 'cowbell.wav', 'hihat.wav', 'silence.wav']
#self.app_path = '/flash/sys/apps/seq/'
...
...
@@ -135,6 +137,7 @@ class EndlessSequencer(Application):
print
(
'
seq {}
'
.
format
(
self
.
sample_names
[
sample_id
]))
self
.
notes
.
append
(
sample_id
)
self
.
play_sample
(
sample_id
)
time
.
sleep
(
0.2
)
# Light petal
for
i
in
range
(
10
):
...
...
@@ -162,25 +165,35 @@ class EndlessSequencer(Application):
if
len
(
self
.
notes
)
>
0
and
not
ct
.
petals
[
0
].
pressed
:
self
.
play_seq
()
def
next_bpm
(
self
):
# taken from binarybrain code
beatTime
=
60.0
*
1000.0
/
self
.
bpm
curRelTime
=
time
.
ticks_diff
(
time
.
ticks_ms
(),
self
.
startTime
)
return
curRelTime
/
beatTime
>
1
def
play_sample
(
self
,
i
):
self
.
current_sample
=
i
if
i
<
len
(
self
.
samples
):
if
self
.
DEBUG
and
i
in
self
.
sample_names
:
print
(
self
.
sample_names
[
i
])
self
.
samples
[
i
].
signals
.
trigger
.
start
()
time
.
sleep
(
0.2
)
def
play_seq
(
self
):
if
self
.
DEBUG
:
print
(
"
PLAY SEQ
"
)
if
self
.
next_bpm
():
self
.
startTime
=
time
.
ticks_ms
()
if
self
.
current_note
==
len
(
self
.
notes
):
self
.
current_note
=
0
if
self
.
DEBUG
:
print
(
"
play note {}
"
.
format
(
i
))
self
.
play_sample
(
self
.
notes
[
self
.
current_note
])
self
.
play_sample
(
self
.
notes
[
self
.
current_note
])
self
.
current_note
+=
1
else
:
if
self
.
DEBUG
:
print
(
"
wait
"
)
if
__name__
==
"
__main__
"
:
import
st3m.run
...
...
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