{"id":15457158,"url":"https://github.com/schollz/supertonic","last_synced_at":"2025-07-22T16:02:40.969Z","repository":{"id":48962228,"uuid":"369428331","full_name":"schollz/supertonic","owner":"schollz","description":"an instrospective drum machien","archived":false,"fork":false,"pushed_at":"2021-07-03T04:06:30.000Z","size":3842,"stargazers_count":21,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-20T01:13:15.668Z","etag":null,"topics":["drum-machine","drum-patterns","engine","supercollider"],"latest_commit_sha":null,"homepage":"https://llllllll.co/t/supertonic/45551","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/schollz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-21T05:55:55.000Z","updated_at":"2025-01-22T13:17:32.000Z","dependencies_parsed_at":"2022-09-08T22:51:18.521Z","dependency_job_id":null,"html_url":"https://github.com/schollz/supertonic","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schollz%2Fsupertonic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schollz%2Fsupertonic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schollz%2Fsupertonic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schollz%2Fsupertonic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/schollz","download_url":"https://codeload.github.com/schollz/supertonic/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249834793,"owners_count":21331989,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["drum-machine","drum-patterns","engine","supercollider"],"created_at":"2024-10-01T22:42:19.987Z","updated_at":"2025-04-20T01:13:29.858Z","avatar_url":"https://github.com/schollz.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"## supertonic\n\n\n![Image](https://user-images.githubusercontent.com/6550035/120124212-22d3d680-c168-11eb-9b83-6d9b29303972.png)\n\nan introspective drum machine that looks into itself and produces rhythm from its own self-examination.\n\nhttps://vimeo.com/557258118\n\n### introspection\n\nthis drum machine introspects by looking at any of the current drum patterns and generating a new drum pattern based specifically on that pattern and which instruments they are (e.g. a snare rhythm based on the kick pattern).\n\nthese generative rhythms are accomplished using [Google's \"variational autoencoder\"](https://github.com/magenta/magenta/tree/master/magenta/models/music_vae) for drum performances. [their blog post](https://magenta.tensorflow.org/groovae) explains it best (and [their paper](https://arxiv.org/pdf/1803.05428.pdf) explains it better), but essentially they had professional drummers play an electronic drum-set for 12+ hours which was later used to feed a special kind of neural network. I used their model from this network and sampled it randomly to produce \"new\" groups of drum rhythms (\u003e~1,000,000 of them). then I created probability distributions from calculating bayesian probabilities from each instrument to each other instrument, within each rhythm grouping. this probability table can then generate a snare drum pattern based on a kick drum pattern, or generate a hihat pattern based on a snare drum pattern, etc. etc.\n\n\n### sounds\n\nthe sounds for this drum machine come from a new engine which I call \"supertonic\" because it is a as-close-as-I-can port of the [microtonic VST by SonicCharge](https://soniccharge.com/microtonic). \n\nthe act of porting is not straightforward and the experience itself was a motivation for this script - it helped me to learn how to use SuperCollider as I tried to match up sounds between the VST and SuperCollider using my ear. I learned there is a lot of beautiful magic in microtonic that makes it sounds wonderful, and I doubt I got half of the magic that's in the actual VST (so this is by no means a replacement). looking at the resulting engine you might notice some weird equations that are supposed to be approximating the magic behavior in the true microtonic. this script also includes a standalone SuperCollider drum machine to use with this engine (and conversion scripts to convert microtonic patches).\n\nhere is a [demo comparing microtonic and this engine](https://www.instagram.com/p/CPghuJUB2Of/?utm_source=ig_web_copy_link).\n\n### drummer in a box\n\nin the end, this script is a little drum machine in a box and also a new drum machine engine for norns, a little like @21echoes's [cyrene](https://norns.community/authors/21echoes/cyrene), @pangrus's [hachi](https://norns.community/authors/pangrus/hachi), or @justmat's [foulplay](https://norns.community/authors/justmat/foulplay). \n\nfor me personally, this script is an experiment. to try to answer the question: what is it like to perform with an AI generated rhythm section (i.e. paralleling [what its like to play with a AI generated piano](https://github.com/schollz/pianoai))? is it good? surprisingly so, sometimes.\n\n### Requirements\n\n- norns\n\n### Documentation\n\nall the parameters for the engine are in the `PARAM` menu, as well as preset loading.\n\non the main screen:\n\n- K2 starts/stops\n- K3 toggles hit \n- E2 changes track (current is bright)\n- E3 changes position in track\n- hold K1 and turn E3 to erase a track\n\nthis script automatically detects all midi keyboards and will start/stop based on midi start/stop events.\n\nyou can hold K3 and move E2 to lay down a lot of beats.\n\n**introspection** \n\nintrospection requires downloading a prior table (~100 mb, not included in repo) and `sqlite3`. both of these can be installed by running this command in maiden:\n\n```\nos.execute(\"sudo apt install -y sqlite3; mkdir -p /home/we/dust/data/supertonic/; curl -L --progress-bar https://github.com/schollz/supertonic/releases/download/v1_ai/drum_ai_patterns.db \u003e /home/we/dust/data/supertonic/drum_ai_patterns.db\")\n```\n\n- hold K1, then press K3 to generate a new pattern based on the highlighted pattern\n- hold K1 and turn E2 to change the highlighted pattern (basis of the generation)\n- hold K1 and press K2 to generate beats 17-32 based on beats 1-16 for current instrument\n\n**using your own microtonic presets**\n\nif you have microtonic you can easily use your own microtonic preset. simply copy your microtonic preset file (something like `\u003cname\u003e.mtpreset`) and and save it into the `/home/we/dust/data/supertonic/presets` directory. then, you can then load these presets via the `PARAM \u003e SUPERTONIC \u003e preset` menu.\n\n**converting microtonic presets for use with SuperCollider**\n\nyou can also use the engine directly with SuperCollider. the engine file is synced with a SuperCollider script, `lib/supertonic.scd`. an example drumset is in `lib/supertonic_drumset.scd`. you can easily get a SuperCollider file with your microtonic presets by running this lua script:\n\n```\nlua ~/dust/code/supertonic/lib/mtpreset2sc.lua /location/to/your/\u003cname\u003e.mtpreset ~/dust/data/supertonic/default.preset \u003e presets.sc\n```\n\n**known bugs**\n\nthe supertonic engine is pretty cpu-intensive, so if you have 4-5 instruments all doing fast patterns (or fast tempo) you will hit cpu walls and hear crunching. any ideas to improve cpu usage are welcome :)\n\nthe pattern generation (k1+k3 or k1+k2) runs asynchronously but I've noticed that sometimes it might cause a little latency when using it while performing (generating patterns while playing).\n\nif you aren't seeing any new randomly generate patterns when pressing K1+K3/K2, it could be that the pattern that you're using as a basis doesn't exist in the database (and therefore won't produce any new patterns).\n\n**thanks**\n\nthe ex-dash patterning functions are from @license from the collaborative [song](https://github.com/northern-information/song/) project. the flying confetti is from @eigen's brilliant [pico-8 wrapper](https://llllllll.co/t/p8-pico-8-wrapper-lib/37947). also thanks @dan_derks, out little discussion helped me figure out the beginnings of this thing. finally, big big thanks to @midouest who shared their microtonic supercollider project which showed me some tricks I had missed and also showed me I was on the right track (because our implementations had a lot of parallels).\n\n### Download\n\ninstall via maiden or\n\n```\n;install https://github.com/schollz/supertonic\n```\n\nmake sure to restart after installing because it includes a new engine.\n\nhttps://github.com/schollz/supertonic\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschollz%2Fsupertonic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fschollz%2Fsupertonic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschollz%2Fsupertonic/lists"}