Jump to content

10 bit resolution


Chomsky
 Share

Recommended Posts

It's already 10-bit, you would have to send (N)RPN's or pitch control to use it though. Have a search for RPN on the forum and you'll find lots of info :)

Thank you for your reply. I'm very new to this Midibox-stuff and you have to answer me two questions:

1.) What is (N)RPN and CC?

2.) How can I convert CC to (N)RPN. In the Examples-section of the C-Interface-side of ucapps.de there is only an example how to convert CC to (N)RPN on an modwheel event. How can I do this on Pots-events?

Link to comment
Share on other sites

1.) What is (N)RPN and CC?

CC is the abbrev. for ControlChange, which is one of the most important Midi Messages.

NRPN is an advanced feature to allow transmission of values greater than 7bit (0..127)

See here: http://www.midibox.org/dokuwiki/doku.php?id=midi_specification

If you follow all links on this page, you're a MIDI-Pro :)

2.) How can I convert CC to (N)RPN

Your question implies a lack of understanding:

Why do you want to convert a 7bit value to a 14bit value? (You can't make 14 cookies if you just got 7 ;) - means: increase the resolution from low to high. However, you can read the 10bit value of an AIN-pin (maximum resolution you get from MIOS) and convert (and send) this as 14bit (N)RPN or PitchBend, for example (this is also interpolated, but you got 3 Bytes more (0..1023 is 10bit, 0..16383 is 14bit – 0..127 is 7bit).

14 bit values are just 2x 7bit with a Least Significant Byte (LSB) and a Most Significant Byte (MSB). See the midi page @ borg.com for detailed info.

Chomsky, you said you want 10-bit resolution but you don't know how to use it... I wonder, what are you actually trying to do here?

I'd be interested, too :)

Link to comment
Share on other sites

Chomsky, you said you want 10-bit resolution but you don't know how to use it... I wonder, what are you actually trying to do here? What's your desired outcome? Maybe we can find an easy way :)

So, I nedd to explain more precisely what I want to do: Recently I have mounted a Core-module and at the time I have only one Pot connected to it. Then I programmed my PIC to send MIDI events on pot movements as discribed on the C-interface-site on ucapps.de in the Examples section. And then I was quite a bit flabbergasted, because the resolution of the Pots-movements were only 7 Bit although the PIC is able to handle 10 Bit according to the ucapps-Introduction-site. So finally, my question is: What do I have to do to get 10-Bit resolution?

Link to comment
Share on other sites

right, but what do you want to do with that 10bit value?

(you can send 14 bit by MIDI btw).

