Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pio committed Nov 6, 2024
1 parent e6c4571 commit f7a4a5a
Show file tree
Hide file tree
Showing 37 changed files with 11,424 additions and 0 deletions.
29 changes: 29 additions & 0 deletions DelayStereo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# HexeFX Stereo Modulated Ping-Pong Delay for Teensy4.x
Example PlatformIO project using the Stereo Ping-Pong Delay component from the `hexefx_audioLibrary_i16`, compatible with the standard Teensy Audio Library.
## Hardware
Default hardware is either Teensy4.1 or Teensy4.0 with Audio Adapter Board Rev.D.
## Usage
1. Open the project in the PlatformIO environment.
2. Build the project and upload it to the Teensy4 board.
3. Open the `DelayStereo_I16.html` file placed in the `html` folder in Chrome, Chromium or Edge browser (others do not implement WebMIDI and WebSerial).
4. Connect to the USB MIDI interface listed as Teensy.
5. Click `Connect` button on the top of the page and choose Teensy Serial port.
6. Use the dials and buttons to control the effect.

## Controls
* **On/Off** button - delay bypass
* **Time** - delay time
* **Inertia** - delay time update speed resuling is pitch up/down effects
* **Repeats** - delay feeedback control
* **Mix** - dry/wset mix control
* **HiCut** - lowpass filter placed in the feedback loop, makes each repeat darker
* **LowCut** - highpass filter placed in the feedback loop, makes each repat loose low end
* **Treble** - wet signal output treble control
* **Bass** - wet signal output bass control
* **ModRate** - modulation rate
* **ModDepth** - modulation depth
* **Freeze** - button, Freeze on/off
* **Tap** - button, delay time tap tempo
___
Copyright 11.2024 by Piotr Zapart
www.hexefx.com
36 changes: 36 additions & 0 deletions PlateReverbStereo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# HexeFX Plate Reverb Stereo for Teensy4.x
Example PlatformIO project using the Plate Reverb component from the `hexefx_audioLibrary_I16`, compatible with the standard Teensy Audio Library.
## Usage
1. Open the project in the PlatformIO environment.
2. Build the project and upload it to the Teensy4 board.
3. Open the `PlateReverb_I16.html` file placed in the `html` folder in Chrome, Chromium or Edge browser (others do not implement WebMIDI and WebSerial).
4. Connect to the USB MIDI interface listed as Teensy.
5. Click `Connect` button on the top of the page and choose Teensy Serial port.
6. Use the dials and buttons to control the effect.

## Main Controls
* **Bypass** button
* **Size** - reverb time
* **Diffusion** - lower values create more echo reflections in the reverb tail
* **Mix** - dry/wet mixer

## Filter Controls
* **LoCut** - reverb tail bass loss
* **HiCut** - reverb tail treble loss
* **Lowpass** - output treble control
* **Hipass** - output bass control

## Freeze Controls
* **Freeze** On/Off button for the Freeze (infinite reverb) mode
* **BleedIn** - controls how much of the input signal is fed into the reverb tank while in Freeze mode

## Pitch Controls
* **Pitch** - main pitch shifter applied to the whole reverb sound, range from -12 to +24 semitones
* **Pitch mix** - main pitch shifter dry/wet mixer

