This shows you the differences between two versions of the page.
pm:prj2023:dene:pedala-chitara-programabila [2023/05/21 13:53] stefan.jumarea Add hw milestone |
pm:prj2023:dene:pedala-chitara-programabila [2023/05/29 16:25] (current) stefan.jumarea [Download] Add source code |
||
---|---|---|---|
Line 48: | Line 48: | ||
Se vor implementa mai multe efecte, printre care: | Se vor implementa mai multe efecte, printre care: | ||
- | * Volume booster | + | * Volume Booster |
- | * Fuzz | + | |
- | * Delay | + | |
* Distortion | * Distortion | ||
+ | * Pitch Shifter | ||
+ | * Chorus | ||
- | ===== Rezultate Obţinute ===== | + | Totul se va implementa în întreruperea dată de ADC. În ''setup()'' se vor face configurările pentru IO, ADC și PWM. În funcția ''loop()'' doar se va aprinde ledul și se va seta efectul dorit în funcție de numărul de toogle-uri are switchului. |
+ | ==== Volume Booster ==== | ||
+ | Pentru a realiza un efect de Volume Booster, se va prelua semnalul de la ADC și se va aduna la el o valoare pentru a modifica volumul: | ||
+ | ''input += booster_var;'', unde ''booster_var'' este o variablilă ce se va modifica | ||
+ | folosind butoanele. Dacă ''booster_var'' este un întreg pozitiv, volumul va fi mărit, altfel va fi scăzut. | ||
- | ===== Concluzii ===== | + | ==== Distortion ==== |
- | ===== Download ===== | + | Pentru a se realiza un efect de Distortion, se vor selecta toate armonicele cu un volum mai mic ca o variabilă dată, și se vor ridica toate la un prag: |
+ | Mai multe detalii aici: | ||
+ | [[https://en.wikipedia.org/wiki/Distortion#Harmonic_distortion]] | ||
- | ===== Jurnal ===== | + | <code> |
+ | if (!digitalRead(PUSHBUTTON_2)) { | ||
+ | if (distortion_threshold < 32768) | ||
+ | distortion_threshold = distortion_threshold + 25; | ||
+ | } | ||
+ | |||
+ | if (!digitalRead(PUSHBUTTON_1)) { | ||
+ | if (distortion_threshold > 0) | ||
+ | distortion_threshold = distortion_threshold - 25; | ||
+ | } | ||
+ | if (input > distortion_threshold) | ||
+ | input = distortion_threshold; | ||
+ | </code> | ||
+ | |||
+ | ==== Pitch Shifter ==== | ||
+ | |||
+ | Pentru a se realiza un efect de Pitch Shifter, se va modifica frecvența cu care este citit și transmis semnalul. Astfel se poate modifica pitch-ul semnalului, prin întârzierea transmiterii semnalului. | ||
+ | |||
+ | <code> | ||
+ | if (!digitalRead(PUSHBUTTON_2)) { | ||
+ | if (pitch_var < 500) | ||
+ | pitch_var = pitch_var + 25; | ||
+ | } | ||
+ | |||
+ | if (!digitalRead(PUSHBUTTON_1)) { | ||
+ | if (pitch_var > 0) | ||
+ | pitch_var = pitch_var - 25; | ||
+ | } | ||
+ | |||
+ | counter2++; | ||
+ | if (counter2 >= dist_variable) { | ||
+ | counter2 = 0; | ||
+ | | ||
+ | // read input | ||
+ | ... | ||
+ | | ||
+ | // write output | ||
+ | ... | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ | ==== Chorus ==== | ||
+ | |||
+ | Pentru a se realiza un efect de Chorus, se va combina semnalul primit cu o copie a sa, puțin întârziată. Efectul poate fi mai intens sau mai puțin intens în funcție de dimensiunea bufferului în care se reține copia semnalului. | ||
+ | |||
+ | <code> | ||
+ | if (!digitalRead(PUSHBUTTON_2)) { | ||
+ | if (chorus_counter < MAX_VALUE) | ||
+ | chorus_counter = chorus_counter + 1; | ||
+ | } | ||
+ | |||
+ | if (!digitalRead(PUSHBUTTON_1)) { | ||
+ | if (chorus_counter > MIN_VALUE) | ||
+ | chorus_counter = chorus_counter - 1; | ||
+ | } | ||
+ | |||
+ | ch_delay_cnt ++; | ||
+ | |||
+ | // Populate the buffer | ||
+ | if (ch_delay_cnt >= delay_depth) { | ||
+ | ch_delay_cnt = 0; | ||
+ | if (count_up) { | ||
+ | for (p = 0; p < buff_len + 1; p++) | ||
+ | chorusBuffer[delay_depth + p] = chorusBuffer[delay_depth - 1]; | ||
+ | delay_depth = delay_depth + buff_len; | ||
+ | | ||
+ | if (delay_depth > MAX_DELAY) | ||
+ | count_up = 0 | ||
+ | } else { | ||
+ | delay_depth = delay_depth - buff_len; | ||
+ | if (delay_depth < MIN_DELAY) | ||
+ | count_up = 1 | ||
+ | } | ||
+ | } | ||
+ | | ||
+ | // send chorusBuffer[ch_delay_cnt] to output | ||
+ | </code> | ||
+ | |||
+ | Cod adaptat de la: | ||
+ | [[https://github.com/ElectroSmash/pedalshield/blob/master/chorus_vibrato/chorus_vibrato.ino]]. | ||
+ | |||
+ | ===== Download ===== | ||
+ | |||
+ | {{:pm:prj2023:dene:jumarea_stefan_cod.zip}} | ||
===== Bibliografie/Resurse ===== | ===== Bibliografie/Resurse ===== | ||
+ | Resurse pentru hardware: | ||
+ | * [[https://neatcircuits.com/doctor_pedal.htm|Tone Stage]] | ||
+ | * [[https://www.wamplerpedals.com/blog/uncategorized/2020/05/how-to-design-a-basic-overdrive-pedal-circuit/|Basic Stuff, Filtre, Input/Output Stage, etc.]] | ||
+ | * [[https://cushychicken.github.io/posts/ltspice-tube-screamer/| More of the Same]] | ||
+ | |||
+ | Resurse pentru software: | ||
+ | * [[https://en.wikipedia.org/wiki/Distortion#Harmonic_distortion|Distortion]] | ||
+ | * [[https://www.fuelrocks.com/how-to-use-the-pitch-shift-guitar-effect/|Pitch Shifter]] | ||
+ | * [[https://github.com/ElectroSmash/pedalshield/blob/master/chorus_vibrato/chorus_vibrato.ino|Chorus]] | ||
+ | * [[https://github.com/ElectroSmash|Workflow Cod]] | ||
<html><a class="media mediafile mf_pdf" href="?do=export_pdf">Export to PDF</a></html> | <html><a class="media mediafile mf_pdf" href="?do=export_pdf">Export to PDF</a></html> | ||