first commit
This commit is contained in:
commit
ce35f29d7a
145
README.md
Normal file
145
README.md
Normal file
@ -0,0 +1,145 @@
|
||||
# NoiceSynth - A Compact RP2040 Synthesizer
|
||||
|
||||
A pocket-sized, battery-powered MIDI synthesizer built around the Raspberry Pi Pico. It's designed to be housed in a small enclosure (like an Altoids tin) and features an I2S DAC for quality audio, an OLED display for visual feedback, and a TRS MIDI input.
|
||||
|
||||
This guide provides the blueprint for building your own.
|
||||
|
||||
## Features
|
||||
|
||||
- **Compact & Portable**: Designed to be powered by a LiPo battery and fit into a small tin.
|
||||
- **High-Quality Audio**: Uses an I2S audio module for clean, low-noise sound output.
|
||||
- **MIDI Connectivity**: Standard 3.5mm TRS-A MIDI input for control with external keyboards and sequencers.
|
||||
- **Expressive Controls**: Features a rotary encoder for navigation and a potentiometer for volume control.
|
||||
- **Visual Feedback**: A crisp 128x64 OLED display shows synth parameters and status.
|
||||
|
||||
## Hardware Requirements
|
||||
|
||||
| Component | Description |
|
||||
| ---------------------- | ---------------------------------------------------------------------------- |
|
||||
| **MCU** | Raspberry Pi Pico or Pico W (RP2040) |
|
||||
| **Audio Output** | I2S DAC Amplifier (e.g., MAX98357A or PCM5102A) with a 3.5mm headphone jack. |
|
||||
| **Display** | 0.96" SSD1306 128x64 I2C OLED Display. |
|
||||
| **Controls** | 1x Rotary Encoder with push-button, 1x 10kΩ Potentiometer. |
|
||||
| **MIDI Input** | 1x 3.5mm TRS (Stereo) Jack. |
|
||||
| **Power** | 3.7V LiPo Battery and a 5V booster/charger board (e.g., Adafruit PowerBoost). |
|
||||
| **MIDI Circuit Parts** | 6N138 or 6N137 Optocoupler, 1N4148 Diode, various resistors (see diagram). |
|
||||
|
||||
## Powering Your Synth (Battery Operation)
|
||||
|
||||
To make the synth truly portable, we'll use a LiPo battery and a booster board. This is critical for providing stable power to all components.
|
||||
|
||||
> **LIPO BATTERY WARNING**: LiPo batteries are powerful but require careful handling.
|
||||
> * **Never** use a LiPo battery without a dedicated protection and charging circuit like the PowerBoost.
|
||||
> * Do not puncture, bend, or short-circuit a LiPo battery.
|
||||
|
||||
### Wiring for Power:
|
||||
|
||||
1. Connect the **LiPo battery** to the JST connector on the **PowerBoost board**.
|
||||
2. Connect the **PowerBoost's 5V output** to the **Pico's VBUS pin (Pin 40)**. This powers the Pico.
|
||||
3. Connect the **PowerBoost's 5V output** to the **VCC/VIN pin of your I2S Audio Module**.
|
||||
4. Connect the **PowerBoost's GND** to one of the **Pico's GND pins**.
|
||||
5. Connect this **common ground** to the **GND pins of all other components** (OLED, I2S Module, Encoder, Potentiometer, MIDI circuit).
|
||||
|
||||
This setup ensures everything shares a common ground and that the power-hungry components get the stable 5V they need, while the Pico's onboard regulator provides 3.3V for the lower-power parts.
|
||||
|
||||
## Wiring & Connections
|
||||
|
||||
Establish a **common ground** by connecting the ground from your PowerBoost board to the Pico, and then to all other components' GND pins.
|
||||
|
||||
| Component | Pico Pin | Description |
|
||||
| ------------------ | ------------------ | ---------------------------------------------- |
|
||||
| **I2S Audio Module** | | |
|
||||
| VCC | 5V from PowerBoost | Power for the amplifier |
|
||||
| GND | Common GND | Ground |
|
||||
| DIN (Data) | GP11 (Pin 15) | I2S Data Out |
|
||||
| BCLK (Bit Clock) | GP9 (Pin 12) | I2S Bit Clock |
|
||||
| LRCK (Word Clock) | GP10 (Pin 14) | I2S Left/Right Clock |
|
||||
| **SSD1306 OLED** | | |
|
||||
| VCC | 3V3 (OUT) (Pin 36) | 3.3V Power |
|
||||
| GND | Common GND | Ground |
|
||||
| SDA | GP4 (Pin 6) | I2C Data |
|
||||
| SCL | GP5 (Pin 7) | I2C Clock |
|
||||
| **Rotary Encoder** | | |
|
||||
| \+ (VCC) | 3V3 (OUT) (Pin 36) | 3.3V Power |
|
||||
| GND | Common GND | Ground |
|
||||
| CLK | GP12 (Pin 16) | Encoder Clock |
|
||||
| DT | GP13 (Pin 17) | Encoder Data |
|
||||
| SW | GP14 (Pin 19) | Encoder Switch |
|
||||
| **Volume Pot** | | |
|
||||
| VCC | 3V3 (OUT) (Pin 36) | 3.3V Power |
|
||||
| GND | Common GND | Ground |
|
||||
| Wiper (Output) | GP26 (Pin 31) | ADC0 for volume reading |
|
||||
| **MIDI IN** | | |
|
||||
| (Circuit Output) | GP1 (Pin 2) | UART0 RX for MIDI Data In |
|
||||
|
||||
### MIDI IN Circuit (TRS Jack)
|
||||
|
||||
MIDI requires an opto-isolated input to protect the Pico from electrical faults. We will use a **Type A TRS MIDI** wiring standard, which is the most common.
|
||||
|
||||
- **TRS Tip**: Connects to MIDI Pin 5 (Current Source)
|
||||
- **TRS Ring**: Connects to MIDI Pin 4 (Current Sink)
|
||||
- **TRS Sleeve**: Connects to MIDI Pin 2 (Ground/Shield)
|
||||
|
||||
Here is a schematic for the input circuit:
|
||||
|
||||
```
|
||||
TRS JACK
|
||||
TIP ---- 220Ω ----+----|>|---- (Pin 6 of 6N138)
|
||||
(MIDI 5) | (Diode)
|
||||
|
|
||||
RING --- 220Ω -----+----------- (Pin 5 of 6N138)
|
||||
(MIDI 4)
|
||||
|
||||
6N138 OPTOCOUPLER
|
||||
Pin 8 (VCC) ----> 3.3V (from Pico)
|
||||
Pin 7 (VB) ----> GND
|
||||
Pin 6 (E) --+-> 10kΩ Pull-up Resistor -> 3.3V
|
||||
|
|
||||
+-> To Pico GP1 (UART RX)
|
||||
Pin 5 (GND) ----> GND
|
||||
```
|
||||
|
||||
This circuit correctly isolates the incoming MIDI signal and inverts it for the Pico's UART receiver.
|
||||
|
||||
## Software Setup
|
||||
|
||||
1. **Install RP2040 Board Core**:
|
||||
* In the Arduino IDE, go to **Preferences** and add this URL to "Additional Boards Manager URLs":
|
||||
`https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json`
|
||||
* Go to **Tools > Board > Boards Manager**, search for "pico", and install **Raspberry Pi Pico/RP2040**.
|
||||
* Select **Raspberry Pi Pico** from the board menu.
|
||||
|
||||
2. **Install Libraries**:
|
||||
* Install the following from the Arduino Library Manager:
|
||||
* `Adafruit GFX Library`
|
||||
* `Adafruit SSD1306`
|
||||
* An I2S Audio Library for the Pico (e.g., `I2S` by Earle F. Philhower, III, which is often included with the core).
|
||||
|
||||
3. **Upload Code**:
|
||||
* Once everything is wired, you can upload your synthesizer code to the Pico.
|
||||
|
||||
## Controls & Usage
|
||||
|
||||
The specific function of the controls will depend on your code, but here is a common layout:
|
||||
|
||||
* **Rotary Encoder (Turn)**: Navigate menus, change synth parameters (e.g., waveform, filter cutoff), or select notes.
|
||||
* **Rotary Encoder (Press)**: Enter/exit edit mode for a parameter, or trigger an action.
|
||||
* **Volume Potentiometer**: Controls the final output volume before it goes to the headphone jack.
|
||||
|
||||
## Ideas for Unorthodox Sounds
|
||||
|
||||
The beauty of a programmable synth is the ability to go beyond simple subtractive synthesis. Here are some fun ideas to code:
|
||||
|
||||
1. **Glitchy Wavetable Synthesis**:
|
||||
* **Concept**: Store several single-cycle waveforms (sine, saw, square, triangle) in arrays. The encoder selects the primary waveform.
|
||||
* **The Twist**: Add a "glitch" parameter. When activated (e.g., by a long press of the encoder), the code starts intentionally misreading the wavetable. It could randomly jump to a different table, read sample points backward, or apply bitwise operations (`XOR`, `AND`) to the sample data before sending it to the DAC. This creates a source of controlled digital chaos and unexpected textures.
|
||||
|
||||
2. **Karplus-Strong Physical Modeling**:
|
||||
* **Concept**: This algorithm simulates a plucked string. A buffer (delay line) is filled with random noise (the "pluck"), then played back and fed back into itself through a simple low-pass filter.
|
||||
* **The Twist**: Use the controls in non-standard ways. Map the volume pot to the **filter cutoff** or the **feedback amount** instead of volume. High feedback can cause the "string" to resonate infinitely, like an e-bow. Map the rotary encoder to the **length of the delay line** to change pitch, but allow it to be modified *while a note is playing*, creating bizarre pitch-bending and warping effects.
|
||||
|
||||
3. **Chaotic Oscillators**:
|
||||
* **Concept**: Instead of a standard oscillator, generate sound using a mathematical logistic map, like `x_n+1 = r * x_n * (1 - x_n)`. The output `x` is a value between 0.0 and 1.0.
|
||||
* **The Twist**: Map the output `x` directly to the audio sample value. The potentiometer controls the `r` parameter. At low `r` values, the output is stable or oscillates simply. As you increase `r` past ~3.57, it becomes chaotic, generating complex, noise-like, but still structured tones. This gives you a controller that smoothly transitions a sound from a pure tone into pure noise and back again.
|
||||
|
||||
Happy building, and enjoy your new tiny synth!
|
||||
Loading…
Reference in New Issue
Block a user