Skip to content

Commit

Permalink
Harmonizer effect added; last commit for v1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
snail23 committed Aug 29, 2023
1 parent 30dcde2 commit 28ef4ce
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 14 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ Text colors can be changed on the Misc effects screen and the number of profiles
| Phaser | 1010 | Frequency | | Rate | Feedback | | Depth |
| Delay | 1011 | | Delay | | | | |
| Flanger | 1100 | Delay | | Rate | Feedback | | Depth |
| Pitch | 1101 | | Semitones | | Delay | | Flutter |
| Unused | 1110 | | | | | | |
| Pitch | 1101 | | Semitones | | Rate | | Flutter |
| Harmonizer | 1110 | Semitones | Rate | Flutter | Semitones | Rate | Flutter |
| Misc | 1111 | | | | | Color | Metronome |

## Effect chain order
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| ------------------- | ---------- | --------- | --------- | ------ | ------------------------ | ------ |
| Misc: Tuner | Autowah | Overdrive | Chorus | Delay | Misc: Metronome | Looper |
| Master: Moog Filter | Decimator | Resonator | Tremolo | Reverb | Master: Volume | |
| Pitch | Compressor | | Phaser | | | |
| | | | Flanger | | | |
| Pitch | Autowah | Overdrive | Chorus | Delay | Misc: Metronome | Looper |
| Misc: Tuner | Decimator | Resonator | Tremolo | Reverb | Master: Volume | |
| Harmonizer | Compressor | | Phaser | | | |
| Master: Moog Filter | | | Flanger | | | |

## Usage
| Operation | Instructions |
Expand All @@ -60,11 +60,11 @@ Text colors can be changed on the Misc effects screen and the number of profiles
## My settings, feel free to use these as a starting point
| Effect | Switch position | Knob 1 | Knob 2 | Knob 3 | Knob 4 | Knob 5 | Knob 6 |
| ---------- | --------------- | --------- | -------- | ------------ | --------- | ------------- | ------ |
| Master | 0000 | | | 1 | 10.1 kHz | 40 | 150 |
| Master | 0000 | | | 1 | 4.5 kHz | 45 | 150 |
| Overdrive | 0001 | 45 | | Hard | | 45 | |
| Chorus | 0010 | 75 | | 0.30 | 20 | | 90 |
| Compressor | 0011 | -12 dB | | 2:1 | 0.118 | | 0.118 |
| Reverb | 0100 | | 50 | | | 10.1 kHz | |
| Reverb | 0100 | | 25 | | | 4.5 kHz | |
| Resonator | 0101 | 20 | | 78 Hz (Eb2) | 25 | | 35 |
| Autowah | 0110 | | 50 | | 10 | | |
| Tremolo | 0111 | 50 | | 622 Hz (Eb5) | | Triangle Wave | |
Expand All @@ -74,7 +74,7 @@ Text colors can be changed on the Misc effects screen and the number of profiles
| Delay | 1011 | | 0 MS | | | | |
| Flanger | 1100 | 75 | | 0.30 | 20 | | 90 |
| Pitch | 1101 | | 0 | | 10 or 50 | | 10 |
| Unused | 1110 | | | | | | |
| Harmonizer | 1110 | +12 | 10 | 10 | -12 | 95 | 10 |
| Misc | 1111 | | | | | 1 | Off |

