<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/a-live-chiptune-synthesizer-in-erlang-ymojxunnn" -->

---
title: A Live Chiptune Synthesizer in Erlang | daily.dev
description: A deep-dive walks through building a live chiptune-style synthesizer in Erlang from scratch, with no sample library involved. Every instrument—bass, lead, pad,...
canonical: https://daily.dev/posts/a-live-chiptune-synthesizer-in-erlang-ymojxunnn
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: A Live Chiptune Synthesizer in Erlang | daily.dev
og:description: A deep-dive walks through building a live chiptune-style synthesizer in Erlang from scratch, with no sample library involved. Every instrument—bass, lead, pad,...
og:url: https://daily.dev/posts/a-live-chiptune-synthesizer-in-erlang-ymojxunnn
og:image: https://api.daily.dev/og/posts/YMOJXUnNN.png
og:image:alt: A Live Chiptune Synthesizer in Erlang
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# A Live Chiptune Synthesizer in Erlang

**[Erlang Solutions](https://daily.dev/sources/erlangsolutions)** · 29 min read · 0 upvotes · 0 comments

## Summary

A deep-dive walks through building a live chiptune-style synthesizer in Erlang from scratch, with no sample library involved. Every instrument—bass, lead, pad, kick, snare, hats—is a mathematical function generating waveforms in real time, rather than playing recorded samples. It covers converting note names to frequencies via equal temperament, sampling sine/square/sawtooth/triangle waveforms, applying attack-sustain-release envelopes, mixing multiple simultaneous voices into chunked PCM, and converting floats to signed 16-bit little-endian samples. Playback reaches speakers through small OS-specific bridges: a PowerShell/C# bridge using waveOutOpen on Windows, and a C bridge using Core Audio's Audio Queue Services on macOS, communicating with Erlang over a loopback TCP socket with a simple credit-based flow-control protocol. A Python-based MIDI importer can convert Standard MIDI files into the same Erlang song-module format used by hand-written scores, but MIDI is only an authoring convenience—the synthesizer itself only ever consumes Erlang data structures.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.erlang-solutions.com/blog/a-live-chiptune-synthesizer-in-erlang>

## Questions this post answers

### How do you convert a note name like a4 to a frequency in Hz for audio synthesis?

A4 corresponds to MIDI note 69 and 440 Hz. Using twelve-tone equal temperament, any MIDI note number can be converted to frequency with the formula frequency = 440 × 2^((Midi - 69) / 12), since moving one semitone multiplies frequency by the twelfth root of two. For example, c4 becomes MIDI note 60, or approximately 261.63 Hz.

_daily.dev surfaces deep dives like this for developers exploring audio synthesis math in Erlang._

### How do you generate a sine wave sample at a given time for digital audio synthesis?

A sine wave of frequency F is sampled using sin(2 × pi × F × T), where T is time in seconds computed as SampleI / 44100 for a sample rate of 44,100 samples per second. The result oscillates between -1 and 1; repeating this at consecutive sample indexes produces the waveform, with higher frequencies completing more cycles per second.

_Developers building real-time audio pipelines can track synthesis techniques like these on daily.dev._

### How do you stream synthesized PCM audio from Erlang to the operating system's audio output in real time?

Erlang uses a small platform-specific bridge process launched via open_port/2, connected back over a loopback TCP socket using {packet, 4} framing. On Windows a PowerShell script compiles an embedded C# class calling waveOutOpen; on macOS a C bridge uses Core Audio's Audio Queue Services. A credit-based protocol (R for ready, A plus a PCM chunk, E to end, D to drain) paces delivery so Erlang never overruns the fixed native buffer pool.

_Track real-time audio streaming patterns in Erlang for your own low-latency playback projects on daily.dev._

## Similar posts on daily.dev

- [Embedded Elixir sound controller with Nerves and Arduino](https://daily.dev/posts/embedded-elixir-sound-controller-with-nerves-and-arduino-qlcxneicq) · Curiosum · 0 upvotes · 0 comments
- [Simple MIDI Sample Player Runs On ESP32](https://daily.dev/posts/simple-midi-sample-player-runs-on-esp32-9m6v6bz9q) · Hackaday · 0 upvotes · 0 comments
- [Petri Nets as a Music Sequencer](https://daily.dev/posts/petri-nets-as-a-music-sequencer-vlxo1k2ef) · Hacker News · 1 upvotes · 0 comments

---

Tags: [#erlang](https://daily.dev/tags/erlang)

[View this post on daily.dev](https://daily.dev/posts/a-live-chiptune-synthesizer-in-erlang-ymojxunnn)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"A Live Chiptune Synthesizer in Erlang","url":"https://daily.dev/posts/a-live-chiptune-synthesizer-in-erlang-ymojxunnn","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/a-live-chiptune-synthesizer-in-erlang-ymojxunnn"},"datePublished":"2026-09-29T13:14:45.417Z","dateModified":"2026-09-29T13:15:13.603Z","description":"A deep-dive walks through building a live chiptune-style synthesizer in Erlang from scratch, with no sample library involved. Every instrument—bass, lead, pad,...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/5a50f076e5bc55b28cc9a1443491fd33?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/5a50f076e5bc55b28cc9a1443491fd33?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Erlang Solutions","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Erlang Solutions","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/85a0fd34894e4a3d9b83d60d74572a48","url":"https://daily.dev/sources/erlangsolutions"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/a-live-chiptune-synthesizer-in-erlang-ymojxunnn","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"erlang","timeRequired":"PT29M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Erlang Solutions","item":"https://daily.dev/sources/erlangsolutions"},{"@type":"ListItem","position":3,"name":"A Live Chiptune Synthesizer in Erlang"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/a-live-chiptune-synthesizer-in-erlang-ymojxunnn#faq","mainEntity":[{"@type":"Question","name":"How do you convert a note name like a4 to a frequency in Hz for audio synthesis?","acceptedAnswer":{"@type":"Answer","text":"A4 corresponds to MIDI note 69 and 440 Hz. Using twelve-tone equal temperament, any MIDI note number can be converted to frequency with the formula frequency = 440 × 2^((Midi - 69) / 12), since moving one semitone multiplies frequency by the twelfth root of two. For example, c4 becomes MIDI note 60, or approximately 261.63 Hz. daily.dev surfaces deep dives like this for developers exploring audio synthesis math in Erlang."}},{"@type":"Question","name":"How do you generate a sine wave sample at a given time for digital audio synthesis?","acceptedAnswer":{"@type":"Answer","text":"A sine wave of frequency F is sampled using sin(2 × pi × F × T), where T is time in seconds computed as SampleI / 44100 for a sample rate of 44,100 samples per second. The result oscillates between -1 and 1; repeating this at consecutive sample indexes produces the waveform, with higher frequencies completing more cycles per second. Developers building real-time audio pipelines can track synthesis techniques like these on daily.dev."}},{"@type":"Question","name":"How do you stream synthesized PCM audio from Erlang to the operating system's audio output in real time?","acceptedAnswer":{"@type":"Answer","text":"Erlang uses a small platform-specific bridge process launched via open_port/2, connected back over a loopback TCP socket using {packet, 4} framing. On Windows a PowerShell script compiles an embedded C# class calling waveOutOpen; on macOS a C bridge uses Core Audio's Audio Queue Services. A credit-based protocol (R for ready, A plus a PCM chunk, E to end, D to drain) paces delivery so Erlang never overruns the fixed native buffer pool. Track real-time audio streaming patterns in Erlang for your own low-latency playback projects on daily.dev."}}]}
```