There is more than one possibility: (N)RNP (CC's with a MSB/LSB value), PitchControl, SysEx...

That really depends on what is receiving your message (eg modulation only accepts 0..127, so 14 bit is quite useless, whereas for pitchBend it can be very useful...)

Link to comment
Share on other sites

right, but what do you want to do with that 10bit value?

(you can send 14 bit by MIDI btw).

There is more than one possibility: (N)RNP (CC's with a MSB/LSB value), PitchControl, SysEx...

That really depends on what is receiving your message (eg modulation only accepts 0..127, so 14 bit is quite useless, whereas for pitchBend it can be very useful...)

I tried to find out what is the meaning of CC,(N)RPN,etc. but I was not very succesfull, so you need to help me. I tell you, what I understood so far:

Let A be a machine wich is connected to annother machine B through MIDI. So, A is the master and B is the slave.

seg.gif

When A want to send a message to B it alway goes like this:

  • There are different kinds of MIDI-messages like note-on, note-of, pitch bend, song select and so on. So, the first thing A will send to B is the information wich kind of MIDI-message it want to send. Hence, A will send a special byte to B, the so-called status-byte. The meaning for this byte is, that A is calling B and saying: "Hello, here is A, please be prepared to recieve a specific message of kind XY from me"

  • Next, A sends out one or two data bytes to B. How many data bytes are send depends on the kind of MIDI-message. Some MIDI-messages send only one data-byte and others send two.

All together A sends to B two or three bytes, to transfer a complete MIDI-message. For example: suppose A want to send to B the message, that a key is pressed with a certain velocity. The first thing A will send to B is the status-byte. The status-byte for a note-on-event is 10010000 in binary or 144 in decimal. Thus A sends 10010000 to B.

2.gif

Now B says: "Ahh! A will tell me very soon that a key is pressed and what is the velocity". Suppose we pressed the middle C on the keyboard. Therefore A tells B that middle-C was pressed by sending the first data-byte. The value for the middle-C is 00111100

2_1.gif

And now A tells B that middle-C was pressed with a velocity of 48 which equals 0011000 in binary.

2_2.gif

And finally B recieved the complete MIDI-message. If you want to send this message with MIOS, then you would have to write:

MIOS_MIDI_BeginStream();

   MIOS_MIDI_TxBufferPut(0x90);   // 90 hexadecimal == 10010000 binary

   MIOS_MIDI_TxBufferPut(0x3C);   // 3C hexadecimal == 00111100 binary

   MIOS_MIDI_TxBufferPut(0x30);   // 30 hexadecimal == 00110000 binary

MIOS_MIDI_EndStream();

Now suppose that machine A is my own-build midibox and machine B is my computer. My midibox is the master and my computer is the slave. Suppose I move a fader which is mounted on my midibox a little bit to the right. Thus my midibox will send to my computer a special MIDI-message, the so called control-change-message. The status-byte value of this MIDI-message is 10110000 or B0 in hexadecimal. The control-change-message (or short CC-message) sends out two data bytes. In the programming examples section on the C-interface site of ucaps I found the code for sending CC-events on pot-movement:

/////////////////////////////////////////////////////////////////////////////

// This function is called by MIOS when a pot has been moved

/////////////////////////////////////////////////////////////////////////////

void AIN_NotifyChange(unsigned char pin, unsigned int pin_value) __wparam

{

  // a pot has been moved, send CC# at channel 1

  MIOS_MIDI_TxBufferPut(0xb0); // CC at channel 1

  MIOS_MIDI_TxBufferPut(pin);  // pin number corresponds to CC number

  MIOS_MIDI_TxBufferPut(MIOS_AIN_Pin7bitGet(pin));   // don't send 10bit pin_value,

                                                                           // but 7bit value

}

The first command tells my Computer that a CC-Event is comming. The next two messages semms to send out the two data bytes. The big disadvantage of this Code is, that the resolution is only 7 bit. What I want to know is, wheter it is possible to get a higher resolution? And what I must do to get this?

Link to comment
Share on other sites

I tried to find out what is the meaning of CC,(N)RPN,etc. but i was not very succesfull, so you need to help me. I tell you, what I understood so far:

The first command tells my Computer that a CC-Event is comming. The next two messages semms to send out the two data bytes. The big disadvantage of this Code is, that the resolution is only 7 bit. What I want to know is, wheter it is possible to get a higher resolution? And what I must do to get this?

Chomsky,

I think you're making it a bit too complicated ;)

Forget about the bits, it's just interesting to know that if the status-bit is set, then it's no data-byte, but if you're not coding a MIDI-protocol that's of no interest for you. You might rather check out the midi-tables 2 and 3

table 2 shows you the midi-summary:

http://www.midi.org/about-midi/table2.shtml

- NOTE_OFF on ch1 is 128; NOTE_OFF on ch2 is 129, NOTE_OFF on ch3 is 130 and so on...

- CONTROLLER (CC) is in fact the same type as NOTE_ON or NOTE_OFF, it ranges from 176 to 191.

for NOTE_ON you have: Type/CH + Pitch + Velocity

for CC its: Type/CH + CCNum + CCValue

(it's really all written down there, I can't explain it better!)

basically it's just two or three times numbers from 0-255 or 0-127 (type/CHannel + parameterA + parameterB).

table 3 shows you the available CCNums!

The trick is to send 2 CCs, 1 MSB (most significant byte) and 1 LSB (Least significant byte). By combining the two 7bit values you get 14bit.

BUT: the host (in your case B) has to combine these bytes and it won't do this automatically! And that's why stryd_one and me asked about your plans (which are still not revealed)?

If you don't explain in what way your slave will process this 14bit value, I can't tell you if you should send an MSB/LSB CC or (for example) a pitch, which is recognized as 14bit by default and is no CC but a type of it's own (again, see the table!):

225 -239 (CH1-16) / 7bit-LSB / 7bit-MSB (Pitch Wheel Change)

1110nnnn     0lllllll         Pitch Wheel Change.

             0mmmmmmm         This message is sent to indicate a change in the

                              pitch wheel.  The pitch wheel is measured by a

                              fourteen bit value. Center (no pitch change) is

                              2000H.  Sensitivity is a function of the transmitter.

                              (llllll) are the least significant 7 bits.

                              (mmmmmm) are the most significant 7 bits.

regards,

Michael

Link to comment
Share on other sites

I want to control Traktor-DJ-Studio with my midibox

Then look in the traktor midi-implementation chart that exists for every midi-capable device and see what kind of messages traktor likes to receive for tape deck tempo. If traktor supports midi assignments,see if you can assign pitch wheel or NRNP messages.

Then you can simply send a message of this type from your midibox.

however, you could (as stryd_one mentioned) have searched this forum for traktor and would have found two threads that might be of interest to you:

http://www.midibox.org/forum/index.php?topic=3852.0

http://www.midibox.org/forum/index.php?topic=3858.0

Then search for MSB LSB. There are plenty of topics covering exactly your question, even in german language. If questions remain, you might ask again here -  :)

best regards,

Michael

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...