Skip to content
Snippets Groups Projects
Commit ed9dab65 authored by David Huss's avatar David Huss :speech_balloon:
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 287 additions and 0 deletions
*.private.*
*.~lock*
File added
3d/drumsynth.png

1.33 KiB

This diff is collapsed.
# Exported by Open CASCADE Technology [dev.opencascade.org]
newmtl mat_1
Ka 0.000000 0.000000 0.000000
Kd 0.000000 0.000000 0.000000
Ks 0.484529 0.484529 0.484529
Ns 1000.000000
newmtl mat_2
Ka 0.420451 0.435857 0.499683
Kd 0.792157 0.819608 0.933333
Ks 0.484529 0.484529 0.484529
Ns 1000.000000
newmtl mat_3
Ka 0.000000 0.000000 0.257584
Kd 0.000000 0.000000 0.501961
Ks 0.484529 0.484529 0.484529
Ns 1000.000000
newmtl mat_4
Ka 0.116726 0.116726 0.116726
Kd 0.250980 0.250980 0.250980
Ks 0.484529 0.484529 0.484529
Ns 1000.000000
This diff is collapsed.
File added
# Exported by Open CASCADE Technology [dev.opencascade.org]
newmtl mat_1
Ka 0.424853 0.424853 0.424853
Kd 0.800000 0.800000 0.800000
Ks 0.484529 0.484529 0.484529
Ns 1000.000000
newmtl mat_2
Ka 0.255383 0.453464 0.270789
Kd 0.498039 0.850980 0.525490
Ks 0.484529 0.484529 0.484529
Ns 1000.000000
newmtl mat_3
Ka 0.372031 0.372031 0.372031
Kd 0.705882 0.705882 0.705882
Ks 0.484529 0.484529 0.484529
Ns 1000.000000
This diff is collapsed.
3d/renders/daisyy1.png

8.48 MiB

3d/renders/daisyy2.png

8.55 MiB

