{"builds_on":null,"cover":null,"credit":"\u201cPocket Chiptune\u201d by @aeon on Wow Buffet, made with Claude Opus 5.5. CC BY 4.0. https://wowbuffet.com/p/0-RbEkMt","description":"Fifteen seconds of square-wave melody, triangle bass and noise hi-hats, synthesized one sample at a time by a short Python script. No instruments, no samples.","download":"https://wowbuffet.com/p/0-RbEkMt/download","file":"https://wowbuffetfiles.com/f/i6tzdyDgjcdhCZWw.wav","file_name":"pocket-chiptune.wav","file_size":671518,"hand_edits":null,"id":"0-RbEkMt","json":"https://wowbuffet.com/p/0-RbEkMt.json","licence":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"},"likes":0,"link":null,"made_on":null,"maker":{"name":"aeon","url":"https://wowbuffet.com/u/aeon","username":"aeon"},"minutes":null,"model":"Claude Opus 5.5","prompt":"Write a Python script, standard library only, that synthesizes a cheerful 15-second chiptune as a WAV file: square-wave lead, triangle bass, noise hi-hat.\n\nThe script:\n\n\"\"\"Synthesize a short chiptune: square-wave lead, triangle bass, noise hi-hat. Standard library only.\"\"\"\nimport math, random, struct, sys, wave\n\nRATE, BPM = 22050, 132\nSTEP = int(60 / BPM / 2 * RATE)  # one eighth note, in samples\nLEAD = [72, 76, 79, 76, 72, 76, 79, 84,  81, 79, 76, 79, 81, None, 79, None,\n        77, 81, 84, 81, 77, 81, 84, 86,  84, 83, 81, 79, 76, None, 72, None,\n        72, 76, 79, 76, 72, 76, 79, 84,  86, 84, 81, 84, 88, None, 84, None,\n        81, 79, 77, 76, 74, 76, 77, 79,  84, None, 79, None, 72, None, None, None]\nROOTS = [48, 45, 41, 43, 48, 45, 41, 43]  # C, Am, F, G, one per bar\n\ndef hz(note):\n    return 440 * 2 ** ((note - 69) / 12)\n\nrandom.seed(7)\nout = []\nfor i, lead in enumerate(LEAD):\n    bass = ROOTS[i // 8] + (12 if i % 2 else 0)\n    last = i == len(LEAD) - 1\n    for t in range(STEP * (4 if last else 1)):\n        sec = t / RATE\n        s = 0.0\n        if lead is not None:\n            env = min(1, t / 60) * max(0, 1 - t / STEP) ** 0.6\n            s += (0.26 if (sec * hz(lead)) % 1 < 0.25 else -0.26) * env\n        tri = 4 * abs((sec * hz(bass)) % 1 - 0.5) - 1\n        s += 0.3 * tri * min(1, t / 40) * max(0, 1 - t / (STEP * (4 if last else 1))) ** 0.3\n        if i % 2 and t < 700:\n            s += (random.random() * 2 - 1) * 0.07 * (1 - t / 700)\n        out.append(int(max(-1.0, min(1.0, s)) * 32767))\n\nwith wave.open(sys.argv[1], \"wb\") as w:\n    w.setnchannels(1); w.setsampwidth(2); w.setframerate(RATE)\n    w.writeframes(struct.pack(f\"<{len(out)}h\", *out))\nprint(f\"{len(out) / RATE:.1f} seconds\")\n","published":"2026-10-02T06:07:06+00:00","social":null,"tags":["music","chiptune","python"],"title":"Pocket Chiptune","tokens":null,"type":"audio","updated":"2026-10-02T06:07:06+00:00","url":"https://wowbuffet.com/p/0-RbEkMt","views":8,"website":null}
