diff --git a/peaks/drums/high_hat.cc b/peaks/drums/high_hat.cc index fba80a5..8e10607 100644 --- a/peaks/drums/high_hat.cc +++ b/peaks/drums/high_hat.cc @@ -49,10 +49,10 @@ void HighHat::Init() { noise_.set_resonance(24000); noise_.set_mode(SVF_MODE_BP); - vca_coloration_.Init(); - vca_coloration_.set_frequency(110 << 7); // 13kHz - vca_coloration_.set_resonance(0); - vca_coloration_.set_mode(SVF_MODE_HP); + // vca_coloration_.Init(); + // vca_coloration_.set_frequency(110 << 7); // 13kHz + // vca_coloration_.set_resonance(0); + // vca_coloration_.set_mode(SVF_MODE_HP); vca_envelope_.Init(); vca_envelope_.set_delay(0); @@ -87,19 +87,19 @@ int16_t HighHat::ProcessSingleSample(uint8_t control) { set_frequency(randomised_frequency) ; last_frequency_ = randomised_frequency ; - // colour + // decay random_value = stmlib::Random::GetWord() ; freq_up = (random_value > 2147483647) ? true : false ; randomised_frequency = freq_up ? - (last_colour_ + (colour_randomness_ >> 2)) : - (last_colour_ - (colour_randomness_ >> 2)); + (last_decay_ + (decay_randomness_ >> 2)) : + (last_decay_ - (decay_randomness_ >> 2)); // Check if we haven't walked out-of-bounds, and if so, reverse direction on last step if (randomised_frequency < 0 || randomised_frequency > 65535) { // flip the direction freq_up = !freq_up ; randomised_frequency = freq_up ? - (last_colour_ + (colour_randomness_ >> 2)) : - (last_colour_ - (colour_randomness_ >> 2)); + (last_decay_ + (decay_randomness_ >> 2)) : + (last_decay_ - (decay_randomness_ >> 2)); } // constrain randomised frequency - probably not necessary if (randomised_frequency < 0) { @@ -107,9 +107,9 @@ int16_t HighHat::ProcessSingleSample(uint8_t control) { } else if (randomised_frequency > 65535) { randomised_frequency = 65535; } - // set new random frequency - set_colour(randomised_frequency) ; - last_colour_ = randomised_frequency ; + // set new random decay + set_decay(randomised_frequency) ; + last_decay_ = randomised_frequency ; // Hit it! vca_envelope_.Trigger(32768 * 15); @@ -146,13 +146,14 @@ int16_t HighHat::ProcessSingleSample(uint8_t control) { int32_t envelope = vca_envelope_.Process() >> 4; int32_t vca_noise = envelope * filtered_noise >> 14; CLIP(vca_noise); - int32_t hh = 0; - hh += vca_coloration_.Process(vca_noise); + return vca_noise; + // int32_t hh = 0; + // hh += vca_coloration_.Process(vca_noise); // hh += vca_coloration_.Process(vca_noise); - hh <<= 1; + // hh <<= 1; // hh <<= 2; - CLIP(hh); - return hh; + // CLIP(hh); + // return hh; } diff --git a/peaks/drums/high_hat.h b/peaks/drums/high_hat.h index 4896ccc..dc21b0c 100644 --- a/peaks/drums/high_hat.h +++ b/peaks/drums/high_hat.h @@ -54,18 +54,18 @@ class HighHat { set_frequency(parameter[0]); base_frequency_ = parameter[0]; last_frequency_ = base_frequency_; - set_colour(parameter[1]); - base_colour_ = parameter[1]; - last_colour_ = base_colour_; + set_decay(parameter[1]); + base_decay_ = parameter[1]; + last_decay_ = base_decay_; } else { set_frequency(parameter[0]); base_frequency_ = parameter[0]; last_frequency_ = base_frequency_; - set_colour(parameter[1]); - base_colour_ = parameter[1]; - last_colour_ = base_colour_; + set_decay(parameter[1]); + base_decay_ = parameter[1]; + last_decay_ = base_decay_; set_frequency_randomness(parameter[2]); - set_colour_randomness(parameter[3]); + set_decay_randomness(parameter[3]); } } @@ -73,17 +73,16 @@ class HighHat { noise_.set_frequency((105 << 7) - ((32767 - frequency) >> 6)); // 8kHz } - void set_colour(uint16_t colour) { - //vca_coloration_.set_frequency((110 << 7) - ((32767 - colour) >> 6)); // 13kHz - vca_coloration_.set_frequency((65535 - (colour >> 1)) >> 2); // 13kHz + void set_decay(uint16_t decay) { + vca_envelope_.set_decay(4065 + (decay >> 11)); } void set_frequency_randomness(uint16_t frequency_randomness) { frequency_randomness_ = frequency_randomness; } - void set_colour_randomness(uint16_t colour_randomness) { - colour_randomness_ = colour_randomness; + void set_decay_randomness(uint16_t decay_randomness) { + decay_randomness_ = decay_randomness; } inline void set_open(bool open) { @@ -92,19 +91,19 @@ class HighHat { private: Svf noise_; - Svf vca_coloration_; + // Svf vca_coloration_; Excitation vca_envelope_; uint32_t phase_[6]; uint16_t frequency_randomness_ ; - uint16_t colour_randomness_ ; + uint16_t decay_randomness_ ; int32_t randomised_hit_ ; uint16_t base_frequency_ ; uint16_t last_frequency_ ; - uint16_t base_colour_ ; - uint16_t last_colour_ ; + uint16_t base_decay_ ; + uint16_t last_decay_ ; bool open_ ; diff --git a/peaks/processors.cc b/peaks/processors.cc index 3d870b1..c3de5b1 100644 --- a/peaks/processors.cc +++ b/peaks/processors.cc @@ -59,7 +59,7 @@ Processors::callbacks_table_[PROCESSOR_FUNCTION_LAST] = { REGISTER_BUFFERED_PROCESSOR(Lfo) REGISTER_UNBUFFERED_PROCESSOR(BassDrum) REGISTER_UNBUFFERED_PROCESSOR(SnareDrum) - // REGISTER_UNBUFFERED_PROCESSOR(HighHat) + REGISTER_UNBUFFERED_PROCESSOR(HighHat) REGISTER_BUFFERED_PROCESSOR(FmDrum) REGISTER_BUFFERED_PROCESSOR(PulseShaper) REGISTER_BUFFERED_PROCESSOR(PulseRandomizer) @@ -94,8 +94,8 @@ void Processors::Init(uint8_t index) { bass_drum_.Init(); snare_drum_.Init(); - // high_hat_.Init(); - // high_hat_.set_open(index == 1); + high_hat_.Init(); + high_hat_.set_open(index == 1); fm_drum_.Init(); fm_drum_.set_sd_range(index == 1); bouncing_ball_.Init(); diff --git a/peaks/processors.h b/peaks/processors.h index c4761f7..75fad66 100755 --- a/peaks/processors.h +++ b/peaks/processors.h @@ -40,7 +40,7 @@ #include "peaks/drums/bass_drum.h" #include "peaks/drums/fm_drum.h" #include "peaks/drums/snare_drum.h" -// #include "peaks/drums/high_hat.h" +#include "peaks/drums/high_hat.h" #include "peaks/modulations/bouncing_ball.h" #include "peaks/modulations/lfo.h" #include "peaks/modulations/mini_sequencer.h" @@ -61,7 +61,7 @@ enum ProcessorFunction { PROCESSOR_FUNCTION_TAP_LFO, PROCESSOR_FUNCTION_BASS_DRUM, PROCESSOR_FUNCTION_SNARE_DRUM, - // PROCESSOR_FUNCTION_HIGH_HAT, + PROCESSOR_FUNCTION_HIGH_HAT, PROCESSOR_FUNCTION_FM_DRUM, PROCESSOR_FUNCTION_PULSE_SHAPER, PROCESSOR_FUNCTION_PULSE_RANDOMIZER, @@ -213,7 +213,7 @@ class Processors { DECLARE_BUFFERED_PROCESSOR(Lfo, lfo_); DECLARE_UNBUFFERED_PROCESSOR(BassDrum, bass_drum_); DECLARE_UNBUFFERED_PROCESSOR(SnareDrum, snare_drum_); - // DECLARE_UNBUFFERED_PROCESSOR(HighHat, high_hat_); + DECLARE_UNBUFFERED_PROCESSOR(HighHat, high_hat_); DECLARE_BUFFERED_PROCESSOR(FmDrum, fm_drum_); DECLARE_BUFFERED_PROCESSOR(PulseShaper, pulse_shaper_); DECLARE_BUFFERED_PROCESSOR(PulseRandomizer, pulse_randomizer_); diff --git a/peaks/ui.cc b/peaks/ui.cc index 047c792..95d36c4 100755 --- a/peaks/ui.cc +++ b/peaks/ui.cc @@ -70,7 +70,7 @@ const ProcessorFunction Ui::function_table_[FUNCTION_LAST][2] = { { PROCESSOR_FUNCTION_FM_DRUM, PROCESSOR_FUNCTION_FM_DRUM }, { PROCESSOR_FUNCTION_RANDOMISED_BASS_DRUM, PROCESSOR_FUNCTION_RANDOMISED_SNARE_DRUM }, - // { PROCESSOR_FUNCTION_HIGH_HAT, PROCESSOR_FUNCTION_HIGH_HAT }, + { PROCESSOR_FUNCTION_HIGH_HAT, PROCESSOR_FUNCTION_HIGH_HAT }, }; Storage<0x8020000, 16> storage; @@ -188,7 +188,7 @@ inline void Ui::RefreshLeds() { leds_.set_pattern(4); // top LED-> X X x X break; // extended DRUM functions - // case FUNCTION_HIGH_HAT: + case FUNCTION_HIGH_HAT: case FUNCTION_FM_DRUM_GENERATOR: case FUNCTION_RANDOMISED_DRUM_GENERATOR: leds_.set_pattern(8); // top LED-> 0 0 X x @@ -244,9 +244,9 @@ inline void Ui::RefreshLeds() { leds_.set_pattern(15); // top LED-> X X x X break; // extended DRUM functions - // case FUNCTION_HIGH_HAT: - // leds_.set_pattern(10); // top LED-> 0 X 0 x - // break; + case FUNCTION_HIGH_HAT: + leds_.set_pattern(10); // top LED-> 0 X 0 x + break; case FUNCTION_FM_DRUM_GENERATOR: leds_.set_pattern(9); // top LED-> X 0 0 x break; @@ -266,7 +266,7 @@ inline void Ui::RefreshLeds() { case FUNCTION_DRUM_GENERATOR: case FUNCTION_FM_DRUM_GENERATOR: case FUNCTION_RANDOMISED_DRUM_GENERATOR: - // case FUNCTION_HIGH_HAT: + case FUNCTION_HIGH_HAT: b[i] = abs(brightness_[i]) >> 8; b[i] = b[i] > 255 ? 255 : b[i]; break; @@ -444,7 +444,7 @@ void Ui::SetFunction(uint8_t index, Function f) { } break; case FUNCTION_FM_DRUM_GENERATOR: - // case FUNCTION_HIGH_HAT: + case FUNCTION_HIGH_HAT: case FUNCTION_RANDOMISED_DRUM_GENERATOR: if (edit_mode_ == EDIT_MODE_SPLIT || edit_mode_ == EDIT_MODE_TWIN) { last_ext_drum_function_[0] = last_ext_drum_function_[1] = f; diff --git a/peaks/ui.h b/peaks/ui.h index a05975b..71a98f0 100755 --- a/peaks/ui.h +++ b/peaks/ui.h @@ -85,7 +85,7 @@ enum Function { FUNCTION_FM_DRUM_GENERATOR, FUNCTION_RANDOMISED_DRUM_GENERATOR, - // FUNCTION_HIGH_HAT, + FUNCTION_HIGH_HAT, FUNCTION_LAST, FUNCTION_FIRST_BASIC_FUNCTION = FUNCTION_ENVELOPE, @@ -101,7 +101,7 @@ enum Function { FUNCTION_LAST_EXTENDED_TAP_FUNCTION = FUNCTION_BYTEBEATS, FUNCTION_FIRST_EXTENDED_DRUM_FUNCTION = FUNCTION_FM_DRUM_GENERATOR, - FUNCTION_LAST_EXTENDED_DRUM_FUNCTION = FUNCTION_RANDOMISED_DRUM_GENERATOR, + FUNCTION_LAST_EXTENDED_DRUM_FUNCTION = FUNCTION_HIGH_HAT, }; struct Settings {