Showing posts with label Midi. Show all posts
Showing posts with label Midi. Show all posts

Sunday, February 8, 2026

JP80x0 midi to coefficient mapping tables

Pitch

MidiPitch
01555
11647
21745
31849
41959
52075
62198
72329
82468
92615
102770
112935
123110
133295
143491
153698
163918
174151
184397
194658
204936
215230
225541
235871
246220
256590
266982
277396
287836
298302
308794
319317
329873
3310460
3411082
3511742
3612441
3713181
3813965
3914792
4015672
4116604
4217589
4318635
4419747
4520921
4622164
4723485
4824883
4926362
5027930
5129585
5231345
5333209
5435179
5537270
5639494
5741842
5844329
5946970
6049767
6152725
6255860
6359171
6462691
6566418
6670358
6774541
6878988
6983684
7088659
7193941
7299534
73105450
74111720
75118342
76125382
77132836
78140716
79149082
80157976
81167368
82177318
83187882
84199068
85210900
86223440
87236684
88250764
89265672
90281432
91298164
92315952
93334736
94354636
95375764
96398136
97421800
98446880
99473368
100501528
101531344
102562864
103596328
104631904
105669472
106709272
107751528
108796272
109843600
110893760
111946736
1121003056
1131062688
1141125728
1151192656
1161263808
1171338944
 

Detune:

MidiuC
01
11
22
32
43
53
64
74
85
95
106
116
127
137
148
158
169
179
1810
1910
2011
2111
2212
2312
2413
2513
2614
2714
2815
2915
3016
3116
3217
3317
3418
3518
3619
3719
3820
3920
4021
4121
4222
4322
4423
4523
4624
4724
4825
4925
5026
5126
5227
5327
5428
5528
5629
5729
5830
5930
6031
6131
6232
6332
6433
6534
6635
6736
6837
6938
7039
7140
7241
7342
7443
7544
7645
7746
7847
7948
8049
8151
8253
8355
8457
8559
8661
8763
8865
8967
9069
9171
9273
9375
9477
9579
9681
9783
9885
9987
10089
10191
10293
10395
10497
10599
106101
107103
108105
109107
110109
111111
112113
113115
114117
115119
116121
117123
118125
119127
120129
121137
122145
123153
124169
125193
126225
127321
 

Mix

MidiMix
0102400
1118784
2135168
3151552
4167936
5184320
6200704
7217088
8233472
9249856
10266240
11282624
12299008
13315392
14331776
15348160
16364544
17380928
18397312
19413696
20430080
21446464
22462848
23479232
24495616
25512000
26528384
27544768
28561152
29577536
30593920
31610304
32626688
33643072
34659456
35675840
36692224
37708608
38724992
39741376
40757760
41774144
42790528
43806912
44823296
45839680
46856064
47872448
48888832
49905216
50921600
51937984
52954368
53970752
54987136
551003520
561019904
571036288
581052672
591069056
601085440
611101824
621118208
631134592
641150976
651167360
661183744
671200128
681216512
691232896
701249280
711265664
721282048
731298432
741314816
751331200
761347584
771363968
781380352
791396736
801413120
811429504
821445888
831462272
841478656
851495040
861511424
871527808
881544192
891560576
901576960
911593344
921609728
931626112
941642496
951658880
961675264
971691648
981708032
991724416
1001740800
1011757184
1021773568
1031789952
1041806336
1051822720
1061839104
1071855488
1081871872
1091888256
1101904640
1111921024
1121937408
1131953792
1141970176
1151986560
1162002944
1172019328
1182035712
1192052096
1202068480
1212084864
1222101248
1232117632
1242134016
1252150400
1262166784
1272183168
 

Tuesday, November 4, 2025

Midi proxy/Voice assigner

A tiny but exciting win today - I wrote the first line for the XM8 main controller, more specifically a midi proxy/distributor that copies all incoming midi to separate outs. This will let me support multiple voice cards without rewriting the interface (yet).

More importantly though, the proxy does a round robin voice assignment, so instead of forwarding note on/off messages directly, it sends the next note on to the least recently used voice (and makes sure to send note off first, at least for now. This paves the way for polyphony, which is something I've litteraly been waiting a decade for!

As for the communication, I use the serial TX and RX pins directly, from a Teensy 4.1 TX to a Teensy 4.0 RX. It worked immediately, no external components necessary.

It should also be possible to send MIDI at a higher bitrate, right now it runs at the standard 31250bps, I expect that at least 115200 should be problem free.

Don't cut the red wire! 
I'm actually reusing the original voice card controller prototype board for the MIDI proxy, as it has everything needed for receiving MIDI onboard and exposes pins for all the teensy pins. 

Next up is connecting two full voice cards. I can't wait, this is sooo cool!
 

Sunday, January 19, 2025

Gritty noise on panner and oscillator mix volume pots

While testing, I heard a lot of digital sounding noise on the output when turning the volume or pan pots. I first suspected it to be digital noise from the midi connection.

After extensive testing, I've concluded that this is not noise per se, instead it has two causes:
- The midi input is stepped, each pot has max 128 positions
- The CV is linear, so changes are more audible when the volume is low

I tried adding filtering of the output CVs, e.g. making the change take more time even if the midi said to change things instantly. This worked fairly well but when turning the volume pot slowly I could still hear stepping at the lower end.

This is because the steps are of equal size, but audio loudness is exponential. A one unit change when the volume is low is much larger and audible than a one unit change when the volume is high.

I have already added support for response curves, changing to an "exp_1" curve took care of most of the stepping.

As for the filtering, a "max 64 units change per update" gave a good result. 256 is too much. 

Right now the filtering happens at the DAC update, it should be moved to the midi side as the rest of the matrix works as it should.

Wednesday, February 16, 2022

Envelope time curve - midi mapping

After looking at the transfer function of the Little Phatty, I decided to redo the mapping for my XM8. In the same way as with the level function, I'd like to make it dynamically changeable, to be able to dial in the perfect transfer function per envelope.

The LP has an envelope time (per the manual) of 1ms to 10s (10.000ms).

The midi transfer function, with f(x) in ms, is thus

f(x) = 10^(x/(127/4)), for x=0 to 127


To get a changeable function, I looked at my previous work on envelope curves. I have a general function with built in steepness.

A function starting at 0,0 and ending at 1,1 with variable steepness can be written as

f(x) = a * 10^(steepness * x) - a

where

a = 1/((10^steepness) - 1)

Extending this to a case where we want a highest value for input and output, we get

f(x) = Y_max * ( a * 10^(steepness * (x/X_max)) - a)

where again

a = 1/((10^steepness) - 1)

Unlike the LP function, this starts at 0, since I use a 0-indexed time where 0 is the shortest possible time, around 1ms. If we want a different starting point, we get

f(x) = Y_min + (Y_max - Y_min) * (a * 10^(steepness * (x/X_max)) - a)



Saturday, November 17, 2018

Fooled by running status. Again and again.

The midi protocol is not very complex. But one thing keeps making me trip: Running statuses. You can send a status byte, and as long as you don't send a new status byte you may keep sending data bytes for the same status. This is very convenient when sending for example filter sweeps etc.

In my work on the MPG-200 this has made me trip several times. Because:

The source for my midi data has mostly been my Moog Little Phatty. It sends running statuses of course. But when I reboot my mpg-200 without restarting the LP or playing a note, the LP don't send the status message again, and the MPG-200, having just booted, has no way of knowing what it is receiving as it has not seen any status message. It has fooled me more than once.

Today it happened again, but in a more subtle way. I have spent the last week trying to figure out a very strange bug I noticed after a large refactoring of the MPG-200 code: After changing the CC for the filter cutoff using sysex, things worked fine when sending the correct CC from my sysex/web midi based pg-200. But after rebooting nothing worked. Sending a sysex clear memory somehow reset things and the CC started working again.

I stripped down the program to the minimum and it still happened. I discovered though, that sending a midi note on had the same effect. Today I had time to think more thoroughly about it and came to the conclusion that it could not be the part of the program that treats the received bytes, it had to happen on reception. So I hooked up my logic probe to the midi rx line and watched what came into the MPG-200.

Guess what - after a restart, the web gui, knowing nothing about the restart, did not resend the status message. That explained almost everything, I had tripped in the running status issue again. But a little more research uncovered a few other interesting things:

Sending a midi note on from the LP actually reset the running status, so the status message was sent again. This surprised me, how does the web gui know that the LP has sent a midi on? I also tried to refresh the web gui to 'restart' the midi interface, but this did NOT work, it still did not send a new status message.

Then it dawned on me. I am using the LP as my midi interface. It is the LP that holds the state, NOT the web midi adapter! So even if the web midi did restart, the LP knew it was currently sending a particular CC, and so did not resent the status - and of course sending a note on merged into the same data stream and made the LP resent the CC status later.

Oh well, I am just glad I figured this out, even though it's a bit embarrassing.