Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
daisyy-hardware
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
daisyy
daisyy-hardware
Commits
499233bb
Commit
499233bb
authored
1 year ago
by
David Huss
Browse files
Options
Downloads
Patches
Plain Diff
Fix pot and LED pin order
parent
63ad7912
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
code/daisy-looper/daisy-looper.ino
+50
-17
50 additions, 17 deletions
code/daisy-looper/daisy-looper.ino
with
50 additions
and
17 deletions
code/daisy-looper/daisy-looper.ino
+
50
−
17
View file @
499233bb
// Title: moogladder
// Description: Sweeps the cutoff with an lfo
// Hardware: Daisy Seed
// Author: Ben Sergentanis
#include
"DaisyDuino.h"
#include
"DaisyDuino.h"
#include
<Wire.h>
#include
<Wire.h>
#include
<Adafruit_GFX.h>
#include
<Adafruit_GFX.h>
...
@@ -23,6 +16,8 @@
...
@@ -23,6 +16,8 @@
MIDI_CREATE_DEFAULT_INSTANCE
();
MIDI_CREATE_DEFAULT_INSTANCE
();
#define BUFFER_LENGTH_SECONDS 5
#define BUFFER_LENGTH_SECONDS 5
#define DEBUGMODE
static
const
size_t
buffer_length
=
48000
*
BUFFER_LENGTH_SECONDS
;
static
const
size_t
buffer_length
=
48000
*
BUFFER_LENGTH_SECONDS
;
static
float
DSY_SDRAM_BSS
buffer
[
buffer_length
];
static
float
DSY_SDRAM_BSS
buffer
[
buffer_length
];
static
float
DSY_SDRAM_BSS
buffer_b
[
buffer_length
];
static
float
DSY_SDRAM_BSS
buffer_b
[
buffer_length
];
...
@@ -61,7 +56,7 @@ Potentiometer pot_6 = Potentiometer(A5);
...
@@ -61,7 +56,7 @@ Potentiometer pot_6 = Potentiometer(A5);
Potentiometer
pot_7
=
Potentiometer
(
A6
);
Potentiometer
pot_7
=
Potentiometer
(
A6
);
// RGB LED R G B
// RGB LED R G B
RGBLed
rgb_led
=
RGBLed
(
A10
,
A
9
,
A11
);
RGBLed
rgb_led
=
RGBLed
(
A10
,
A
11
,
A11
);
// OLED Display
// OLED Display
...
@@ -77,8 +72,7 @@ Ui ui;
...
@@ -77,8 +72,7 @@ Ui ui;
DaisyHardware
hw
;
DaisyHardware
hw
;
// Variables for the Audio-Callback
// Variables for the Audio-Callback
size_t
num_channels
size_t
num_channels
;
;
float
blocksize
;
float
blocksize
;
float
drywetmix
=
0.0f
;
float
drywetmix
=
0.0f
;
float
delaymix
=
0.0f
;
float
delaymix
=
0.0f
;
...
@@ -88,6 +82,8 @@ float lfo_amount = 0.0f;
...
@@ -88,6 +82,8 @@ float lfo_amount = 0.0f;
float
pitch_val
=
0.5f
;
float
pitch_val
=
0.5f
;
float
midi_pitch_offset
=
0.0f
;
float
midi_pitch_offset
=
0.0f
;
float
pressure
=
0.0f
;
// Actual audio-processing is orchestrated here
// Actual audio-processing is orchestrated here
void
AudioCallback
(
float
**
in
,
float
**
out
,
size_t
size
)
{
void
AudioCallback
(
float
**
in
,
float
**
out
,
size_t
size
)
{
float
output
=
0.0f
;
float
output
=
0.0f
;
...
@@ -173,6 +169,8 @@ void AudioCallback(float **in, float **out, size_t size) {
...
@@ -173,6 +169,8 @@ void AudioCallback(float **in, float **out, size_t size) {
break
;
break
;
}
}
// looper_out = pressure * looper_out;
// Mix the dry/Wet of the looper
// Mix the dry/Wet of the looper
output
=
drywetmix
*
looper_out
+
in
[
1
][
i
]
*
(
1.0f
-
drywetmix
);
output
=
drywetmix
*
looper_out
+
in
[
1
][
i
]
*
(
1.0f
-
drywetmix
);
...
@@ -206,8 +204,17 @@ void AudioCallback(float **in, float **out, size_t size) {
...
@@ -206,8 +204,17 @@ void AudioCallback(float **in, float **out, size_t size) {
// TODO: Is USB Midi possible? https://github.com/electro-smith/DaisyExamples/blob/master/seed/USB_MIDI/USB_MIDI.cpp
// TODO: Is USB Midi possible? https://github.com/electro-smith/DaisyExamples/blob/master/seed/USB_MIDI/USB_MIDI.cpp
void
handleNoteOn
(
byte
inChannel
,
byte
inNote
,
byte
inVelocity
)
{
void
handleNoteOn
(
byte
inChannel
,
byte
inNote
,
byte
inVelocity
)
{
#ifdef DEBUGMODE
Serial
.
print
(
"[MIDI ON] chn<"
);
Serial
.
print
((
int
)
inChannel
);
Serial
.
print
(
"> note<"
);
Serial
.
print
((
int
)
inNote
);
Serial
.
print
(
"> velocity<"
);
Serial
.
print
((
int
)
inVelocity
);
Serial
.
println
(
">"
);
#endif
// Note Off can come in as Note On w/ 0 Velocity
// Note Off can come in as Note On w/ 0 Velocity
if
(
inVelocity
==
0.f
)
{
if
(
inVelocity
==
0.
0
f
)
{
midi_pitch_offset
=
0.0f
;
midi_pitch_offset
=
0.0f
;
}
}
else
{
else
{
...
@@ -218,9 +225,29 @@ void handleNoteOn(byte inChannel, byte inNote, byte inVelocity) {
...
@@ -218,9 +225,29 @@ void handleNoteOn(byte inChannel, byte inNote, byte inVelocity) {
void
handleNoteOff
(
byte
inChannel
,
byte
inNote
,
byte
inVelocity
)
{
void
handleNoteOff
(
byte
inChannel
,
byte
inNote
,
byte
inVelocity
)
{
#ifdef DEBUGMODE
Serial
.
print
(
"[MIDI OFF] chn<"
);
Serial
.
print
((
int
)
inChannel
);
Serial
.
print
(
"> note<"
);
Serial
.
print
((
int
)
inNote
);
Serial
.
print
(
"> velocity<"
);
Serial
.
print
((
int
)
inVelocity
);
Serial
.
println
(
">"
);
#endif
midi_pitch_offset
=
0.0f
;
midi_pitch_offset
=
0.0f
;
}
}
void
handleAftertouch
(
byte
channel
,
byte
channel_pressure
)
{
#ifdef DEBUGMODE
Serial
.
print
(
"[MIDI AFTER] chn<"
);
Serial
.
print
((
int
)
channel
);
Serial
.
print
(
"> pressure<"
);
Serial
.
print
((
int
)
channel_pressure
);
Serial
.
println
(
">"
);
#endif
pressure
=
float
(
channel_pressure
)
/
127.0f
;
}
void
setup
()
{
void
setup
()
{
...
@@ -289,6 +316,8 @@ void setup() {
...
@@ -289,6 +316,8 @@ void setup() {
// Setup MIDI handlers
// Setup MIDI handlers
MIDI
.
setHandleNoteOn
(
handleNoteOn
);
MIDI
.
setHandleNoteOn
(
handleNoteOn
);
MIDI
.
setHandleNoteOff
(
handleNoteOff
);
MIDI
.
setHandleNoteOff
(
handleNoteOff
);
MIDI
.
setHandleAfterTouchChannel
(
handleAftertouch
);
MIDI
.
begin
(
MIDI_CHANNEL_OMNI
);
// Listen to all incoming messages
MIDI
.
begin
(
MIDI_CHANNEL_OMNI
);
// Listen to all incoming messages
// Set Knob names and display functions
// Set Knob names and display functions
...
@@ -296,9 +325,9 @@ void setup() {
...
@@ -296,9 +325,9 @@ void setup() {
pot_2
.
name
=
"Length"
;
pot_2
.
name
=
"Length"
;
pot_3
.
setDisplayMode
(
"Pitch"
,
1000.0f
,
POT_DISPLAY_MODE_PERCENT
);
pot_3
.
setDisplayMode
(
"Pitch"
,
1000.0f
,
POT_DISPLAY_MODE_PERCENT
);
pot_4
.
setDisplayMode
(
"Mix"
,
100.0f
,
POT_DISPLAY_MODE_PERCENT
);
pot_4
.
setDisplayMode
(
"Mix"
,
100.0f
,
POT_DISPLAY_MODE_PERCENT
);
pot_5
.
setDisplayMode
(
"
Delay
"
,
100.0f
,
POT_DISPLAY_MODE_PERCENT
);
pot_5
.
setDisplayMode
(
"
LFO
"
,
100.0f
,
POT_DISPLAY_MODE_PERCENT
);
pot_6
.
setDisplayMode
(
"
Reverb
"
,
100.0f
,
POT_DISPLAY_MODE_PERCENT
);
pot_6
.
setDisplayMode
(
"
Delay
"
,
100.0f
,
POT_DISPLAY_MODE_PERCENT
);
pot_7
.
setDisplayMode
(
"
LFO
"
,
100.0f
,
POT_DISPLAY_MODE_PERCENT
);
pot_7
.
setDisplayMode
(
"
Reverb
"
,
100.0f
,
POT_DISPLAY_MODE_PERCENT
);
// Set Knob Scaling Modes
// Set Knob Scaling Modes
// pot_3.setBipolar();
// pot_3.setBipolar();
...
@@ -349,12 +378,16 @@ void loop() {
...
@@ -349,12 +378,16 @@ void loop() {
if
(
!
isnan
(
p4
))
{
drywetmix
=
p4
;
}
if
(
!
isnan
(
p4
))
{
drywetmix
=
p4
;
}
if
(
!
isnan
(
p5
))
{
delaymix
=
p5
;
}
if
(
!
isnan
(
p5
))
{
delaymix
=
p5
;
}
// Delaytime is in samples
// Delaytime is in samples
if
(
!
isnan
(
p5
))
{
delaytime
=
100.0f
+
p5
*
23900.0f
;
}
if
(
!
isnan
(
p5
))
{
lfo_amount
=
p5
;
}
if
(
!
isnan
(
p6
))
{
reverbmix
=
p6
;
}
if
(
!
isnan
(
p6
))
{
delaytime
=
100.0f
+
p6
*
23900.0f
;
}
if
(
!
isnan
(
p7
))
{
lfo_amount
=
p7
;
}
if
(
!
isnan
(
p7
))
{
reverbmix
=
p7
;
Serial
.
print
(
"Reverb was not NaN: "
);
Serial
.
println
(
reverbmix
)
;
}
// Render the UI (frame rate limited by UI_MAX_FPS in ui.h)
// Render the UI (frame rate limited by UI_MAX_FPS in ui.h)
// double start = millis();
ui
.
Render
();
ui
.
Render
();
// Serial.print("ui Render took ");
// Serial.print(millis()-start);
// Serial.println("ms");
// Set the Color and brightness of the RGB LED in 8 bits
// Set the Color and brightness of the RGB LED in 8 bits
rgb_led
.
setAudioLevelIndicator
(
input_envelope_follower
.
getValue
());
rgb_led
.
setAudioLevelIndicator
(
input_envelope_follower
.
getValue
());
...
...
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