Professional waveform lookup table generator for embedded systems and oscilloscope art
Generate optimized C lookup tables for any DAC resolution - from 8-bit Arduino to 64-bit precision audio. Create stunning oscilloscope art with synchronized XY patterns. Perfect for embedded systems, signal generation, and creative projects.
- 8-bit (Arduino, AVR) β
uint8_tarrays - 12-bit (STM32 DAC) β
uint16_twith 4096 values - 16-bit (Audio DACs) β Professional audio quality
- 32/64-bit β Scientific precision applications
- Classic: Sine, Triangle, Square, Sawtooth, Ramp
- Artistic: Heart β€οΈ, Flower πΈ, Butterfly π¦, Spiral π
- Mathematical: Lissajous, Cycloid, Astroid, Rhodonea
- Technical: Chaos, Pulse trains, Noise patterns
- Synchronized X,Y patterns for dual-DAC setups
- 18+ artistic patterns including hearts, roses, infinity symbols
- Real-time control examples for Arduino/ESP32/STM32
- Auto-cycling demos and interactive controls
- Zero external dependencies - uses only Python standard library
- Self-documenting generated headers with full API
- Memory optimized - automatic data type selection
- Validation built-in - range checking and error detection
git clone https://github.com/s-celles/waveform-generator.git
cd waveform-generator# Basic 8-bit waveforms for Arduino
python yt_waveform_generator.py --bits 8 --size 256 --output arduino_waves.h
# 12-bit waveforms for STM32 DAC
python yt_waveform_generator.py --bits 12 --size 512 --output stm32_waves.h
# XY patterns for oscilloscope art
python xy_waveform_generator.py --patterns heart,rose_5,butterfly --output xy_art.h
# See all available options
python yt_waveform_generator.py --list
python xy_waveform_generator.py --list-patterns#include "arduino_waves.h"
void play_sine_wave() {
for(int i = 0; i < WAVE_ARRAY_SIZE; i++) {
dac_output(sine_wave[i]);
delay_us(100); // 10kHz sample rate
}
}8-bit Arduino Example
#define WAVE_ARRAY_SIZE 256
#define WAVE_BITS 8
#define WAVE_MAX_VALUE 255
const uint8_t sine_wave[WAVE_ARRAY_SIZE] = {
128, 131, 134, 137, 140, 143, 146, 149, 152, 155, 158, 162, 165, 167, 170, 173,
176, 179, 182, 185, 188, 190, 193, 196, 198, 201, 203, 206, 208, 211, 213, 215,
// ... 224 more values
};12-bit STM32 Example
#define WAVE_ARRAY_SIZE 512
#define WAVE_BITS 12
#define WAVE_MAX_VALUE 4095
const uint16_t sine_wave[WAVE_ARRAY_SIZE] = {
2048, 2073, 2098, 2123, 2148, 2173, 2198, 2223, 2248, 2273, 2298, 2323, 2348, 2373, 2398, 2423,
2448, 2473, 2498, 2523, 2548, 2573, 2598, 2623, 2648, 2673, 2698, 2723, 2748, 2773, 2798, 2823,
// ... 480 more values
};XY Oscilloscope Art Example
// Heart pattern β€οΈ for oscilloscope XY mode
const uint8_t heart_x[XY_ARRAY_SIZE] = {
127, 127, 128, 129, 131, 133, 135, 138, 141, 144, 148, 152, 156, 161, 166, 171,
// ... X coordinates
};
const uint8_t heart_y[XY_ARRAY_SIZE] = {
127, 130, 133, 137, 140, 144, 147, 151, 154, 158, 161, 165, 168, 172, 175, 179,
// ... Y coordinates
};
// Usage: Connect X to CH1, Y to CH2, set oscilloscope to XY modeTransform your oscilloscope into an art canvas with stunning XY patterns:
| Pattern | Description | Best For |
|---|---|---|
heart β€οΈ |
Mathematical heart curve | Demos, gifts |
rose_5 πΉ |
5-petal rose pattern | Beautiful, balanced |
butterfly π¦ |
Complex butterfly equation | Impressive complexity |
lissajous_3_2 |
Classic figure-8 | Educational, stable |
infinity β |
Infinity symbol | Simple but effective |
spiral_log π |
Logarithmic spiral | Hypnotic motion |
Arduino + 2x MCP4725 DACs:
βββ DAC1 (0x60) β Oscilloscope X Input
βββ DAC2 (0x61) β Oscilloscope Y Input
βββ Set oscilloscope to XY mode
ESP32 (built-in DACs):
βββ GPIO25 β Oscilloscope X Input
βββ GPIO26 β Oscilloscope Y Input
βββ 8-bit resolution, very fast
- Arduino (Uno, Nano, ESP32) - 8-bit optimized
- STM32 (Discovery, Nucleo) - 12-bit DAC support
- ESP32 - Built-in dual DACs for XY patterns
- Raspberry Pi - GPIO + external DACs
- Any microcontroller with DAC capability
- C/C++ embedded projects
- Python signal processing
- MATLAB/Octave integration
- LabVIEW measurement systems
waveform-generator/
βββ π yt_waveform_generator.py # Main 1D waveform generator
βββ π¨ xy_waveform_generator.py # XY pattern generator for oscilloscope art
βββ π examples/ # Ready-to-use examples
β βββ 8bit/ # Arduino-compatible (uint8_t)
β βββ 12bit/ # STM32 DAC (uint16_t)
β βββ 16bit/ # Audio quality (uint16_t)
β βββ 32bit/ # High precision (uint32_t)
β βββ 64bit/ # Scientific precision (uint64_t)
βββ π hardware/ # Hardware integration guides
β βββ arduino/ # Arduino examples and wiring
β βββ esp32/ # ESP32 DAC examples
β βββ stm32/ # STM32 HAL examples
β βββ oscilloscope_xy/ # XY art setup guides
βββ π docs/ # Comprehensive documentation
βββ π tests/ # Validation and unit tests
- Hardware Setup Guide - Wiring diagrams and platform-specific setup - ToDo
- API Reference - Complete function documentation - ToDo
- Waveform Mathematics - Mathematical descriptions of all patterns - ToDo
- Oscilloscope XY Art - Create stunning visual displays - ToDo
- Performance Guide - Optimization tips and benchmarks - ToDo
- Function generators and signal sources
- Motor control and PWM generation
- Audio synthesis and effects
- Sensor calibration and testing
- Synthesizer oscillators
- Audio test signals and calibration
- Digital audio workstation plugins
- Educational audio processing
- Oscilloscope calibration patterns
- Signal integrity testing
- RF and communications testing
- Laboratory equipment
- Oscilloscope art installations
- LED matrix animations
- Interactive art projects
- STEM education demonstrations
| Resolution | Data Type | Memory/Waveform | Generation Speed | Best For |
|---|---|---|---|---|
| 8-bit | uint8_t |
256 bytes | ~1ms | Arduino, simple projects |
| 12-bit | uint16_t |
512-1024 bytes | ~2ms | STM32 DAC, embedded |
| 16-bit | uint16_t |
512-2048 bytes | ~5ms | Audio applications |
| 32-bit | uint32_t |
1-8KB | ~10ms | Industrial, scientific |
| 64-bit | uint64_t |
2-16KB | ~20ms | Research, simulation |
We welcome contributions! Here's how you can help:
- π Report bugs - Open issues with reproduction steps
- β¨ Add waveforms - Contribute new mathematical patterns
- π Improve docs - Better examples and tutorials
- π§ Hardware support - New platform integrations
- π¨ Oscilloscope art - New XY patterns and creative ideas
def generate_your_waveform(self, param1=1.0, param2=0.0):
"""Your custom waveform description"""
return [
self.normalize(your_math_function(i, param1, param2))
for i in range(self.array_size)
]This project is licensed under the MIT License - see the LICENSE file for details.
- Oscilloscope Music Visualizer - Real-time audio β XY patterns
- Educational Math Display - Parametric equations visualization
- Interactive Art Installation - Gesture-controlled waveforms
- Retro Game Console - Vector graphics using oscilloscope
- Hackaday projects and articles
- Arduino community showcases
- Maker Faire demonstrations
- University STEM education courses
- Mathematics Community - For beautiful parametric equations
- Oscilloscope Art Artists - Inspiration for XY patterns
- Embedded Developers - Real-world testing and feedback
- Open Source Contributors - Making this project better
- π Issues: GitHub Issues
- π¬ Discussions: GitHub Discussions
- π Website: GitHub Pages (ToDo)
β Star this repository if it helped you create amazing waveforms!
Made with β€οΈ for the embedded systems and oscilloscope art communities