-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port Torus to patch.Init() #293
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything in the .vscode dir should be the same as the Patch example.
patch_sm/Torus/dsp/dsp.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing in the dsp dir has been modified from the Patch example.
dsp/string.cpp \ | ||
dsp/string_synth_part.cpp \ | ||
resources.cpp \ | ||
calibrate.cpp \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only this line has changed from the Patch example.
patch_sm/Torus/README.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated with new instructions.
patch_sm/Torus/calibrate.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class is new. The implementation is largely from electro-smith/libDaisy#397 (comment).
patch_sm/Torus/resources.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The resources files are unchanged from the Patch example.
patch_sm/Torus/storage.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is new.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file has been updated to handle the increased number of controls and to remove the screen UI.
if(settings_data.easter_egg_on) | ||
{ | ||
for(size_t i = 0; i < size; ++i) | ||
{ | ||
input[i] = in[0][i]; | ||
} | ||
strummer.Process(NULL, size, &performance_state); | ||
string_synth.Process( | ||
performance_state, patch, input, output, aux, size); | ||
} | ||
else | ||
{ | ||
// Apply noise gate. | ||
for(size_t i = 0; i < size; i++) | ||
{ | ||
float in_sample = in[0][i]; | ||
float error, gain; | ||
error = in_sample * in_sample - in_level; | ||
in_level += error * (error > 0.0f ? 0.1f : 0.0001f); | ||
gain = in_level <= kNoiseGateThreshold | ||
? (1.0f / kNoiseGateThreshold) * in_level | ||
: 1.0f; | ||
input[i] = gain * in_sample; | ||
} | ||
|
||
strummer.Process(input, size, &performance_state); | ||
part.Process(performance_state, patch, input, output, aux, size); | ||
} | ||
|
||
for(size_t i = 0; i < size; i++) | ||
{ | ||
out[0][i] = output[i]; | ||
out[1][i] = aux[i]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines are unchanged.
while(1) | ||
{ | ||
// Without this pause the save events get missed for some unknown reason. | ||
hw.Delay(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love to know what's going on here. If I don't have this delay and trigger_save
becomes true it never gets picked up. I only discovered this because it worked if I had other processing happening in the while loop. I tried throttling with a timer but that had no effect.
This is a port of the Torus (MI Rings) example to the patch.Init(). I've added a few enhancements to make it a bit more fully featured (v/oct and calibration, CV control of some params etc.)
I'll leave some comments about what has been modified from the Patch example.