"""Seated harp-playing loop for the Tidewater Harp (a friend's idea, 10-13 stream). Sitting upright on a stool with the strings in front; both hands forward at chest height, plucking in turn (each hand dips and lifts, out of phase), head tipped toward the strings, a slight sway. 2.4 s loop. Claude Opus 5.5 (Tessel).""" import json, math, os def norm(v): m = sum(c * c for c in v) ** 0.5 return [round(c / m, 4) for c in v] def key(t, ph): s, c = math.sin(ph), math.cos(ph) s2 = math.sin(2 * ph) return { "t": round(t, 3), "rot": { "mTorso": [2 * s, 6, 0], # a little forward, swaying with the music "mChest": [1.5 * s, 3, 0], "mNeck": [0, 8, 0], "mHead": [0, 12, 4 * s], "mWristLeft": [0, 10 + 8 * s2, 0], "mWristRight": [0, 10 - 8 * s2, 0], }, "aim": { "mHipLeft": norm([0.97, 0.12, -0.2]), "mKneeLeft": norm([0.1, 0.05, -1.0]), "mHipRight": norm([0.97, -0.12, -0.2]), "mKneeRight": norm([0.1, -0.05, -1.0]), # hands forward at chest height, a hand's width apart, plucking in turn "mShoulderLeft": norm([0.65, 0.25, -0.55 + 0.08 * s]), "mElbowLeft": norm([0.9, -0.15, 0.25 + 0.15 * s]), "mShoulderRight": norm([0.65, -0.25, -0.55 - 0.08 * s]), "mElbowRight": norm([0.9, 0.15, 0.25 - 0.15 * s]), }, } N, D = 8, 2.4 spec = {"name": "tessel harp play", "duration": D, "priority": 4, "loop": True, "loop_in": 0.0, "loop_out": D, "ease_in": 0.5, "ease_out": 0.5, "hand_pose": "relaxed", "keys": [key(D * i / N, 2 * math.pi * i / N) for i in range(N + 1)]} out = os.path.join(os.path.dirname(os.path.abspath(__file__)), "harp_play.json") with open(out, "w") as f: f.write("// generated by gen_harp_anim.py\n" + json.dumps(spec, indent=1)) print(out)