packages/app/sine-lab
s

sine-lab

fbd524dapp

Vibe-coded app to generate and listen to audio waves in real time

0 stars0 forksMITupdated 22 hours ago
Open repo

Odin Sine Lab

A small native Odin + raylib application for building, listening to, and visualizing sums of sinusoidal signals.

Features

  • Up to 8 sinusoidal components.
  • Exact editable frequencies from 1 Hz to 20 kHz.
  • Per-component amplitude, phase, mute, and removal.
  • Real-time mono 48 kHz floating-point audio.
  • Time-domain view of every component and their sum.
  • Component spectrum.
  • Optional automatic headroom to avoid hard clipping.
  • Pure 4:5:6 and 12-EDO C-major presets.
  • Resizable native window.

Arch Linux

Install Odin:

sudo pacman -S odin

The project imports vendor:raylib, so installing the separate raylib package is normally unnecessary.

Run directly:

odin run . -o:speed

Build an executable:

odin build . -out:sine-lab -o:speed
./sine-lab

On Hyprland, raylib's normal Linux desktop build generally opens through XWayland. If no window appears, verify that XWayland is enabled.

Controls

  • Click a frequency field, type a value, and press Enter.

  • Escape cancels frequency editing.

  • The - and + buttons change frequency by 1 Hz.

  • Hold Shift while clicking them to change it by 10 Hz.

  • Audio ON/OFF only gates output; the stream remains alive.

  • Reset phase restarts all oscillator running phases together.

  • Auto headroom applies

    gain = min(1, 0.95 / sum(amplitudes))
    

    before master volume, then the final PCM sample is clamped to [-1, 1].

Notes

The component spectrum is intentionally not an FFT: these are analytically defined sinusoids, so their frequencies and amplitudes are already known exactly. Drawing stems at those frequencies is more accurate than estimating them from a finite FFT window.

UI font

The program searches these paths in order:

  1. ./ui-font.ttf
  2. /usr/share/fonts/noto/NotoSans-Regular.ttf
  3. /usr/share/fonts/TTF/DejaVuSans.ttf
  4. /usr/share/fonts/liberation/LiberationSans-Regular.ttf
  5. /usr/share/fonts/gnu-free/FreeSans.ttf

On Arch, the default choice is Noto Sans when noto-fonts is installed:

sudo pacman -S noto-fonts

To use any other TrueType font without changing the source, copy or symlink it as ui-font.ttf in the directory from which you launch the application:

ln -s /path/to/MyFont-Regular.ttf ui-font.ttf
odin run . -o:speed

The font file is loaded at runtime; it is not embedded in the executable.

Package Info
Version
fbd524d
License
MIT
Author
@PabloIsCoding
Type
app
Forks
0
Created
22 hours ago
Updated
22 hours ago
Health
maintained
has releases
has readme
has license
Activity
last 56 weeks