Skip to content

Pitch Bend Doesn't Send Zero At Center (Sends +8) #1059

@nelsonii

Description

@nelsonii

First off, thank you for this extensive library. I'm using it on a number of MIDI Controllers (mainly PB and CC devices) and it's been extremely helpful. The world needs more Pitch Bend Wheels. :-)

What I'm seeing is that the last value sent for Pitch Bend -- when it's centered -- is +8 or -9. I see this in the most basic "hello world" PB example and in my more complicated code (using mapping, to correct for joystick deadzones, etc).

My customer is using my controller MainStage on a Mac Pro Powerbook osX 14.5. I see it in Pocket MIDI and MIDI-OX (I use those to test / debug messages).

The "last value of 8" is detuning their DAW. Is there any way to get it to send zero? I use mapping, so I can force a pitch bend send when "centered" if need be -- but I'm not sure what that code would be.

12:34:51.026 From Seeed XIAO M0 Pitch Wheel 1 -1354
12:34:51.026 From Seeed XIAO M0 Pitch Wheel 1 -1082
12:34:51.026 From Seeed XIAO M0 Pitch Wheel 1 -921
12:34:51.026 From Seeed XIAO M0 Pitch Wheel 1 -809
12:34:51.026 From Seeed XIAO M0 Pitch Wheel 1 -745
12:34:51.026 From Seeed XIAO M0 Pitch Wheel 1 -697
12:34:51.026 From Seeed XIAO M0 Pitch Wheel 1 -665
12:34:51.026 From Seeed XIAO M0 Pitch Wheel 1 8
12:34:52.015 From Seeed XIAO M0 Pitch Wheel 1 -313
12:34:52.041 From Seeed XIAO M0 Pitch Wheel 1 -297
12:34:52.041 From Seeed XIAO M0 Pitch Wheel 1 -265
12:34:52.041 From Seeed XIAO M0 Pitch Wheel 1 -233
12:34:52.041 From Seeed XIAO M0 Pitch Wheel 1 -201
12:34:52.041 From Seeed XIAO M0 Pitch Wheel 1 -153
12:34:52.041 From Seeed XIAO M0 Pitch Wheel 1 -121
12:34:52.041 From Seeed XIAO M0 Pitch Wheel 1 -89
12:34:52.041 From Seeed XIAO M0 Pitch Wheel 1 -57
12:34:52.041 From Seeed XIAO M0 Pitch Wheel 1 -25
12:34:52.041 From Seeed XIAO M0 Pitch Wheel 1 8
12:34:52.041 From Seeed XIAO M0 Pitch Wheel 1 56
12:34:52.041 From Seeed XIAO M0 Pitch Wheel 1 88
12:34:52.041 From Seeed XIAO M0 Pitch Wheel 1 120
12:34:52.041 From Seeed XIAO M0 Pitch Wheel 1 168

Here are some of the features I'm using -- just snippits as there is a lot of code. (Again, same behavior using the most basic PB example found in the library.)

*** global ***

Bankable::PBPotentiometer potPB {{bankChannel, BankType::ChangeChannel}, pinPB, CHANNEL_1}; // pitch bend

FilteredAnalog<14, 10, uint32_t, uint32_t> filterPB = pinPB;

*** setup ***

  FilteredAnalog<>::setupADC();
  filterPB.resetToCurrentValue();

    potPB.map(mappingFunctionPB_INV);

*** mapping function ***

analog_t mappingFunctionPB_INV(analog_t raw) {

    //INVERTING
    raw = constrain(raw, PBminimumValue, PBmaximumValue);
    if (raw<(PBcenter-PBdeadzone) || raw>(PBcenter+PBdeadzone)) { 
      raw = map(raw, PBminimumValue, PBmaximumValue, 16383, 0);
    } else { raw = 8192; }
    return raw;

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions