Pédal hoàn chỉnh
Xây pedal hiệu ứng kỹ thuật số dùng chung một bo mạch cho mọi bài học:
- The guitar: a máy tạo tín hiệu, sóng sin 220 Hz, đỉnh 2 V, lấy 0 V làm tâm như tín hiệu của pickup.
- The input: a 1 uF capacitor into A0, held at 2.5 V by two 10 k resistors: đó là điện áp phân cực.
- The brain: an Arduino Uno, ADC của nó chạy liên tục trên A0 và Timer 2 ngắt 15.625 lần mỗi giây.
- Đầu ra: PWM 8-bit ở 62.5 kHz trên chân 9, được làm mượt bằng 1 k và 100 nF, rồi qua 1 uF tới một piezo phát ra cao độ mà nó nghe được.
- Controls: a potentiometer on A1, and two công tắc chân: MUTE on pin 2 stops the strings, FX on pin 3 switches the effect.
Đây là pedal guitar kỹ thuật số. Nó khác với pedal trong mô phỏng đua xe ở bài Xây pedal cảm biến lực.
Cách hoạt động
In and out. The capacitor blocks DC and the divider puts the swing in the middle of the ADC's 0 to 5 V; the code subtracts 128 to take the bias off. Each interrupt takes the latest sample, runs the effect and writes OCR1A. The knob is read eight times a second by borrowing the ADC for a sample.
Gain and clipping. Multiply, then limit: hard clipping cuts flat at the rails; soft clipping bends through y = 1.5t - 0.5t^3 first, from a 256-entry table.
Delay. A ring buffer of 1,280 bytes, all the Uno's 2 KB can spare beside the stack: 81 ms at most. Feedback writes some of the echo back for repeats, and MUTE measures the tail.
Tremolo. A slow phase accumulator, an LFO, scales every sample between 1 - depth and 1, as a triangle or a square.
Wah. Chamberlin's state-variable filter in fixed point, its band-pass output swept from 200 Hz to 2 kHz by the knob or by an LFO for auto-wah.
Latency. Sample by sample, the output follows the input within a tick. Working in blocks of 64 or 256 adds 4.1 or 16.4 ms, measured with MUTE.
Khóa học
- Âm thanh vào và ra: điện áp phân cực, biên độ, lấy mẫu và Nyquist, và vì sao đầu vào thật cần một bộ đệm.
- Gain and clipping: clean gain, hard and soft clipping, and harmonics.
- Delay: a ring buffer, feedback, the tail, and the 2 KB limit.
- Tremolo: tốc độ, độ sâu và dạng sóng của LFO.
- Wah: band-pass quét được, auto-wah và Q.
- Độ trễ: xử lý từng mẫu so với xử lý theo khối.
- Dự án: pedals hai hiệu ứng: drive và tremolo nối tiếp, bypass, và đổi thứ tự.
Mỗi bước được kiểm tra đều được đối chiếu với mạch đang chạy.