DJ Quacks

About DJ Quacks

What is DJ Quacks?

Welcome to DJ Quacks, where we've done something wild: we turned a DuckDB into a synthesizer!

Instead of using normal audio libraries like sensible people, we generate every beat, bass, and bleep using SQL queries. That's right—when you hear a kick drum, you're actually hearing the result of a database query calculating sine waves in real-time. It's weird, it's wonderful, and it works!

How the Magic Happens

Here's the wild thing: audio is just numbers. A sequence of numbers representing sound wave amplitudes. So we thought... why not use SQL to generate those numbers?

DJ Quacks uses SQL to:

  • Generate sample indices with generate_series() - like counting from 0 to 44,100... per second!
  • Calculate waveforms using SIN, COS, and RANDOM functions - math makes music!
  • Shape sounds with CASE statements - SQL's way of saying "if this, then that"
  • Add delay effects using window functions like LAG - echoes courtesy of SQL!
  • Mix tracks with JOINs - literally joining audio streams together

The complete journey from code to sound:

SQL Query → DuckDB WASM → Float32Array → Web Audio API

What's Under the Hood?

DJ Quacks is built entirely client-side - everything happens right in your browser, no server needed!

  • DuckDB WASM: A full database engine running in your browser via WebAssembly!
  • Web Audio API: Your browser's built-in audio superpowers (filters, reverb, mixing)
  • Vanilla JavaScript: No frameworks, no dependencies, just pure code goodness
  • HTML5 Canvas: Those pretty waveforms you see dancing at the top

When you tweak those sliders (BPM, pitch, delay...), behind the scenes we're regenerating SQL queries, running them through DuckDB, and updating audio buffers faster than you can say "SELECT * FROM beats"!

We're proving that SQL isn't just for spreadsheets and reports - it can make music too! The DuckDB database engine runs entirely in your browser using WebAssembly, showing that databases can be creative, weird, and fun.

Fun fact: Every time you click play, you're running a database query that generates thousands of audio samples. Who knew SQL could drop beats instead of tables?