## Shimmer Controls
* **Shimmer** - amount of shimmer effect applied to the reverb tail
* **PitchShim** - pitch setting for the Shimmer effect.
___
Copyright 11.2024 by Piotr Zapart
www.hexefx.com
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# hexefx_audiolib_i16
Audio effects library for Teensy4.x standard Audio Library.
The effecs are ported from the main [floating point version of the library](https://github.com/hexeguitar/hexefx_audiolib_F32 "hexefx_audiolib_F32").

## Effects

### [Plate Reverb Stereo](PlateReverbStereo.md "Plate Reverb Stereo")
### [Spring Reverb Stereo](SpringReverb.md "Spring Reverb Stereo")
### [Reverb SC Stereo](ReverbSC.md "Reverb SC Stereo")
### [Stereo Modulated Ping-Pong Delay](DelayStereo.md "Stereo Modulated Ping-Pong Delay")

---
Copyright 11.2024 by Piotr Zapart
www.hexefx.com

23 changes: 23 additions & 0 deletions ReverbSC.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# HexeFX Stereo Reverb SC for Teensy4.x
Example PlatformIO project using the Stereo Reverb SC component from the `hexefx_audioLibrary_i16`, compatible with the standard Teensy Audio Library.
This reverb uses an extensive **387k** of RAM2 (DMARAM) for the delay buffers. Use with caution when combining it with the rest of the project.
## Hardware
Default hardware is either Teensy4.1 or Teensy4.0 with Audio Adapter Board Rev.D.
## Usage
1. Open the project in the PlatformIO environment.
2. Build the project and upload it to the Teensy4 board.
3. Open the `ReverbSC_I16.html` file placed in the `html` folder in Chrome, Chromium or Edge browser (others do not implement WebMIDI and WebSerial).
4. Connect to the USB MIDI interface listed as Teensy.
5. Click `Connect` button on the top of the page and choose Teensy Serial port.
6. Use the dials and buttons to control the effect.

## Controls
* **On/Off** button - delay bypass
* **Freeze** - button, Freeze on/off
* **Time** - reverb time
* **TrebleCut** - lowpass filter placed in the feedback loop, makes each repeat darker
* **Mix** - dry/wset mix control
* **MCU RST** - Teensy software reset
___
Copyright 11.2024 by Piotr Zapart
www.hexefx.com
21 changes: 21 additions & 0 deletions SpringReverb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# HexeFX Stereo Spring Reverb for Teensy4.x
Example PlatformIO project using the Stereo Spring Reverb component from the `hexefx_audioLibrary_i16`, compatible with the standard Teensy Audio Library.
## Hardware
Default hardware is either Teensy4.1 or Teensy4.0 with Audio Adapter Board Rev.D.
## Usage
1. Open the project in the PlatformIO environment.
2. Build the project and upload it to the Teensy4 board.
3. Open the `SpringReverb_I16.html` file placed in the `html` folder in Chrome, Chromium or Edge browser (others do not implement WebMIDI and WebSerial).
4. Connect to the USB MIDI interface listed as Teensy.
5. Click `Connect` button on the top of the page and choose Teensy Serial port.
6. Use the dials and buttons to control the effect.

## Controls
* **On/Off** button - reverb bypass
* **Time** - reverb time
* **TrebleCut** - lowpass filter placed in the feedback loop, makes the faiding out reverb tail darker
* **BassCut** - highpass filter placed in the feedback loop, makes the faiding reverb tail loose the low end
* **Mix** - dry/wset mix control
___
Copyright 11.2024 by Piotr Zapart
www.hexefx.com
203 changes: 203 additions & 0 deletions examples/DelayStereo_Arduino/DelayStereo_Arduino.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
/**
* @file DelayStereo_Arduino.ino
* @author Piotr Zapart
* @brief Example project for the Stereo Ping-Pong Modulated Delay component
int16_t standard Teensy Audio library compatible
* required libraries:
* HexeFX_audiolib_I16 https://github.com/hexeguitar/hexefx_audiolib_I16
*
* @version 0.1
* @date 2024-11-11
*
* @copyright Copyright www.hexefx.com (c) 2024
*
*/
#include <Audio.h>
#include <hexefx_audio_I16.h>

#ifndef DBG_SERIAL
#define DBG_SERIAL Serial
#endif

AudioControlSGTL5000 codec;
AudioInputI2S i2s_in;
AudioEffectDelayStereo_i16 echo;
AudioOutputI2S i2s_out;

AudioConnection cable1(i2s_in, 0, echo, 0);
AudioConnection cable2(i2s_in, 1, echo, 1);
AudioConnection cable3(echo, 0, i2s_out, 0);
AudioConnection cable4(echo, 1, i2s_out, 1);

enum
{
// Delay controls
MIDI_CC_DELAY_TIME = 1,
MIDI_CC_DELAY_INERTIA = 2,
MIDI_CC_DELAY_FEEDBACK = 3,
MIDI_CC_DELAY_MIX = 4,
MIDI_CC_DELAY_MOD_RATE = 5,
MIDI_CC_DELAY_MOD_DEPTH = 6,
MIDI_CC_DELAY_TREBLE_CUT = 7,
MIDI_CC_DELAY_BASS_CUT = 8,
MIDI_CC_DELAY_TREBLE = 9,
MIDI_CC_DELAY_BASS = 10
};

enum
{
MIDI_NOTE_DELAY = 33,
MIDI_NOTE_DELAY_TAP = 36,
MIDI_NOTE_DELAY_FREEZE = 37,
// --- diverse ---
MIDI_NOTE_MCU_RESET = 127
};

// Callbacks for MIDI
void cb_NoteOn(uint8_t channel, uint8_t note, uint8_t velocity);
void cb_NoteOff(uint8_t channel, uint8_t note, uint8_t velocity);
void cb_ControlChange(uint8_t channel, uint8_t control, uint8_t value);

uint32_t timeNow, timeLast;
const char PROGMEM *termPosHome = "\x1b[;H";

void printMemInfo(void);

void setup()
{
DBG_SERIAL.begin(115200);

AudioMemory(20);

if (!codec.enable()) DBG_SERIAL.println("Codec init error!");
codec.inputSelect(AUDIO_INPUT_LINEIN);
codec.volume(0.8f);
codec.lineInLevel(10, 10);
codec.adcHighPassFilterDisable();

DBG_SERIAL.println("Codec initialized.");

// set callbacks for USB MIDI
usbMIDI.setHandleNoteOn(cb_NoteOn);
usbMIDI.setHandleNoteOff(cb_NoteOff);
usbMIDI.setHandleControlChange(cb_ControlChange);

echo.bypass_set(false);
}

void loop()
{
usbMIDI.read();
timeNow = millis();
if (timeNow - timeLast > 500)
{
printMemInfo();
timeLast = timeNow;
}
}
/**
* @brief USB MIDI NoteOn callback
*
* @param channel
* @param note
* @param velocity
*/
void cb_NoteOn(uint8_t channel, uint8_t note, uint8_t velocity)
{
switch(note)
{
case MIDI_NOTE_DELAY:
echo.bypass_set(false);
break;
case MIDI_NOTE_DELAY_FREEZE:
echo.freeze(true);
break;
case MIDI_NOTE_DELAY_TAP:
echo.tap_tempo();
break;
case MIDI_NOTE_MCU_RESET:
SCB_AIRCR = 0x05FA0004; // MCU reset
break;
default:
break;
}
}

void cb_NoteOff(uint8_t channel, uint8_t note, uint8_t velocity)
{
switch(note)
{

case MIDI_NOTE_MCU_RESET:
break;
case MIDI_NOTE_DELAY:
echo.bypass_set(true);
break;
case MIDI_NOTE_DELAY_FREEZE:
echo.freeze(false);
break;
default:
break;
}
}

void cb_ControlChange(uint8_t channel, uint8_t control, uint8_t value)
{
float32_t valuef = (float32_t) value / 127.0f;
switch(control)
{

// --- Delay---
case MIDI_CC_DELAY_TIME:
echo.time(valuef);
break;
case MIDI_CC_DELAY_INERTIA:
echo.inertia(valuef);
break;
case MIDI_CC_DELAY_FEEDBACK:
echo.feedback(valuef);
break;
case MIDI_CC_DELAY_MIX:
echo.mix(valuef);
break;
case MIDI_CC_DELAY_MOD_RATE:
echo.mod_rate(valuef);
break;
case MIDI_CC_DELAY_MOD_DEPTH:
echo.mod_depth(valuef);
break;
case MIDI_CC_DELAY_BASS_CUT:
echo.bass_cut(valuef);
break;
case MIDI_CC_DELAY_TREBLE_CUT:
echo.treble_cut(valuef);
break;
case MIDI_CC_DELAY_BASS:
echo.bass(valuef);
break;
case MIDI_CC_DELAY_TREBLE:
echo.treble(valuef);
break;


default: break;
}
}

void printMemInfo(void)
{
static const char *on = "\x1b[32mon \x1b[0m";
static const char *off = "\x1b[31moff\x1b[0m";
float load_dl = echo.processorUsageMax();
echo.processorUsageMaxReset();

float load = AudioProcessorUsageMax();
AudioProcessorUsageMaxReset();

DBG_SERIAL.printf("%sCPU usage: delay = %2.2f%% max = %2.2f%% \r\n", termPosHome, load_dl, load);

DBG_SERIAL.printf("Delay %s \tFreeze %s\r\n",
echo.bypass_get()?off:on,
echo.freeze_get()?on:off);
}

Loading

0 comments on commit f7a4a5a

Please sign in to comment.