{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 5
}
This diff is collapsed.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
{"data":{"layout-restorer:data":{"main":{"dock":{"type":"tab-area","currentIndex":1,"widgets":["notebook:circuit_sim.ipynb","notebook:Untitled.ipynb","notebook:lookup-tables.ipynb"]},"current":"notebook:Untitled.ipynb"},"down":{"size":0,"widgets":[]},"left":{"collapsed":false,"current":"filebrowser","widgets":["filebrowser","running-sessions","@jupyterlab/toc:plugin","extensionmanager.main-view"]},"right":{"collapsed":true,"widgets":["jp-property-inspector","debugger-sidebar"]},"relativeSizes":[0.26227795193312436,0.7377220480668757,0]},"notebook:circuit_sim.ipynb":{"data":{"path":"circuit_sim.ipynb","factory":"Notebook"}},"notebook:lookup-tables.ipynb":{"data":{"path":"lookup-tables.ipynb","factory":"Notebook"}},"notebook:Untitled.ipynb":{"data":{"path":"Untitled.ipynb","factory":"Notebook"}}},"metadata":{"id":"default"}}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
#include "wiring_constants.h"
#ifndef Buttons_h
#define Buttons_h
#include "Arduino.h"
#define DURATION_SHORT_PRESS 800
#define DURATION_VERY_LONG_PRESS 2000
typedef void (*callback_function)(void);
class Button {
int pin;
bool has_been_pressed;
unsigned long press_start;
unsigned long release_start;
callback_function onPressFunction;
callback_function onPressedFunction;
callback_function onLongPressFunction;
callback_function onVeryLongPressFunction;
public:
Button(int pin);
void init();
void read();
unsigned long pressed_since();
unsigned long released_since();
void onPress(callback_function f);
void onPressed(callback_function f);
void onLongPress(callback_function f);
void onVeryLongPress(callback_function f);
};
Button::Button(int pin) {
this->pin = pin;
}
void Button::init() {
pinMode(this->pin, INPUT_PULLUP);
this->has_been_pressed = false;
this->press_start = 0;
this->release_start = 0;
}
void Button::read() {
int is_pressed = !digitalRead(this->pin);
if (is_pressed && this->press_start == 0) {
this->press_start = millis();
Serial.println("Set a new start");
}
if (!is_pressed && this->has_been_pressed && this->release_start == 0) {
this->release_start = millis();
Serial.println("Set a new release");
}
unsigned long pressed_since = this->pressed_since();
unsigned long released_since = this->released_since();
if (is_pressed) {
// Fire the callback function all the time while this is being pressed
if (this->onPressedFunction) { this->onPressedFunction(); }
// Serial.print("Pressed since ");
// Serial.println(pressed_since);
if ( released_since > 100) {
this->has_been_pressed = false;
}
} else {
// Not pressed.
if (!this->has_been_pressed) {
if (pressed_since > 0 && pressed_since < DURATION_SHORT_PRESS) {
if (this->onPressFunction) { this->onPressFunction(); }
Serial.print("Short Press (released after ");
Serial.print(pressed_since);
Serial.print(", released since ");
Serial.print(released_since);
if (released_since < 200 ) {
Serial.print(", Doublepress? ");
}
Serial.println(")");
} else if (pressed_since > 0 && pressed_since < DURATION_VERY_LONG_PRESS) {
if (this->onLongPressFunction) { this->onLongPressFunction(); }
Serial.print("Long Press (released after ");
Serial.print(pressed_since);
Serial.println(")");
} else if (pressed_since > 0 && pressed_since >= DURATION_VERY_LONG_PRESS) {
if (this->onVeryLongPressFunction) { this->onVeryLongPressFunction(); }
Serial.print("Very Long Press (released after ");
Serial.print(pressed_since);
Serial.println(")");
}
this->press_start = 0;
this->has_been_pressed = true;
this->release_start = millis();
}
}
}
unsigned long Button::pressed_since() {
if ( this->press_start == 0) {
return 0;
}
return millis() - this->press_start;
}
unsigned long Button::released_since() {
if ( this->release_start == 0) {
return 0;
}
return millis() - this->release_start;
}
void Button::onPress(callback_function f) {
this->onPressFunction = f;
}
void Button::onPressed(callback_function f) {
this->onPressedFunction = f;
}
void Button::onLongPress(callback_function f) {
this->onLongPressFunction = f;
}
void Button::onVeryLongPress(callback_function f) {
this->onVeryLongPressFunction = f;
}
#endif
\ No newline at end of file
// Title: daisyy
// Description: Multisynth with display
// Hardware: Daisy Seed
// Author: David Huss
#include "DaisyDuino.h"
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h>
#include "ui.h"
#include "patch.h"
#include "hardware.h"
#define UI_FPS 60.0
Ui ui;
Hardware hardware;
Patch patch;
double last_render = 0.0;
float current_freq = 0.0f;
float current_filt_freq = 0.0f;
void AudioCallback(float **in, float **out, size_t size) {
// if (ui.mode == UI_MODE_SYNTH) {
patch.render(in, out, size);
// }
}
void setup() {
Serial.begin(9600);
hardware.init();
patch.init(hardware.sample_rate, hardware.num_channels);
ui.init(&patch, &hardware);
DAISY.begin(AudioCallback);
}
void loop() {
ui.poll();
// float f = pot_1.read();
// osc_freq = 20.0f + f * 4000.0f;
// f = pot_2.read();
// rgb_led.setAudioLevelIndicator(int(f*255));
// filt_freq = 10.0f + f * 19000.0f;
// osc_amp = pot_3.read();
// filt_res = pot_4.read();
// lfo_freq = pot_5.read()*500.0f;
// // LFO needs to modulate more as it gets higher!
// lfo_mod_filter = pot_6.read() * 2.0f * filt_freq;
// lfo_mod_oscillator = pot_7.read() * 1.0f * osc_freq;
// button_2.read();
// button_2.onPress(switchWaveForm);
// render_display();
}
// void render_display() {
// double now = millis();
// if (now - last_render > 1000.0/UI_FPS) {
// // Text Display
// display.clearDisplay();
// display.setCursor(0, 0);
// display.print("OSC FREQ ");
// display.print(int(round(osc_freq)));
// display.println(" Hz");
// display.print("FILT FREQ ");
// display.print(int(round(filt_freq)));
// display.println(" Hz");
// display.print("OSC AMP ");
// display.print(int(round(osc_amp * 100)));
// display.println(" %");
// display.print("FILT RES ");
// display.print(int(round(filt_res * 100)));
// display.println(" %");
// int osc_pitch_line_x = map(current_freq, 10, 19000, 0, display.width());
// int filt_freq_line_x = map(current_filt_freq, 10, 19000, 0, display.width());
// for (int i=0; i<30; i++) {
// float j = ((30-i)/30.0f);
// j = 1.0f - (j*j);
// float neg_h = -30+(30*j);
// display.drawLine(osc_pitch_line_x+(i*3), display.height(), osc_pitch_line_x+(i*3), display.height()+neg_h * osc_amp, SH110X_WHITE);
// }
// // Filter
// // Straight line
// display.drawLine(filt_freq_line_x-20, display.height()-20, 0, display.height()-20, SH110X_WHITE);
// display.drawLine(filt_freq_line_x-20, display.height()-20, filt_freq_line_x-10, display.height()-20 - (10*filt_res), SH110X_WHITE);
// display.drawLine(filt_freq_line_x-10, display.height()-20 - (10*filt_res), filt_freq_line_x, display.height()-20, SH110X_WHITE);
// // right down
// display.drawLine(filt_freq_line_x+16, display.height(), filt_freq_line_x, display.height()-20, SH110X_WHITE);
// display.display();
// last_render = now;
// }
// }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment