generating pitch bend

secdef's icon

anyone has any how to use xbend?
i seem to be doing something wrong.
i want to create a pitch bend (not from an actual midi controller but from
something internal to the patch like a live knobslider)

AudioMatt's icon

You're going to have to be a bit more detailed.

What's not going the way you expect?
Have you checked the help file?

secdef's icon

yes, i'm basically not sure what kind of information i need to send to
xbendin. and how do i send xbendout out.
is it int or flo or whatever?
do i need to midi format it before?
what's not going the way i expect (after various different tries)
is actually outputing the pitchbend.
(not through midi format not through midiout)

secdef's icon

i'm sorry if this is a completely obvious question but i'm a newb.

AudioMatt's icon

check the help files. (option + click on object)

If the help files don't send out midi, you've got a problem.

xbendout (and xbendout2) take integers in and send messages formatted for the midiout object.

AudioMatt's icon

It's confused me before. After all, noteout sends midi from max, but bendout just formats messages for midiout. But this is the way it's always been.

AudioMatt's icon

also, double click on midiout to set the port you're sending from

secdef's icon

so can i create an int slider that sends values 0.-168383. to xbendout to miditout and receive a pitch bend in the instrument after the midi effect?

AudioMatt's icon

I copied this from somewhere... Also I made a demonstration patch for you.

Max Patch
Copy patch and select New From Clipboard in Max.

"MSB and LSB Don't let this bit of technical jargon scare you off. MSB stands for Most significant byte and LSB stands for Least significant Byte. This data format is used when 127 values are not enough for the control. Think of it like a shortwave radio. The MSB sets the coarse tuning and the LSB is the fine tuning. Synths with very finely articulated knobs may send out an MSB and LSB, but most just send an LSB. You can tell by recording a knob tweak in your sequencer, then looking at the data in the event editor. If there are two sets of controllers, each with a range of 0-127, that's what's going on, it's sending a MSB and an LSB. Don't worry about learning hexidecimal code that the programmers have to deal with. Unless you are writing music software, all that stuff is a waste of time. Just remember, coarse and fine tuning."

AudioMatt's icon

ps. copy that big block of garbledy gook, open a new patcher, and paste it in.

AudioMatt's icon

To be clear, you can cut that long chord and you've got your high res pitch bend in and out. I just connected them to show you how it works

secdef's icon

o.k i think i got it. this divides the pitch bend into 128 pieces of 128 pieces?
(it took a little time but in the end i just placed an operator with the pitch bend up to 24 st and saw if i hear the changes the lsb is making)

one little question. why is it that the msb receives input>/ 128
and lsb % 128?

AudioMatt's icon
Max Patch
Copy patch and select New From Clipboard in Max.
AudioMatt's icon

Say someone gives you the current time number of minutes after midnight, and you want to display it on your digital watch.

The way to calculate the number of hours is to divide the number of minutes by 60 and round down.

The way to calculate the number of minutes into *the current* hour is by dividing by 60 and display the remainder.

To convert back, you multiply the number of hours by 60 and add the number of minutes.

broc's icon

Just for the sake of completeness:
if you don't need/want the separation of coarse and fine tuning, you can simply use [xbendout] instead of [xbendout2], sending values 0..16383.

Max Patch
Copy patch and select New From Clipboard in Max.

Here is the corresponding patch (adapted from Matt's example).

secdef's icon

o.k so what's the basic differences between the two methods?
if i use msblsb version i get more accuracy and less smoothness and
if i use the other method i get more fluid action but it's less tone accurate?

thank the both for your help i don't think i would have figured this out on my own.

AudioMatt's icon

broc!!!

ok ok ... wait. Now *I'm* confused!!! Perhaps this was the blind leading the blind and an apology is necessary.

If I open up xbendout.maxhelp, There's an xbendout with a 127 step slider attached and it says, "Xbendout only changes the most significant byte of the pitch message." There's a comment pointing to 64 that says "center point"

Then, after that it says "However, using xbendout with midiout, you can send messages which change both bytes."

Those two statements appear to contradict each other.

Furthermore the help file's 128 step slider seems to be manipulating the least significant byte.

Max Patch
Copy patch and select New From Clipboard in Max.

How does midiout tell if it's a high resolution or low resolution signal?

AudioMatt's icon

secdef,

my post might confuse you more than necessary. Not everything in max is this confusing.

secdef's icon

crap. just when i thought i was getting it.

AudioMatt's icon

well wait... your patch works right? That's all that matters.

AudioMatt's icon
AudioMatt's icon

So the help file appears to be incorrectly labeled.

Basically you had it right but the help file confused me.

broc's icon

Yes, the help file for xbendout is obviously wrong.

But the actual behavior is correctly described on the reference page:

"In left inlet: The number is a 14-bit pitch bend value to be formatted into a complete MIDI pitch bend message by xbendout."

AudioMatt's icon

GOOD TO KNOW!

secdef's icon

thank the both of you again!