You may find this [chart](http://www.simonpaul.com/wp-content/uploads/downloads/2010/04/Notes-To-Frequencies.pdf) useful when setting certain effect frequencies.
Expand Down
4 changes: 4 additions & 0 deletions dep/DaisySP/Source/Effects/reverbsc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

using namespace daisysp;

#define DSY_SDRAM_BSS __attribute__((section(".sdram_bss")))
#define DSY_REVERBSC_MAX_SIZE 98936
float DSY_SDRAM_BSS aux_[DSY_REVERBSC_MAX_SIZE];

/* kReverbParams[n][0] = delay time (in seconds) */
/* kReverbParams[n][1] = random variation in delay time (in seconds) */
/* kReverbParams[n][2] = random variation frequency (in 1/sec) */
Expand Down
3 changes: 0 additions & 3 deletions dep/DaisySP/Source/Effects/reverbsc.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
#ifndef DSYSP_REVERBSC_H
#define DSYSP_REVERBSC_H

#define DSY_REVERBSC_MAX_SIZE 98936

namespace daisysp
{
/**Delay line for internal reverb use
Expand Down Expand Up @@ -71,7 +69,6 @@ class ReverbSc
float prv_lpfreq_;
int init_done_;
ReverbScDl delay_lines_[8];
float aux_[DSY_REVERBSC_MAX_SIZE];
};


Expand Down
2 changes: 1 addition & 1 deletion src/effect.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Effect
EFFECT_DELAY, // 1011
EFFECT_FLANGER, // 1100
EFFECT_PITCH, // 1101
EFFECT_NYI, // 1110
EFFECT_HARMONIZER, // 1110
EFFECT_MISC, // 1111
EFFECT_LAST
};
Expand Down
112 changes: 112 additions & 0 deletions src/effects/harmonizer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
// Part of Ironpedal
// https://github.com/snail23/ironpedal

namespace Effect
{
class Harmonizer
{
public:
Harmonizer(Snailsoft::Ironpedal *ironpedal)
{
this->ironpedal = ironpedal;

this->flutter1.Init(this->ironpedal->knobs[PedalPCB::KNOB_3], 0.0f, 1.01f, daisy::Parameter::LINEAR);
this->flutter2.Init(this->ironpedal->knobs[PedalPCB::KNOB_6], 0.0f, 1.01f, daisy::Parameter::LINEAR);

this->rate1.Init(this->ironpedal->knobs[PedalPCB::KNOB_2], 100.01f, 1.0f, daisy::Parameter::LINEAR);
this->rate2.Init(this->ironpedal->knobs[PedalPCB::KNOB_5], 100.01f, 1.0f, daisy::Parameter::LINEAR);

this->semitones1.Init(this->ironpedal->knobs[PedalPCB::KNOB_1], -12.01f, 12.01f, daisy::Parameter::LINEAR);
this->semitones2.Init(this->ironpedal->knobs[PedalPCB::KNOB_4], -12.01f, 12.01f, daisy::Parameter::LINEAR);

this->pitch1.Init(this->ironpedal->AudioSampleRate());

this->pitch1.SetDelSize(round(this->ironpedal->GetEffect(EFFECT_HARMONIZER).values[PedalPCB::KNOB_2]) / 1000.0f * this->ironpedal->AudioSampleRate());
this->pitch1.SetFun(this->ironpedal->GetEffect(EFFECT_HARMONIZER).values[PedalPCB::KNOB_3]);
this->pitch1.SetTransposition(round(this->ironpedal->GetEffect(EFFECT_HARMONIZER).values[PedalPCB::KNOB_1]));

this->pitch2.Init(this->ironpedal->AudioSampleRate());

this->pitch2.SetDelSize(round(this->ironpedal->GetEffect(EFFECT_HARMONIZER).values[PedalPCB::KNOB_5]) / 1000.0f * this->ironpedal->AudioSampleRate());
this->pitch2.SetFun(this->ironpedal->GetEffect(EFFECT_HARMONIZER).values[PedalPCB::KNOB_6]);
this->pitch2.SetTransposition(round(this->ironpedal->GetEffect(EFFECT_HARMONIZER).values[PedalPCB::KNOB_4]));
}

void Draw()
{
char buf[16];

SSD1351_write_string(this->ironpedal->GetColor().light, this->ironpedal->font, "SEMI", ALIGN_LEFT);
SSD1351_write_string(this->ironpedal->GetColor().light, this->ironpedal->font, "RATE", ALIGN_CENTER);
SSD1351_write_string(this->ironpedal->GetColor().light, this->ironpedal->font, "FLUT\n", ALIGN_RIGHT);

sprintf(buf, "%+ld", (int32_t)round(this->ironpedal->GetEffect(EFFECT_HARMONIZER).values[PedalPCB::KNOB_1]));
SSD1351_write_string(this->ironpedal->GetColor().base, this->ironpedal->font, buf, ALIGN_LEFT);

sprintf(buf, "%lu", (uint32_t)round(101.0f - this->ironpedal->GetEffect(EFFECT_HARMONIZER).values[PedalPCB::KNOB_2]));
SSD1351_write_string(this->ironpedal->GetColor().base, this->ironpedal->font, buf, ALIGN_CENTER);

sprintf(buf, "%lu\n", (uint32_t)(this->ironpedal->GetEffect(EFFECT_HARMONIZER).values[PedalPCB::KNOB_3] * 100.0f));
SSD1351_write_string(this->ironpedal->GetColor().base, this->ironpedal->font, buf, ALIGN_RIGHT);

SSD1351_write_string(this->ironpedal->GetColor().base, this->ironpedal->font, "\n", this->ironpedal->GetColor().base);

SSD1351_write_string(this->ironpedal->GetColor().light, this->ironpedal->font, "SEMI", ALIGN_LEFT);
SSD1351_write_string(this->ironpedal->GetColor().light, this->ironpedal->font, "RATE", ALIGN_CENTER);
SSD1351_write_string(this->ironpedal->GetColor().light, this->ironpedal->font, "FLUT\n", ALIGN_RIGHT);

sprintf(buf, "%+ld", (int32_t)round(this->ironpedal->GetEffect(EFFECT_HARMONIZER).values[PedalPCB::KNOB_4]));
SSD1351_write_string(this->ironpedal->GetColor().base, this->ironpedal->font, buf, ALIGN_LEFT);

sprintf(buf, "%lu", (uint32_t)round(101.0f - this->ironpedal->GetEffect(EFFECT_HARMONIZER).values[PedalPCB::KNOB_5]));
SSD1351_write_string(this->ironpedal->GetColor().base, this->ironpedal->font, buf, ALIGN_CENTER);

sprintf(buf, "%lu\n", (uint32_t)(this->ironpedal->GetEffect(EFFECT_HARMONIZER).values[PedalPCB::KNOB_6] * 100.0f));
SSD1351_write_string(this->ironpedal->GetColor().base, this->ironpedal->font, buf, ALIGN_RIGHT);

this->ironpedal->PrintFooter("HARMONIZER\n");
}

void OnAudio(float *in, float *out, size_t size)
{
for (size_t i = 0; i < size; ++i)
out[i] = (in[i] + this->pitch1.Process(in[i]) + this->pitch2.Process(in[i])) / 3.0f;
}

void OnInput()
{
if (!this->ironpedal->GetEffect(EFFECT_HARMONIZER).locked)
{
this->ironpedal->GetEffect(EFFECT_HARMONIZER).values[PedalPCB::KNOB_1] = this->semitones1.Process();
this->ironpedal->GetEffect(EFFECT_HARMONIZER).values[PedalPCB::KNOB_2] = this->rate1.Process();
this->ironpedal->GetEffect(EFFECT_HARMONIZER).values[PedalPCB::KNOB_3] = this->flutter1.Process();
this->ironpedal->GetEffect(EFFECT_HARMONIZER).values[PedalPCB::KNOB_4] = this->semitones2.Process();
this->ironpedal->GetEffect(EFFECT_HARMONIZER).values[PedalPCB::KNOB_5] = this->rate2.Process();
this->ironpedal->GetEffect(EFFECT_HARMONIZER).values[PedalPCB::KNOB_6] = this->flutter2.Process();
}

this->pitch1.SetDelSize(round(this->ironpedal->GetEffect(EFFECT_HARMONIZER).values[PedalPCB::KNOB_2]) / 1000.0f * this->ironpedal->AudioSampleRate());
this->pitch1.SetFun(this->ironpedal->GetEffect(EFFECT_HARMONIZER).values[PedalPCB::KNOB_3]);
this->pitch1.SetTransposition(round(this->ironpedal->GetEffect(EFFECT_HARMONIZER).values[PedalPCB::KNOB_1]));

this->pitch2.SetDelSize(round(this->ironpedal->GetEffect(EFFECT_HARMONIZER).values[PedalPCB::KNOB_5]) / 1000.0f * this->ironpedal->AudioSampleRate());
this->pitch2.SetFun(this->ironpedal->GetEffect(EFFECT_HARMONIZER).values[PedalPCB::KNOB_6]);
this->pitch2.SetTransposition(round(this->ironpedal->GetEffect(EFFECT_HARMONIZER).values[PedalPCB::KNOB_4]));
}

private:
daisy::Parameter flutter1;
daisy::Parameter flutter2;

daisy::Parameter rate1;
daisy::Parameter rate2;

daisy::Parameter semitones1;
daisy::Parameter semitones2;

daisysp::PitchShifter pitch1;
daisysp::PitchShifter pitch2;

Snailsoft::Ironpedal *ironpedal;
};
}
2 changes: 1 addition & 1 deletion src/effects/pitch.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Effect
char buf[16];

SSD1351_write_string(this->ironpedal->GetColor().light, this->ironpedal->font, "SEMITONES\n", ALIGN_CENTER);
sprintf(buf, "%ld\n", (int32_t)round(this->ironpedal->GetEffect(EFFECT_PITCH).values[PedalPCB::KNOB_2]));
sprintf(buf, "%+ld\n", (int32_t)round(this->ironpedal->GetEffect(EFFECT_PITCH).values[PedalPCB::KNOB_2]));
SSD1351_write_string(this->ironpedal->GetColor().base, this->ironpedal->font, buf, ALIGN_CENTER);

SSD1351_write_string(this->ironpedal->GetColor().base, this->ironpedal->font, "\n", this->ironpedal->GetColor().base);
Expand Down
17 changes: 17 additions & 0 deletions src/ironpedal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "effects/decimator.h"
#include "effects/delay.h"
#include "effects/flanger.h"
#include "effects/harmonizer.h"
#include "effects/looper.h"
#include "effects/master.h"
#include "effects/misc.h"
Expand All @@ -33,6 +34,7 @@ Effect::Compressor *Compressor;
Effect::Decimator *Decimator;
Effect::Delay *Delay;
Effect::Flanger *Flanger;
Effect::Harmonizer *Harmonizer;
Effect::Looper *Looper;
Effect::Master *Master;
Effect::Misc *Misc;
Expand Down Expand Up @@ -63,6 +65,7 @@ int main()
Decimator = new Effect::Decimator(Ironpedal);
Delay = new Effect::Delay(Ironpedal);
Flanger = new Effect::Flanger(Ironpedal);
Harmonizer = new Effect::Harmonizer(Ironpedal);
Looper = new Effect::Looper(Ironpedal);
Master = new Effect::Master(Ironpedal);
Misc = new Effect::Misc(Ironpedal);
Expand Down Expand Up @@ -113,6 +116,11 @@ void Draw()

break;

case Effect::EFFECT_HARMONIZER:
Harmonizer->Draw();

break;

case Effect::EFFECT_LOOPER:
Looper->Draw();

Expand Down Expand Up @@ -173,6 +181,9 @@ void OnAudio(daisy::AudioHandle::InputBuffer in, daisy::AudioHandle::OutputBuffe
if (Ironpedal->current_effect.id == Effect::EFFECT_MISC && Ironpedal->display_enabled)
Misc->OnAudio((float *)in[0], out[0], size);

if (Ironpedal->GetEffect(Effect::EFFECT_HARMONIZER).enabled)
Harmonizer->OnAudio((float *)in[0], (float *)in[0], size);

Master->OnAudio((float *)in[0], out[0], size);

if (Ironpedal->GetEffect(Effect::EFFECT_AUTOWAH).enabled)
Expand Down Expand Up @@ -252,6 +263,11 @@ void OnInput()

break;

case Effect::EFFECT_HARMONIZER:
Harmonizer->OnInput();

break;

case Effect::EFFECT_LOOPER:
Looper->OnInput();

Expand Down Expand Up @@ -316,6 +332,7 @@ void OnInputAll()
Decimator->OnInput();
Delay->OnInput();
Flanger->OnInput();
Harmonizer->OnInput();
Looper->OnInput();
Master->OnInput(true);
Overdrive->OnInput();
Expand Down

0 comments on commit 28ef4ce

Please sign in to comment.