Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rp2040 Chord Vco
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
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sdiy
rp2040 Chord Vco
Commits
8768cfd9
Commit
8768cfd9
authored
2 years ago
by
David Huss
Browse files
Options
Downloads
Patches
Plain Diff
Make waveform modes wrap around
parent
90ba64ae
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Soft/Rp2040/Rp2040.ino
+14
-9
14 additions, 9 deletions
Soft/Rp2040/Rp2040.ino
with
14 additions
and
9 deletions
Soft/Rp2040/Rp2040.ino
+
14
−
9
View file @
8768cfd9
...
...
@@ -6,6 +6,7 @@
#define FREQ_POT_PIN 27
#define INVERSION_PIN 28
#define CHORD_POT_PIN 29
#define DEBUG_MODE false
// 0-4=chord osc , 5=bass osc , 6=arpeggio osc
float
osc_progress
[
6
];
...
...
@@ -102,7 +103,7 @@ void setup() {
pinMode
(
PUSHBUTTON_PIN
,
INPUT_PULLUP
);
//push sw
// Create the waveform and put it into the wavetable
wavetable_populate
();
wavetable_populate
(
waveform_selection
);
quantizer_select
();
//-------------------octave select-------------------------------
for
(
int
i
=
0
;
i
<
1230
;
i
++
)
{
//Covers 6(=1230) octaves. If it is 1230 or more, the operation becomes unstable.
...
...
@@ -178,10 +179,12 @@ void loop() {
osc_freq
=
freq_table
[
qnt
[
thr
]
+
freq_pot
];
// V/oct apply
osc_freq
=
256
*
osc_freq
/
122070
*
8
;
//7 is base octave
if
(
DEBUG_MODE
)
{
Serial
.
print
(
analogRead
(
VOCT_PIN
));
Serial
.
print
(
","
);
Serial
.
print
(
adc
);
Serial
.
println
(
""
);
}
// -------------------chord mode select-------------------------------
chord_mode
=
analogRead
(
CHORD_POT_PIN
)
/
171
;
//171=1023/6 , 6 is amount of chord mode
...
...
@@ -368,9 +371,11 @@ void loop() {
push_sw
=
digitalRead
(
PUSHBUTTON_PIN
);
// TODO: Add propper debouncing for the button here
if
(
push_sw
==
0
&&
old_push_sw
==
1
)
{
//when push sw ON
// Change the selected waveform and ensure the selection is within bounds
waveform_selection
=
min
(
waveform_selection
+
1
,
6
);
wavetable_populate
();
// Change the selected waveform and ensure the selection is within bounds+1
waveform_selection
=
min
(
waveform_selection
+
1
,
8
);
// Wrap around if we are around the last element
if
(
waveform_selection
==
8
)
{
waveform_selection
=
0
;
}
wavetable_populate
(
waveform_selection
);
}
}
...
...
@@ -419,7 +424,7 @@ void quantizer_select(){
}
// Populate the wavetable with values
void
wavetable_populate
()
{
void
wavetable_populate
(
int
waveform_selection
)
{
switch
(
waveform_selection
)
{
// Sawtooth wave
case
0
:
...
...
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