8-bit digital delay / Bitcrusher LO-FI / Inverted DSP pedal effects for guitar, vocals, synths, etc.
Devices and components
Arduino-Nano
10k ohm resistance
Resistance 4.75k ohms
100nF capacitor
Resistance 2.21k ohms
Push button switch, Push On-Push Off
2.7nF capacitor
33nF capacitor
Push button switch, momentary
Resistance 6.8k
2.2uF electrolytic capacitor
Breadboard (generic)
100k ohm resistance
Software and tools
Arduino IDE
Project description
Video in operation:
Features:
Digital delay with 6 selectable delay times (63 to 300 ms).
Effect that freezes the sound.
Reverse speech.
8-bit LO-FI with the authentic retro sound of 80s games.
Real-time effects.
Use an Arduino Nano (or UNO).
Simple, easy to assemble and inexpensive.
Installation photo:
How it works:
Schematics/Wiring:
Instructions:
Open the sketch in Arduino IDE, connect the Arduino, set the right port.
Compile the sketch and send it to Arduino.
Assemble the circuit following the schematic diagram to make the electrical connections.
Operation:
Power the Arduino via the USB port or via a 7-9V battery connected to the Vin pin.
Connect the audio source to the audio input and the output to an audio amplifier, which can be a PC sound amplifier.
Press to turn on switches SW2 and SW3.
Press push button S1 successively to select the 6 delays as well as Reverse Speech mode. Available delay time values are: 63ms, 110ms, 158ms, 205ms, 253ms, 300ms and Reverse Speech. The Arduino status LED lights up to indicate when the push button is pressed and the TX LED lights up to indicate that it is in reverse speech mode.
Press to turn off the SW3 switch to freeze the sound. Then tap it again to return.
Press to turn off the switch SW2 to cut the feedback, this way we will only have the processed signal (wet) to obtain the LO-FI sound of 8Bit, Bitcrusher and reverse speech.
Possible improvements for use with guitars:
8-bit digital delay sketch
Load it on Arduino to make it work
1/*****************************************************************************************************************************
2 echoTrek - 8Bit Digital Delay / LO-FI Bitcrusher / Reverse Speech DSP Pedal Effects for Guitar, Voice, Synths, etc.
3 Works with Arduino UNO R3 / NANO / PRO MINI - See the schematics for wiring details. By J. CesarSound - ver 1.0 - Jan/2021.
4******************************************************************************************************************************/
5
6#define audio_in A0
7#define time_selector A3
8
9const unsigned int d_size = 1900; //Delay memory buffer size
10unsigned int val, d_val, d_time;
11int i, j;
12byte count = 2;
13bool rev = 0;
14char delay_data[d_size + 1] = { NULL }; //Delay memory buffer
15char delay_data_1[d_size + 1] = { NULL }; //Delay memory buffer
16
17
18void setup() {
19 pinMode(time_selector, INPUT_PULLUP);
20 DDRD = B00000010;
21 DDRB = B11100000;
22 InitTimer1(); //Set up timer 1 for 16.384kHz
23 setPwmFrequency(5, 1); //function for setting PWM High frequency 62.475kHz on pin D5
24 analogReference(INTERNAL); //Use 1.1v aref voltage.
25 up_time();
26}
27
28void loop() {
29 if (digitalRead(time_selector) == LOW) {
30 up_time();
31 PORTB = B11100000; //make pin 13 high and power on the led when pushbutton is pressed
32 while (digitalRead(time_selector) == LOW);
33 } else PORTB = B11000000; //make pin 13 low and power off the led pushbutton is released
34 if (rev) PORTD = B00000000; else PORTD = B00000010; //Reverse speech sampler indication TX Led power on
35}
36
37void sampling() {
38 val = map(analogRead(audio_in), 0, 900, 0, 255);
39 delay_sound();
40 analogWrite(5, d_val);
41}
42
43void delay_sound() {
44 i = i + 1; if (i > d_time) i = 0;
45 delay_data[i] = val;
46 if (i == d_time) j = 0;
47 delay_data_1[i] = delay_data[i];
48 j = j + 1; if (j > d_time) j = 0;
49 if (!rev) d_val = delay_data_1[j];
50 if (rev) d_val = delay_data_1[d_time - j];
51}
52
53void up_time() {
54 noInterrupts();
55 count++;
56 if (count > 7)
57 count = 1;
58 delay(20);
59
60 switch (count) {
61 case 1:
62 d_time = 400; rev = 0; //63ms
63 break;
64 case 2:
65 d_time = 700; //110ms
66 break;
67 case 3:
68 d_time = 1000; //158ms
69 break;
70 case 4:
71 d_time = 1300; //205ms
72 break;
73 case 5:
74 d_time = 1600; //253ms
75 break;
76 case 6:
77 d_time = 1900; //300ms
78 break;
79 case 7:
80 d_time = 1500; rev = 1; //Reverse speech
81 break;
82 } interrupts();
83}
84
85//Set up timer 1 for 16.384kHz (975)
86void InitTimer1() {
87 cli(); //Disable global interrupts
88 TCCR1A = 0; //Reset Timer 1 Counter Control Register A
89 TCCR1B = 0; //Reset Timer 1 Counter Control Register B
90 TCNT1 = 0; //initialize counter value to 0
91 OCR1A = 975; //Set Timer 1 to desired frequency: 16384Hz (16,000,000 / 16384) - 1 = 975
92 //Turn on CTC (clear timer on compare match) mode:
93 TCCR1B |= (1 << WGM12);
94 TCCR1B |= (1 << CS10); //CS10 Prescalar = 1 (no prescalar used); CS11 Prescalar = 8
95 TIMSK1 |= (1 << OCIE1A); //Enable timer interrupt
96 sei(); //Enable interrupts
97}
98
99ISR(TIMER1_COMPA_vect) {
100 sampling();
101}
102
103//PWM 62.475kHz high frequency DAC for pins 5 & 6 (others are 32k)
104void setPwmFrequency(int pin, int divisor) {
105 byte mode;
106 if (pin == 5 || pin == 6 || pin == 9 || pin == 10) {
107 switch (divisor) {
108 case 1: mode = 0x01; break;
109 case 8: mode = 0x02; break;
110 case 64: mode = 0x03; break;
111 case 256: mode = 0x04; break;
112 case 1024: mode = 0x05; break;
113 default: return;
114 }
115 if (pin == 5 || pin == 6) {
116 TCCR0B = TCCR0B & 0b11111000 | mode;
117 } else {
118 TCCR1B = TCCR1B & 0b11111000 | mode;
119 }
120 } else if (pin == 3 || pin == 11) {
121 switch (divisor) {
122 case 1: mode = 0x01; break;
123 case 8: mode = 0x02; break;
124 case 32: mode = 0x03; break;
125 case 64: mode = 0x04; break;
126 case 128: mode = 0x05; break;
127 case 256: mode = 0x06; break;
128 case 1024: mode = 0x07; break;
129 default: return;
130 }
131 TCCR2B = TCCR2B & 0b11111000 | mode;
132 }
133}
Note: Content and images are from: https://projecthub.arduino.cc/, with some modifications.
If you want it removed due to copyright reasons, please leave a comment. Thank you.
I want to share this article more widely so that everyone knows about Arduino and your project.