mirror of
https://github.com/j0kerpack/InfeKt-FM1.git
synced 2026-12-06 21:04:38 +01:00
The engine, the FM-1 app, the host renderer, the build and check scripts, the measurement scripts and the web page. Two measured tables are held back (see README-SOURCE.md). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VEmbuKXQoh5Xkz3YbheQrA
59 lines
4.6 KiB
Python
59 lines
4.6 KiB
Python
#!/usr/bin/env python3
|
|
# SPDX-License-Identifier: GPL-3.0-only
|
|
"""Generates fm1/init_patch.h: the cleaner's own INIT patch ("Init Saw").
|
|
Every byte is a named default below (names after the development notes): a plain saw on oscillator 1, filters
|
|
open, an amp envelope that is a gate with a short release, no modulation, no effects. Bytes not named are 0.
|
|
Usage: tools/make_init.py > fm1/init_patch.h (run from cleaner/)"""
|
|
B = 128
|
|
NEUTRAL = 64 # a bipolar parameter at its centre: no effect
|
|
D = {}
|
|
def put(byte, value, name): D[byte] = (value, name)
|
|
|
|
put(0, 7, "patch version: current, no old-version fix-ups"); put(5, 0, "portamento"); put(7, 127, "part volume"); put(10, NEUTRAL, "pan")
|
|
put(17, 64, "osc1 shape = saw"); put(18, 0, "osc1 pw"); put(19, 0, "osc1 wave select")
|
|
put(20, NEUTRAL, "osc1 semitone"); put(21, 96, "osc1 keyfollow = normal")
|
|
put(22, 64, "osc2 shape"); put(23, 0, "osc2 pw"); put(24, 0, "osc2 wave"); put(25, NEUTRAL, "osc2 semitone")
|
|
put(26, 32, "osc2 detune"); put(27, 0, "osc2 FM"); put(28, 0, "osc2 sync")
|
|
put(29, NEUTRAL, "fenv>osc2 pitch"); put(30, NEUTRAL, "fenv>FM"); put(31, 96, "osc2 keyfollow")
|
|
put(33, 0, "osc balance = osc1 only"); put(34, 0, "sub"); put(35, 0, "sub shape"); put(36, 64, "osc volume = level, no drive")
|
|
put(37, 0, "noise"); put(38, 0, "ring mod"); put(39, NEUTRAL, "noise colour")
|
|
put(40, 127, "cutoff 1 open"); put(41, NEUTRAL, "cutoff 2 offset"); put(42, 0, "reso 1"); put(43, 0, "reso 2")
|
|
put(44, 0, "fenv amount 1"); put(45, 0, "fenv amount 2"); put(46, NEUTRAL, "filter kf 1"); put(47, NEUTRAL, "filter kf 2")
|
|
put(48, NEUTRAL, "filter balance"); put(49, 0, "saturation off"); put(50, 0, "unknown"); put(51, 0, "filter 1 LP")
|
|
put(52, 0, "filter 2 LP"); put(53, 0, "routing serial 4")
|
|
for i, (n, v) in enumerate(zip("ADSSR", (0, 46, 0, 64, 127))): put(54 + i, v, "filter env " + n)
|
|
for i, (n, v) in enumerate(zip("ADSSR", (0, 127, 127, 64, 4))): put(59 + i, v, "amp env " + n) # gate, short release
|
|
put(67, 48, "LFO1 rate"); put(68, 1, "LFO1 shape"); put(71, NEUTRAL, "LFO1 symmetry")
|
|
for b in range(74, 79): put(b, NEUTRAL, "LFO1 amount")
|
|
put(79, 48, "LFO2 rate"); put(80, 1, "LFO2 shape"); put(83, NEUTRAL, "LFO2 symmetry")
|
|
for b in range(86, 91): put(b, NEUTRAL, "LFO2 amount")
|
|
put(91, 100, "patch volume"); put(93, NEUTRAL, "transpose"); put(94, 0, "key mode poly")
|
|
put(97, 0, "unison off"); put(98, 48, "unison detune"); put(99, 127, "unison spread"); put(100, NEUTRAL, "unison LFO phase")
|
|
put(101, 0, "input off"); put(102, 1, "input select")
|
|
put(105, 0, "chorus mix"); put(106, 69, "chorus rate"); put(107, 16, "chorus depth"); put(108, 127, "chorus delay")
|
|
put(109, NEUTRAL, "chorus feedback"); put(110, 1, "chorus shape")
|
|
put(112, 0, "delay/reverb off"); put(113, 0, "send"); put(114, NEUTRAL, "time"); put(115, 0, "feedback")
|
|
put(116, 16, "rate/decay"); put(117, 12, "depth"); put(118, 1, "shape"); put(119, NEUTRAL, "colour")
|
|
put(B+5, NEUTRAL, "arp swing"); put(B+7, 92, "LFO3 rate"); put(B+8, 1, "LFO3 shape"); put(B+11, 1, "LFO3 dest osc1 pitch"); put(B+12, 0, "LFO3 amount")
|
|
put(B+16, 57, "tempo 120 BPM"); put(B+25, 0, "smooth"); put(B+26, 66, "bend up"); put(B+27, 62, "bend down")
|
|
put(B+30, 1, "fenv polarity 1 +"); put(B+31, 1, "fenv polarity 2 +"); put(B+32, 1, "cutoff link"); put(B+33, 36, "kf base note")
|
|
put(B+34, 0, "FM mode"); put(B+35, 0, "init phase free"); put(B+36, NEUTRAL, "punch")
|
|
for b in (47, 48, 49, 50, 54, 55, 56, 57, 60, 61): put(B+b, NEUTRAL, "velocity amount")
|
|
put(B+58, 0, "second output off")
|
|
for b in (53, 59): put(B+b, NEUTRAL, "velocity/unlisted bipolar, neutral")
|
|
put(B+41, 0, "osc3 off"); put(B+42, NEUTRAL, "osc3 volume"); put(B+43, NEUTRAL, "osc3 semitone")
|
|
put(B+44, 40, "osc3 detune"); put(B+45, 43, "EQ low frequency"); put(B+46, 85, "EQ high frequency")
|
|
for b in (66, 69, 71, 74, 76, 78, 80, 82): put(B+b, NEUTRAL, "matrix / LFO assignable amount: no effect")
|
|
for b, v in ((84, 0), (85, 0), (86, 36), (87, 112), (88, 48), (89, NEUTRAL), (90, 127)): put(B+b, v, "phaser")
|
|
for b, v in ((92, NEUTRAL), (93, 71), (94, 51), (95, NEUTRAL), (96, NEUTRAL)): put(B+b, v, "EQ")
|
|
put(B+97, 0, "boost"); put(B+98, 32, "boost tune"); put(B+99, 0, "input ring mod off")
|
|
NAME = b"Init Saw"
|
|
for i, c in enumerate(NAME): D[B + 112 + i] = (c, "name")
|
|
|
|
patch = [D.get(i, (0, ""))[0] for i in range(256)]
|
|
print("/* The cleaner's own INIT patch: a plain saw, the filters open (generated by tools/make_init.py: every byte a named\n"
|
|
" * default there, after the development notes). Do not edit by hand. */")
|
|
print("#define INIT_PATCH_N 1u\nstatic const uint8_t INIT_PATCH[256] = {")
|
|
for i in range(0, 256, 32): print(" " + ",".join(map(str, patch[i:i+32])) + ",")
|
|
print("};")
|