الدواسة الجاهزة
بناء دواسة مؤثرات رقمية يعمل في كل درس على نفس اللوحة:
- The guitar: a مولّد إشارات، جيبية بتردد 220 Hz وسعة 2 V، متمركزة حول 0 V مثل إشارة القطع (pickup).
- The input: a 1 uF capacitor into A0, held at 2.5 V by two 10 k resistors: هذا الانحياز.
- The brain: an لوحة Arduino Uno، محوّلها ADC يعمل حرًا على A0 والمؤقت 2 يقاطع 15,625 مرة في الثانية.
- المخرج: إشارة PWM بدقة 8 بت بتردد 62.5 kHz على الطرف 9، ملساء بمقاومة 1 k ومكثف 100 nF، ثم مكثف 1 uF إلى قطعة بيزو تُظهر درجة النغمة التي تسمعها.
- Controls: a potentiometer on A1, and two مفاتيح القدم: MUTE on pin 2 stops the strings, FX on pin 3 switches the effect.
هذه دواسة غيتار رقمية، وهي شيء مختلف عن دواسات سباق المحاكاة في درس بناء دواسات خلية الحمل.
كيف يعمل
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.
الدورة
- الدخل والخرج الصوتي: الانحياز، والتأرجح، وأخذ العيّنات ونظرية Nyquist، ولماذا يحتاج المدخل الحقيقي إلى عازل.
- Gain and clipping: clean gain, hard and soft clipping, and harmonics.
- Delay: a ring buffer, feedback, the tail, and the 2 KB limit.
- التريمولو: سرعة LFO وعمقه وشكله.
- واه: مرشّح تمرير نطاقي ماسح، وواه تلقائي، ومعامل Q.
- زمن الاستجابة: عيّنة بعيّنة مقابل المعالجة بالكتل.
- مشروع: صندوق مؤثرين: تشويه وترمولو في سلسلة، مع تجاوز، وتبديل الترتيب.
كل خطوة محقَّقة تُختبر على الدائرة العاملة.