PURE DATA forum~

...that deal with pure data

You are not logged in.

#1 2012-06-04 02:21:45

Samelot
Member

Midi scaling to correct intervals?

Hello, I'm currently working on a patch for pure data, so that I can use my Gladiator VST with a more mouse free approach. I am programing this patch to work with osculator inside Ableton Live.

The first thing I did was I made two buttons on my midi controller increment and decrement the first wave form in Gladiator (Osc1 Wave). Researching people trying to do this same thing for the tempo control in Ableton, I was able to find a patch that did this by making use of the moses object. So briefly, what each button is doing is sending to PD from Osculator and then incrementing or decrementing the moses object and then sending information back to Osculator through one midi message (ctlout 1 1). This message is than sent to Ableton and the Gladiator VST.

This has been working pretty great, and I'm fairly pleased, but there are some fine tunings I need to do in order to get it perfect. The Osc1 Wave slider goes up from 0 to 1000, and oddly, there are only 163 waveforms. So from 163 to 1000, the waveform just stays at waveform 163. When I first map [midi 1 1] in osculator to Osc1 Wave in gladiator, as I increment and decrement with my midi control, the intervals are by 16, which is bad because I skip 15 waveforms or so with every interval. To reduce this interval, I set the min and max of the midi message 1 in Ableton (which holds gladiator vst) from 0.0 - 1.0 to 0.0 - 0.17. This has made my interval mostly 1, with the occasional 2, skipping a waveform.

Ex: 0, 1, 2, 4, 5, 6, 8, etc.

I have done some research in an effort to solve this problem which I believe has something to do with translating/scaling the standard 127 midi range to a different  range. I have messed around with strings such as:

[* 127]
|
|
[/ 1000]

but had little luck, and I'm not sure if this would even be in the same realm as my problem.

I'm attaching my osc and pd files, let me know if anything is unclear.
Thanks!

Last edited by Samelot (2012-06-04 02:22:12)


Attachments:
Attachment Icon tempo4.pd, Size: 840 bytes, Downloads: 44
Attachment Icon tempo4.oscd, Size: 8,119 bytes, Downloads: 35

Offline

 

#2 2012-06-04 08:42:54

Maelstorm
Administrator

Re: Midi scaling to correct intervals?

This is just something that isn't going to happen with a single MIDI cc value. You only get a resolution of 128 integers with MIDI, which obviously is not enough to completely cover 163 waveforms.

I never got deep enough into Live to see if this is possible, but if you can use two cc messages to control a parameter, then that might work. The idea is that one MIDI cc is the least significant byte and the other is the most significant, and when put together they can represent a range of 128*128=16284 values (this is often used for pitch bend).


.mmb   |   My library

Offline

 

#3 2012-06-04 12:32:56

mod
Administrator

Re: Midi scaling to correct intervals?

if you MUST output more than 128 steps with a single midi CC, then you can send two CC messages in a row, in much the same way as using two separate CC's.

so for example, 0, 100 would correspond to a value of 0 x 128 + 100 = 100
and then 1, 100 would correspond to 1 x 128 + 100 = 228

etc

Offline

 

#4 2012-06-05 20:06:13

Samelot
Member

Re: Midi scaling to correct intervals?

Maelstorm wrote:

This is just something that isn't going to happen with a single MIDI cc value. You only get a resolution of 128 integers with MIDI, which obviously is not enough to completely cover 163 waveforms.

I never got deep enough into Live to see if this is possible, but if you can use two cc messages to control a parameter, then that might work. The idea is that one MIDI cc is the least significant byte and the other is the most significant, and when put together they can represent a range of 128*128=16284 values (this is often used for pitch bend).

So would it be, in this case, that all values up to 163 would be covered (each gotten to by skipping 1 integer), and then there would just be a large quantity of extra left over (164-16284) which you simply wouldn't use?

I'm also a bit confused on the least significan and most significant byte.

Thankyou

Offline

 

#5 2012-06-05 20:08:52

Samelot
Member

Re: Midi scaling to correct intervals?

mod wrote:

if you MUST output more than 128 steps with a single midi CC, then you can send two CC messages in a row, in much the same way as using two separate CC's.

so for example, 0, 100 would correspond to a value of 0 x 128 + 100 = 100
and then 1, 100 would correspond to 1 x 128 + 100 = 228

etc

does 0 stand for midi cc? and what does 100 stand for? Would the intervals being jumped here be 100, 228, 484, 612, etc? Wouldn't that be far to big a gap?

Thx

Offline

 

#6 2012-06-05 22:29:45

Maelstorm
Administrator

Re: Midi scaling to correct intervals?

mod was trying to express the same thing I was saying a little more clearly. The idea is that you use two MIDI cc's to represent one number. This is what pitch bend does for more precision (you'll notice that most software represents pitch bend in the range of -8142 -- 8141). The way this is done is by multiplying one cc value by 128 and adding that to the other cc value. So, basically, instead of two 7-bit values, you combine it into one 14-bit value.

As an example, say we want controller 2 (breath) to have more precision. You could couple it to another cc, such as controller 34 (as suggested by the MIDI standard). The most significant byte is the one that gets multiplied by 128, since it makes the most difference. Every time the value of controller 2 goes up by one, the overall combined value jumps by 128. The least significant byte just fine-tunes it by providing the values between those jumps of 128. So the 0 in mod's example is the value of the controller 2 (MSB) while the 100 is the value of controller 34 (LSB). So when the overall combined value is increasing smoothly, the LSB counts from 0 to 127, then jumps back to 0 while the MSB increases by 1. Then the LSB counts back up to 127 again, then jumps back to 0 as the MSB increases again.


Maybe this will help visualize...

Increasing MSB (controller 2 in this example):

MSB              LSB
-----              -----
  0   * 128  +   0    = 0
  1   * 128  +   0    = 128
  2   * 128  +   0    = 256

Increasing LSB (controller 34)

MSB              LSB
-----              -----
  2   * 128  +   1    = 257
  2   * 128  +   2    = 258
  2   * 128  +   3    = 259


.mmb   |   My library

Offline

 

#7 2012-06-06 04:02:13

mod
Administrator

Re: Midi scaling to correct intervals?

yeah, but i was saying that you can hack a single cc to do the same thing, if you send pairs of messages in succession.

so for example, on midi control number 17, if you send 5, followed by 77, then you could convert that in pd to 5*128 + 77

Offline

 

#8 2012-06-06 04:09:16

Maelstorm
Administrator

Re: Midi scaling to correct intervals?

Yeah, but it looks like the mapping has to be done to control a synth in Live, so it's unlikely that that hack could be done.


.mmb   |   My library

Offline

 

#9 2012-06-06 07:19:06

mod
Administrator

Re: Midi scaling to correct intervals?

ah yeah, right

Offline

 

#10 2012-06-06 09:19:31

Gromit
Member

Re: Midi scaling to correct intervals?

I dont know Gladiator or Osculator but ..
My favored way to control Ableton is to use midi remote scripts e.g. touchcontrol.
Connect pd via osc to that script in Ableton, and just send messages like

| /live/tempo 123.45 (

This way, you can control almost everything in Ableton.


0.43.4-extended on winXP-7

Offline

 

Board footer

Powered by PunBB
Copyright 20022005 Rickard Andersson


pd.webring info