<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-do-ones-and-zeros-sound--u9ljt5sn8" -->

---
title: How do ones and zeros sound? | daily.dev
description: An exploration of 1-bit music, a demoscene-adjacent genre born from early computers' piezo buzzers that only produce two signal levels. The piece explains the...
canonical: https://daily.dev/posts/how-do-ones-and-zeros-sound--u9ljt5sn8
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How do ones and zeros sound? | daily.dev
og:description: An exploration of 1-bit music, a demoscene-adjacent genre born from early computers' piezo buzzers that only produce two signal levels. The piece explains the...
og:url: https://daily.dev/posts/how-do-ones-and-zeros-sound--u9ljt5sn8
og:image: https://api.daily.dev/og/posts/u9LJT5sn8.png
og:image:alt: How do ones and zeros sound?
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.

# How do ones and zeros sound?

**[zserge's blog](https://daily.dev/sources/zserge)** · 9 min read · 0 upvotes · 0 comments

## Summary

An exploration of 1-bit music, a demoscene-adjacent genre born from early computers' piezo buzzers that only produce two signal levels. The piece explains the techniques used to make square-wave audio expressive - pitch sliding, duty cycle modulation, rapid channel-switching for pseudo-polyphony, and pulse-width-encoded drum samples - and introduces 1bitr, a minimal Unix-style command-line music tracker with a C sound engine that reads note data from stdin and plays it back or exports raw PCM.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://zserge.com/posts/1-bit-music>

## Questions this post answers

### How do you create polyphony with only a single-bit audio channel?

Rapidly alternate between two notes so fast that the human ear perceives them as playing simultaneously. Because modern sample rates like 44.1kHz allow toggling between channels 22,050 times per second, well above the roughly 20kHz limit of human hearing, this switching goes unnoticed. An alternative is combining two channels with bitwise XOR, though that mutes sound when both channels play the same note.

_Anyone building audio synthesis tricks like this can find related deep dives on daily.dev._

### How can drum sounds be simulated in 1-bit audio synthesis?

Drums are simulated as short interrupting bursts that briefly pause the other audio channels, a technique called interrupting click drums, since the pause is too short for the ear to notice. White noise, made by randomly toggling 1 and 0 for a few milliseconds, produces a lo-fi hi-hat sound, while a square wave sliding to a low pitch simulates a kick drum.

_Developers experimenting with constrained audio synthesis can track similar techniques on daily.dev._

### What is pulse width encoding for storing 1-bit audio samples efficiently?

Instead of storing a raw array of every 1 and 0 sample, pulse width encoding stores only the interval lengths between transitions, since a 1-bit sample always alternates zero then one then zero again. For example, the array [23, 5, 3] means play 0 for 23 cycles, then 1 for 5 cycles, then 0 for 3 cycles, saving significant space over raw sample arrays.

_For more space-efficient encoding tricks like this, developers can browse daily.dev._

## Similar posts on daily.dev

- [One Bit Sound With The ZX Spectrum](https://daily.dev/posts/one-bit-sound-with-the-zx-spectrum-qq9n3twjl) · Hackaday · 0 upvotes · 0 comments
- [ZX Spectrum: Experimenting With 1-Bit Sound](https://daily.dev/posts/zx-spectrum-experimenting-with-1-bit-sound-0zts7judl) · Two Stop Bits · 0 upvotes · 0 comments
- [A Live Chiptune Synthesizer in Erlang](https://daily.dev/posts/a-live-chiptune-synthesizer-in-erlang-ymojxunnn) · Erlang Solutions · 0 upvotes · 0 comments

---

Tags: [#c](https://daily.dev/tags/c), [#embedded](https://daily.dev/tags/embedded)

[View this post on daily.dev](https://daily.dev/posts/how-do-ones-and-zeros-sound--u9ljt5sn8)

```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":"How do ones and zeros sound?","url":"https://daily.dev/posts/how-do-ones-and-zeros-sound--u9ljt5sn8","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-do-ones-and-zeros-sound--u9ljt5sn8"},"datePublished":"2026-08-23T10:20:16.719Z","dateModified":"2026-08-23T10:21:25.772Z","description":"An exploration of 1-bit music, a demoscene-adjacent genre born from early computers' piezo buzzers that only produce two signal levels. The piece explains the...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/2f96be89937bd89ac558465da916bcd9?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/2f96be89937bd89ac558465da916bcd9?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"zserge's blog","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":"zserge's blog","logo":"https://media.daily.dev/image/upload/s--KQnFBOIT--/f_auto,q_auto/v1787480407/logos/zserge","url":"https://daily.dev/sources/zserge"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-do-ones-and-zeros-sound--u9ljt5sn8","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"c,embedded","timeRequired":"PT9M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"zserge's blog","item":"https://daily.dev/sources/zserge"},{"@type":"ListItem","position":3,"name":"How do ones and zeros sound?"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/how-do-ones-and-zeros-sound--u9ljt5sn8#faq","mainEntity":[{"@type":"Question","name":"How do you create polyphony with only a single-bit audio channel?","acceptedAnswer":{"@type":"Answer","text":"Rapidly alternate between two notes so fast that the human ear perceives them as playing simultaneously. Because modern sample rates like 44.1kHz allow toggling between channels 22,050 times per second, well above the roughly 20kHz limit of human hearing, this switching goes unnoticed. An alternative is combining two channels with bitwise XOR, though that mutes sound when both channels play the same note. Anyone building audio synthesis tricks like this can find related deep dives on daily.dev."}},{"@type":"Question","name":"How can drum sounds be simulated in 1-bit audio synthesis?","acceptedAnswer":{"@type":"Answer","text":"Drums are simulated as short interrupting bursts that briefly pause the other audio channels, a technique called interrupting click drums, since the pause is too short for the ear to notice. White noise, made by randomly toggling 1 and 0 for a few milliseconds, produces a lo-fi hi-hat sound, while a square wave sliding to a low pitch simulates a kick drum. Developers experimenting with constrained audio synthesis can track similar techniques on daily.dev."}},{"@type":"Question","name":"What is pulse width encoding for storing 1-bit audio samples efficiently?","acceptedAnswer":{"@type":"Answer","text":"Instead of storing a raw array of every 1 and 0 sample, pulse width encoding stores only the interval lengths between transitions, since a 1-bit sample always alternates zero then one then zero again. For example, the array [23, 5, 3] means play 0 for 23 cycles, then 1 for 5 cycles, then 0 for 3 cycles, saving significant space over raw sample arrays. For more space-efficient encoding tricks like this, developers can browse daily.dev."}}]}
```

