{"id":15910860,"url":"https://github.com/jonnor/hangdrum","last_synced_at":"2026-04-27T22:32:27.302Z","repository":{"id":138841020,"uuid":"83166545","full_name":"jonnor/hangdrum","owner":"jonnor","description":"Electronic percussive instrument using capacitive touch (firmware)","archived":false,"fork":false,"pushed_at":"2018-04-10T09:43:51.000Z","size":17068,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-03T01:42:12.456Z","etag":null,"topics":["arduino","cplusplus-11","embedded-systems","firmware","functional-programming","midi"],"latest_commit_sha":null,"homepage":"https://www.dhang.eu/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonnor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-25T22:14:38.000Z","updated_at":"2018-11-19T21:36:52.000Z","dependencies_parsed_at":"2023-03-13T10:52:44.401Z","dependency_job_id":null,"html_url":"https://github.com/jonnor/hangdrum","commit_stats":{"total_commits":92,"total_committers":1,"mean_commits":92.0,"dds":0.0,"last_synced_commit":"20a55711a67121e8f9bfb363eeec31896730661f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jonnor/hangdrum","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonnor%2Fhangdrum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonnor%2Fhangdrum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonnor%2Fhangdrum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonnor%2Fhangdrum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonnor","download_url":"https://codeload.github.com/jonnor/hangdrum/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonnor%2Fhangdrum/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32358509,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"ssl_error","status_checked_at":"2026-04-27T20:07:00.910Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","cplusplus-11","embedded-systems","firmware","functional-programming","midi"],"created_at":"2024-10-06T15:22:02.644Z","updated_at":"2026-04-27T22:32:27.287Z","avatar_url":"https://github.com/jonnor.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Hangdrum\n\nFirmware for a MIDI hang-drum using capacitive touch pads.\n\n![Electronics hang-drum being played](./doc/images/dhang-playing.jpg)\n\nBlogposts\n\n* [Host-based simulation for embedded systems](http://www.jonnor.com/2017/03/host-based-simulation-for-embedded-systems/)\n* [Optimizing latency of an Arduino MIDI controller](http://www.jonnor.com/2017/04/optimizing-arduino-midi-controller-latency/)\n\n## Status\n**In production**\n\n* Used as the firmware for [dhang](https://www.dhang.eu/) since March 2017\n* Tested on Arduino Lenonardo (Atmega 32u4)\n* Latency until triggered sound heard below 20ms with 8 pads, using Windows with ASIO4LL 96samples\n* Detection latency around 1ms per pads\n\n## Installing firmware\n\n1. Download repository from Github, or use git to clone.\n2. Install the `CapacitiveSensor` Arduino library\n3. Open `hangdrum.ino` in Arduino IDE\n4. Make sure that the hardware pin configuration is correct\n5. Flash the Arduino sketch to device\n\n## Hardware setup\n\nSee [CapSense documentation](https://playground.arduino.cc/Main/CapacitiveSensor?from=Main.CapSense)\n\n## Architecture\n\nThe [core](./hangdrum.hpp) of the firmware is platform and I/O independent, written in C++11.\nIt can run on a Arduino-compatible microcontroller (tested on Arduino Leonardo), or on a host computer (tested on Arch Linux).\n\nA single `State` datastructure holds all state. The program logic is expressed as a pure function of new Input and current State:\n`State next = calculateState(const Input inputs, const State current)`.\nBoth Input and State are plain-old-data which can be safely serialized and de-serialized.\nThe Hardware Abstraction Layer, which has real-life side-effects, consists of:\nA function to read current Input, and a function to \"realize\" a State.\n\nThis formulation allows us to:\n\n* *trace* the execution of the program, by capturing and storing the `Input, State` pairs.\n* *replay* a trace, by taking the `Input` and applying it to a modified program\n* *visualize* a whole-program execution from its trace, both end-results and intermediates\n* *test* a whole-program execution, by applying checks against the generated trace\n* *simulate* new scenarios by synthesizing or mutating Input\n\nWanderers of non-traditional programming methods may recognize inspirations from (Extended) Finite State Machines,\nFunctional Reactive Programming and Dataflow/Flow-based-programming.\nAnd basically a rejection of Object Oriented Programming (as typically practiced in C++/Java/Python/..),\nparticularly the idea of combining data and methods that operate on the data into a single class.\n\n\n## Tools\nThere is an decent set of analysis, simulation and testing tools available.\n\n* [tools/logserial.py](./tools/logserial.py): Record capacitive sensor input from device.\n* [tools/plot.py](./tools/plot.py): Plot a stream of sensor data\n* [bin/simulator](./tools/simulator.cpp): Run the firmware on host. Takes a sensor stream as input.\nCan run in real-time, producing ALSA MIDI output. Or in faster-than-realtime, producing a Flowtrace of the entire run.\n* [tools/plotflowtrace.py](./tools/plotflowtrace.py): Plot a flowtrace produced by simulator, showing decisions made\n* [tools/sendserial.py](./tools/sendserial.py`): Send an input sensor stream to device\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonnor%2Fhangdrum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonnor%2Fhangdrum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonnor%2Fhangdrum/lists"}