Jump to content


Photo

How does 7 bit MIDI CC map to percentage in Renoise?


  • Please log in to reply
5 replies to this topic

#1 Artie Fufkin

Artie Fufkin

    New Member

  • Normal Members
  • Pip
  • 9 posts

Posted 15 October 2018 - 06:25

I've got a 7 bit [0-127] MIDI CC assigned to a Hydra Input and the Hydra output is assigned to a Send's Receiver parameter. There are 128 send tracks. 

Here's is the mapping I'm getting: 

CC: 0, 1, 2, 3, 4, ... 127
Percent: 0, 0.787, 1.575, 2.362, 3.15, ... 100
Track: S1, S1, S2, S4, S4, ... S128
 
Is there a way I can use the formula device and/or other map modes(Relative Signed bit, Relative signed bit 2, etc) to get an arithmetic sequence for the send receiver, to match the MIDI value?


#2 4Tey

4Tey

    Big Masta Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPip
  • 547 posts
  • Gender:Male

Posted 15 October 2018 - 14:05

One of your questions is: How does 7 bit MIDI CC map to percentage in Renoise?

 

Off the top of my head Artie (I have no idea how Renoise does it internally btw), I suppose I'd scale the MIDI CC number by 127 and multiply by 100?

Percentage = (CC / 127) * 100

Producing the following table:

CC    %         CC    %          CC    %
---------------------------------------------
000 - 0.000     048 - 37.795     096 - 75.591  
001 - 0.787     049 - 38.583     097 - 76.378  
002 - 1.575     050 - 39.370     098 - 77.165  
003 - 2.362     051 - 40.157     099 - 77.953  
004 - 3.150     052 - 40.945     100 - 78.740  
005 - 3.937     053 - 41.732     101 - 79.528  
006 - 4.724     054 - 42.520     102 - 80.315  
007 - 5.512     055 - 43.307     103 - 81.102  
008 - 6.299     056 - 44.094     104 - 81.890  
009 - 7.087     057 - 44.882     105 - 82.677  
010 - 7.874     058 - 45.669     106 - 83.465  
011 - 8.661     059 - 46.457     107 - 84.252  
012 - 9.449     060 - 47.244     108 - 85.039  
013 - 10.236    061 - 48.031     109 - 85.827  
014 - 11.024    062 - 48.819     110 - 86.614  
015 - 11.811    063 - 49.606     111 - 87.402  
016 - 12.598    064 - 50.394     112 - 88.189  
017 - 13.386    065 - 51.181     113 - 88.976  
018 - 14.173    066 - 51.969     114 - 89.764  
019 - 14.961    067 - 52.756     115 - 90.551  
020 - 15.748    068 - 53.543     116 - 91.339  
021 - 16.535    069 - 54.331     117 - 92.126  
022 - 17.323    070 - 55.118     118 - 92.913  
023 - 18.110    071 - 55.906     119 - 93.701  
024 - 18.898    072 - 56.693     120 - 94.488  
025 - 19.685    073 - 57.480     121 - 95.276  
026 - 20.472    074 - 58.268     122 - 96.063  
027 - 21.260    075 - 59.055     123 - 96.850  
028 - 22.047    076 - 59.843     124 - 97.638  
029 - 22.835    077 - 60.630     125 - 98.425  
030 - 23.622    078 - 61.417     126 - 99.213  
031 - 24.409    079 - 62.205     127 - 100.000 
032 - 25.197    080 - 62.992		 
033 - 25.984    081 - 63.780
034 - 26.772    082 - 64.567
035 - 27.559    083 - 65.354
036 - 28.346    084 - 66.142
037 - 29.134    085 - 66.929
038 - 29.921    086 - 67.717
039 - 30.709    087 - 68.504
040 - 31.496    088 - 69.291
041 - 32.283    089 - 70.079
042 - 33.071    090 - 70.866
043 - 33.858    091 - 71.654
044 - 34.646    092 - 72.441
045 - 35.433    093 - 73.228
046 - 36.220    094 - 74.016
047 - 37.008    095 - 74.803

Likewise (with a spot of Algebra) you could rearrange the formula to calculate a rough CC from a given percentage:

RoughCC = (Percentage / 100) * 127

From -> http://forum.renoise...uitar-multi-fx/

And this table ->

CC Percent Track
0   0      1
1   0.787  1
2   1.575  2
3   2.362  4
4   3.15   4
5   3.937  6
6   4.724  7
7   5.512  8
8   6.299  8
9   7.087  9
10  7.874  11
11  8.661  12
12  9.449  13
13  10.236 13
14  11.024 15

I think you are asking why you are getting those Track values in the Send Receiver when you set the Hydra Min/Max range to 0 and 127?  Just out of my own curiosity: do you get a more consistent result if you set the Min/Max range in Hydra to Min:0 and Max:128?


  • random, Neurogami and Artie Fufkin like this

#3 Zer0 Fly

Zer0 Fly

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1262 posts
  • Gender:Not Telling
  • Location:Am Mind
  • Interests:Buddha

Posted 15 October 2018 - 22:21

Try this formula in the *formula device:

(A*127)/255

it should translate 7bit cc to send channel selection in #send device



#4 Artie Fufkin

Artie Fufkin

    New Member

  • Normal Members
  • Pip
  • 9 posts

Posted 17 October 2018 - 04:29

Ah ok I had an off-by-one error with the divisor. 

4Tey, your table is exactly what Renoise is producing. 

 

I think the order in which I created send tracks may have affected which ones were assigned(I was hoping to be able to switch through the sends, wrapping around at 128, effectively ignoring sends beyond 128 so that I could use them differently), or perhaps the Receiver list wasn't updating...?... So I started over and created the 128 tracks and now Hydra Min/Max range to 0 and 127 is working! 

 

I was switching the max on the Hydra and getting the "Linked Send Track Does Not Exist" even for a track that existed, which is why I speculated that the Receiver list might not update on certain changes.

 

Zer0 Fly, that formula is producing the skips and repeats I was getting before. 

(A*128)/256 works though. Thank you 

 

The last part I would want to do with this is scale it down to less tracks(4 to 8) and still have it wrap around. 

I would think I'd have to do some modular arithmetic, but I haven't quite figured out what to do or how yet. 



#5 4Tey

4Tey

    Big Masta Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPip
  • 547 posts
  • Gender:Male

Posted 17 October 2018 - 05:46

I think the order in which I created send tracks may have affected which ones were assigned(I was hoping to be able to switch through the sends, wrapping around at 128, effectively ignoring sends beyond 128 so that I could use them differently), or perhaps the Receiver list wasn't updating...?... So I started over and created the 128 tracks and now Hydra Min/Max range to 0 and 127 is working! 
 
I was switching the max on the Hydra and getting the "Linked Send Track Does Not Exist" even for a track that existed, which is why I speculated that the Receiver list might not update on certain changes.

 

Just a bit of speculation:  But I think you've uncovered a subtle 'bug' (bug is too strong a word though) Artie in Renoise due to some internal rounding error when it comes to assigning say some Hydra output to that send receiver.  Let's say it 'skips' send tracks with 127 assigned in max Hydra.  If you momentarily increase the max value from 127 to 128, you'll find that it probably 'works' (albeit with that 'send track doesn't exist (even though it does)' warning.  Then if you knock the max value in Hydra back down to 127, it'll now suddenly 'work' more as expected.  Basically you can't fully trust Renoise here and is kinda confusing the situation.  You are using a floating point value to control/select from a (integer) list.  You see what you want Artie is to put in the number say integer 5 from a MIDI CC, go through Hydra with its floating point division and multiplication and scaling from 0 to 255 etc, and output the number exactly 5 to the send receiver list.  Unfortunately that doesn't fully happen, maybe sometimes you get the value 4.46543 internally, in which case it'll probably convert to the number 4, hence the 'skips' and 'repeats'.  Sometimes though you can get it so that the rounding plays ball by working more evenly with numbers like 128 and 256 rather than 127 and 255.  IDK Artie, but this is just some quick speculation on my part :)


Edited by 4Tey, 17 October 2018 - 06:48.


#6 Zer0 Fly

Zer0 Fly

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1262 posts
  • Gender:Not Telling
  • Location:Am Mind
  • Interests:Buddha

Posted 17 October 2018 - 15:44

I am very sorry for the sloppy job.

 

Try the following formula:

(A*127-0.5)/255

 It should produce no more skips and jumps or the like.

 

The problem is (x+1)/255 defines not the selected channel for the send device. It defines the thresholds between the selected states for the analog "x" floating point value. The first formula would target directly at the threshold, and generate flaky results because of rounding errors. The "0.5" factor corrects it by placing the results right in the middle between the thresholds.

 

Fun fact: you can make renoise have more send channels than are selectable with the send device. duh...

 

 

Edit, for your wraparound with the first 8 channels do something like:

(mod(A*127,8)-0.5)/255

for wrapping around channels 4-10 (6 channels selected starting from channel 4):

(mod(A*127,6)+4-0.5)/255

Edited by Zer0 Fly, 17 October 2018 - 18:11.