Flickering Potentiometer

PieterP:
It works on my Teensy 3.2 without multiplexers. Post your exact code, and post the schematic you're using with the multiplexers.

thanks

I copied exactly your code .. it remained the same, maybe I did not understand it. the schematic in the attach..it only a part of it but this is the way that i use to make the connection

potentiometer-sendreturn-1-1.pdf (66.2 KB)

If you don't drive the address lines of those muxes, they're in an undefined state. Add an AnalogMultiplex object and use its pins.

[b][color=#d35400]AnalogMultiplex[/color][/b] [color=#000000]multiplexer[/color][color=#000000]([/color][color=#00979c]A0[/color][color=#434f54],[/color] [color=#000000]{[/color] [color=#000000]2[/color][color=#434f54],[/color] [color=#000000]3[/color][color=#434f54],[/color] [color=#000000]4[/color][color=#434f54],[/color] [color=#000000]5[/color] [color=#000000]}[/color] [color=#000000])[/color][color=#000000];[/color]

[b][color=#d35400]Analog[/color][/b] [color=#000000]potentiometers[/color][color=#000000][[/color][color=#000000]][/color] [color=#434f54]=[/color] [color=#000000]{[/color]
  [color=#000000]{[/color][color=#000000]multiplexer[/color][color=#434f54].[/color][color=#d35400]pin[/color][color=#000000]([/color][color=#000000]0[/color][color=#000000])[/color][color=#434f54],[/color] [b][color=#d35400]MIDI_CC[/color][/b][color=#434f54]:[/color][color=#434f54]:[/color][color=#00979c]Channel_Volume[/color][color=#434f54],[/color] [color=#000000]1[/color][color=#000000]}[/color][color=#434f54],[/color]
  [color=#000000]{[/color][color=#000000]multiplexer[/color][color=#434f54].[/color][color=#d35400]pin[/color][color=#000000]([/color][color=#000000]1[/color][color=#000000])[/color][color=#434f54],[/color] [b][color=#d35400]MIDI_CC[/color][/b][color=#434f54]:[/color][color=#434f54]:[/color][color=#00979c]Channel_Volume[/color][color=#434f54],[/color] [color=#000000]2[/color][color=#000000]}[/color][color=#434f54],[/color]
  [color=#000000]{[/color][color=#000000]multiplexer[/color][color=#434f54].[/color][color=#d35400]pin[/color][color=#000000]([/color][color=#000000]2[/color][color=#000000])[/color][color=#434f54],[/color] [b][color=#d35400]MIDI_CC[/color][/b][color=#434f54]:[/color][color=#434f54]:[/color][color=#00979c]Channel_Volume[/color][color=#434f54],[/color] [color=#000000]3[/color][color=#000000]}[/color][color=#434f54],[/color]
  [color=#000000]{[/color][color=#000000]multiplexer[/color][color=#434f54].[/color][color=#d35400]pin[/color][color=#000000]([/color][color=#000000]3[/color][color=#000000])[/color][color=#434f54],[/color] [b][color=#d35400]MIDI_CC[/color][/b][color=#434f54]:[/color][color=#434f54]:[/color][color=#00979c]Channel_Volume[/color][color=#434f54],[/color] [color=#000000]4[/color][color=#000000]}[/color][color=#434f54],[/color]
[color=#000000]}[/color][color=#000000];[/color]

PieterP:
If you don't drive the address lines of those muxes, they're in an undefined state. Add an AnalogMultiplex object and use its pins.

[b][color=#d35400]AnalogMultiplex[/color][/b] [color=#000000]multiplexer[/color][color=#000000]([/color][color=#00979c]A0[/color][color=#434f54],[/color] [color=#000000]{[/color] [color=#000000]2[/color][color=#434f54],[/color] [color=#000000]3[/color][color=#434f54],[/color] [color=#000000]4[/color][color=#434f54],[/color] [color=#000000]5[/color] [color=#000000]}[/color] [color=#000000])[/color][color=#000000];[/color]

Analog potentiometers[] = {
  {multiplexer.pincolor=#000000[/color], MIDI_CC::Channel_Volume, 1},
  {multiplexer.pincolor=#000000[/color], MIDI_CC::Channel_Volume, 2},
  {multiplexer.pincolor=#000000[/color], MIDI_CC::Channel_Volume, 3},
  {multiplexer.pincolor=#000000[/color], MIDI_CC::Channel_Volume, 4},
};

its working you are my god :slight_smile: :slight_smile: thaaaaaaaankssss

so if i want to do this with all my pots.. ? how can i structurate the code'

thaaaanksss

If you want a clean solution, you'll have to wait untill I add the code to the library, or add it yourself. You could make your own Analog class, as explained on the Wiki. Take a look at Analog.h and Analog.cpp for inspiration. First try to understand how the code I posted works.

If you don't have that much time, just create the HystFilters manually, and use the Analog::map(std::function<int(int)>) function to apply them to all potentiometers. That's exactly what happens in the code I posted. Try to understand it first, and ask questions if you don't understand how it works.
Here are some comments:

[b][color=#d35400]Analog[/color][/b] [color=#000000]potentiometers[/color][color=#000000][[/color][color=#000000]][/color] [color=#434f54]=[/color] [color=#000000]{[/color] [color=#434f54]// Create an array of 4 new Analog objects[/color]
  [color=#000000]{[/color][color=#000000]multiplexer[/color][color=#434f54].[/color][color=#d35400]pin[/color][color=#000000]([/color][color=#000000]0[/color][color=#000000])[/color][color=#434f54],[/color] [b][color=#d35400]MIDI_CC[/color][/b][color=#434f54]:[/color][color=#434f54]:[/color][color=#00979c]Channel_Volume[/color][color=#434f54],[/color] [color=#000000]1[/color][color=#000000]}[/color][color=#434f54],[/color]
  [color=#000000]{[/color][color=#000000]multiplexer[/color][color=#434f54].[/color][color=#d35400]pin[/color][color=#000000]([/color][color=#000000]1[/color][color=#000000])[/color][color=#434f54],[/color] [b][color=#d35400]MIDI_CC[/color][/b][color=#434f54]:[/color][color=#434f54]:[/color][color=#00979c]Channel_Volume[/color][color=#434f54],[/color] [color=#000000]2[/color][color=#000000]}[/color][color=#434f54],[/color]
  [color=#000000]{[/color][color=#000000]multiplexer[/color][color=#434f54].[/color][color=#d35400]pin[/color][color=#000000]([/color][color=#000000]2[/color][color=#000000])[/color][color=#434f54],[/color] [b][color=#d35400]MIDI_CC[/color][/b][color=#434f54]:[/color][color=#434f54]:[/color][color=#00979c]Channel_Volume[/color][color=#434f54],[/color] [color=#000000]3[/color][color=#000000]}[/color][color=#434f54],[/color]
  [color=#000000]{[/color][color=#000000]multiplexer[/color][color=#434f54].[/color][color=#d35400]pin[/color][color=#000000]([/color][color=#000000]3[/color][color=#000000])[/color][color=#434f54],[/color] [b][color=#d35400]MIDI_CC[/color][/b][color=#434f54]:[/color][color=#434f54]:[/color][color=#00979c]Channel_Volume[/color][color=#434f54],[/color] [color=#000000]4[/color][color=#000000]}[/color][color=#434f54],[/color]
[color=#000000]}[/color][color=#000000];[/color]

[color=#000000]HystFilter[/color] [color=#000000]hystFilters[/color][color=#000000][[/color][color=#000000]4[/color][color=#000000]][/color][color=#000000];[/color] [color=#434f54]// Create an array of 4 new HystFilter objects[/color]

[color=#434f54]// Make sure that the number of HystFilters and the number of Analog potentiometers are the same[/color]
[color=#00979c]const[/color] [b][color=#d35400]size_t[/color][/b] [color=#000000]nb_pots[/color] [color=#434f54]=[/color] [color=#00979c]sizeof[/color][color=#000000]([/color][color=#000000]potentiometers[/color][color=#000000])[/color] [color=#434f54]/[/color] [color=#00979c]sizeof[/color][color=#000000]([/color][color=#000000]potentiometers[/color][color=#000000][[/color][color=#000000]0[/color][color=#000000]][/color][color=#000000])[/color][color=#000000];[/color]
[color=#00979c]const[/color] [b][color=#d35400]size_t[/color][/b] [color=#000000]nb_hyst[/color] [color=#434f54]=[/color] [color=#00979c]sizeof[/color][color=#000000]([/color][color=#000000]hystFilters[/color][color=#000000])[/color] [color=#434f54]/[/color] [color=#00979c]sizeof[/color][color=#000000]([/color][color=#000000]hystFilters[/color][color=#000000][[/color][color=#000000]0[/color][color=#000000]][/color][color=#000000])[/color][color=#000000];[/color]
[color=#000000]static_assert[/color][color=#000000]([/color][color=#000000]nb_pots[/color] [color=#434f54]==[/color] [color=#000000]nb_hyst[/color][color=#434f54],[/color] [color=#005c5f]"Error: number of Analog potentiometers should be the same as the number of HystFilters"[/color][color=#000000])[/color][color=#000000];[/color]

[color=#00979c]void[/color] [color=#5e6d03]setup[/color][color=#000000]([/color][color=#000000])[/color] [color=#000000]{[/color]
  [color=#5e6d03]for[/color] [color=#000000]([/color][b][color=#d35400]size_t[/color][/b] [color=#000000]i[/color] [color=#434f54]=[/color] [color=#000000]0[/color][color=#000000];[/color] [color=#000000]i[/color] [color=#434f54]<[/color] [color=#000000]nb_pots[/color][color=#000000];[/color] [color=#000000]i[/color][color=#434f54]++[/color][color=#000000])[/color] [color=#434f54]// For all potentiometers[/color]
    [color=#434f54]// Apply a HystFilter to the analog value before sending it over MIDI[/color]
    [color=#000000]potentiometers[/color][color=#000000][[/color][color=#000000]i[/color][color=#000000]][/color][color=#434f54].[/color][color=#d35400]map[/color][color=#000000]([/color][color=#000000][[/color][color=#000000]i[/color][color=#000000]][/color][color=#000000]([/color][color=#00979c]int[/color] [color=#000000]raw[/color][color=#000000])[/color][color=#000000]{[/color] [color=#5e6d03]return[/color] [color=#000000]([/color][color=#00979c]int[/color][color=#000000])[/color] [color=#000000]hystFilters[/color][color=#000000][[/color][color=#000000]i[/color][color=#000000]][/color][color=#434f54].[/color][color=#000000]getOutputLevel[/color][color=#000000]([/color][color=#000000]raw[/color][color=#000000])[/color][color=#000000];[/color] [color=#000000]}[/color][color=#000000])[/color][color=#000000];[/color]
    [color=#434f54]// Note that you need a different HystFilter for each potentiometer[/color]
[color=#000000]}[/color]

If you don't understand the [nobbc]potentiometers[i].map(...)[/nobbc] part, it's a capturing lambda expression (google it).

thanks

so i google it but i don't know where to put this function : Analog::map(std::function<int(int)>)

i watch the code and try to understand but its not easy...
every time i try to write somthing it gaves me a lot of error...
so thats the code that working befor errors

sorryyy for spending your time :frowning:

thanks

#include <MIDI_Controller.h> // Include the library
#include "HystFilter.h"

// USBDebugMIDI_Interface udmi(115200);

AnalogMultiplex 
multiplexer(A0, { 2, 3, 4, 5 } );


Analog potentiometers[] = {
  {multiplexer.pin(0), MIDI_CC::Channel_Volume, 1},
  {multiplexer.pin(1), MIDI_CC::Channel_Volume, 2},
  {multiplexer.pin(2), MIDI_CC::Channel_Volume, 3},
  {multiplexer.pin(3), MIDI_CC::Channel_Volume, 4},
  {multiplexer.pin(4), MIDI_CC::Channel_Volume, 5},
  {multiplexer.pin(5), MIDI_CC::Channel_Volume, 6},
  {multiplexer.pin(6), MIDI_CC::Channel_Volume, 7},
  {multiplexer.pin(7), MIDI_CC::Channel_Volume, 8},
  {multiplexer.pin(8), MIDI_CC::Channel_Volume, 9},
  {multiplexer.pin(9), MIDI_CC::Channel_Volume, 10},
  {multiplexer.pin(10), MIDI_CC::Channel_Volume, 11},
  {multiplexer.pin(11), MIDI_CC::Channel_Volume, 12},
  {multiplexer.pin(12), MIDI_CC::Channel_Volume, 13},
  {multiplexer.pin(13), MIDI_CC::Channel_Volume, 14},
  {multiplexer.pin(14), MIDI_CC::Channel_Volume, 15},
  {multiplexer.pin(15), MIDI_CC::Channel_Volume, 16},
};


HystFilter hystFilters[16];

const size_t nb_pots = sizeof(potentiometers) / sizeof(potentiometers[0]);
const size_t nb_hyst = sizeof(hystFilters) / sizeof(hystFilters[0]);
static_assert(nb_pots == nb_hyst, "Error: number of Analog potentiometers should be the same as the number of HystFilters");

void setup() {
  for (size_t i = 0; i < nb_pots; i++)
    potentiometers[i].map([i](int raw){ return (int) hystFilters[i].getOutputLevel(raw); });
}

void loop() {
  // Refresh the MIDI controller (check whether the potentiometer's input has changed since last time, if so, send the new value over MIDI)
  MIDI_Controller.refresh();
}

PieterP:
If you don't understand the [nobbc]potentiometers[i].map(...)[/nobbc] part, it's a capturing lambda expression (google it).

i search it but i found only java scipts and other strange things

Post exactly what you want to do, and the code you have right now, without the hysteresis.
Posting working code is not really useful. Post the code that doesn't work, as well as the entire error message.

PieterP:
Post exactly what you want to do, and the code you have right now, without the hysteresis.
Posting working code is not really useful. Post the code that doesn't work, as well as the entire error message.

i have try to duplicate the hysteries and the analog inputs and change from A0 to A1 but its not working

its possible to integrate this code with your code ?

#include <MIDI_Controller.h> // Include the library

// Create 2 instances of 'AnalogMultiplex' with the output pins of the multiplexers connected to
// analog input pin A0 and A1 respectively, and the address pins connected to pins 2, 3 and 4.

AnalogMultiplex multiplexers[] = {
  {A0, { 2, 3, 4, 5 } },
  {A1, { 2, 3, 4, 5 } },
  {A2, { 2, 3, 4, 5 } },
  {A3, { 2, 3, 4, 5 } },
  {A4, { 2, 3, 4, 5 } },
  {A5, { 2, 3, 4, 5 } },
  {A6, { 2, 3, 4, 5 } },
  {A7, { 2, 3, 4, 5 } },
  {A8, { 2, 3, 4, 5 } },
  {A9, { 2, 3, 4, 5 } },
  {A10, { 2, 3, 4, 5 } },
};

// Create 16 new instances of the class 'Analog', on the 16 pins of the multiplexers,
// that send MIDI messages with controller 7 (channel volume) on channels 1 - 16
Analog potentiometers[] = {
  {multiplexers[0].pin(0), MIDI_CC::Channel_Volume, 1},
  {multiplexers[0].pin(1), MIDI_CC::Channel_Volume, 2},
  {multiplexers[0].pin(2), MIDI_CC::Channel_Volume, 3},
  {multiplexers[0].pin(3), MIDI_CC::Channel_Volume, 4},
  {multiplexers[0].pin(4), MIDI_CC::Channel_Volume, 5},
  {multiplexers[0].pin(5), MIDI_CC::Channel_Volume, 6},
  {multiplexers[0].pin(6), MIDI_CC::Channel_Volume, 7},
  {multiplexers[0].pin(7), MIDI_CC::Channel_Volume, 8},
  {multiplexers[0].pin(8), MIDI_CC::Channel_Volume, 9},
  {multiplexers[0].pin(9), MIDI_CC::Channel_Volume, 10},
  {multiplexers[0].pin(10), MIDI_CC::Channel_Volume, 11},
  {multiplexers[0].pin(11), MIDI_CC::Channel_Volume, 12},
  {multiplexers[0].pin(12), MIDI_CC::Channel_Volume, 13},
  {multiplexers[0].pin(13), MIDI_CC::Channel_Volume, 14},
  {multiplexers[0].pin(14), MIDI_CC::Channel_Volume, 15},
  {multiplexers[0].pin(15), MIDI_CC::Channel_Volume, 16},

  {multiplexers[1].pin(0), MIDI_CC::General_Purpose_Controller_1, 1},
  {multiplexers[1].pin(1), MIDI_CC::General_Purpose_Controller_1, 2},
  {multiplexers[1].pin(2), MIDI_CC::General_Purpose_Controller_1, 3},
  {multiplexers[1].pin(3), MIDI_CC::General_Purpose_Controller_1, 4},
  {multiplexers[1].pin(4), MIDI_CC::General_Purpose_Controller_1, 5},
  {multiplexers[1].pin(5), MIDI_CC::General_Purpose_Controller_1, 6},
  {multiplexers[1].pin(6), MIDI_CC::General_Purpose_Controller_1, 7},
  {multiplexers[1].pin(7), MIDI_CC::General_Purpose_Controller_1, 8},
  {multiplexers[1].pin(8), MIDI_CC::General_Purpose_Controller_1, 9},
  {multiplexers[1].pin(9), MIDI_CC::General_Purpose_Controller_1, 10},
  {multiplexers[1].pin(10), MIDI_CC::General_Purpose_Controller_1, 11},
  {multiplexers[1].pin(11), MIDI_CC::General_Purpose_Controller_1, 12},
  {multiplexers[1].pin(12), MIDI_CC::General_Purpose_Controller_1, 13},
  {multiplexers[1].pin(13), MIDI_CC::General_Purpose_Controller_1, 14},
  {multiplexers[1].pin(14), MIDI_CC::General_Purpose_Controller_1, 15},
  {multiplexers[1].pin(15), MIDI_CC::General_Purpose_Controller_1, 16},

  {multiplexers[2].pin(0), MIDI_CC::General_Purpose_Controller_2, 1},
  {multiplexers[2].pin(1), MIDI_CC::General_Purpose_Controller_2, 2},
  {multiplexers[2].pin(2), MIDI_CC::General_Purpose_Controller_2, 3},
  {multiplexers[2].pin(3), MIDI_CC::General_Purpose_Controller_2, 4},
  {multiplexers[2].pin(4), MIDI_CC::General_Purpose_Controller_2, 5},
  {multiplexers[2].pin(5), MIDI_CC::General_Purpose_Controller_2, 6},
  {multiplexers[2].pin(6), MIDI_CC::General_Purpose_Controller_2, 7},
  {multiplexers[2].pin(7), MIDI_CC::General_Purpose_Controller_2, 8},
  {multiplexers[2].pin(8), MIDI_CC::General_Purpose_Controller_2, 9},
  {multiplexers[2].pin(9), MIDI_CC::General_Purpose_Controller_2, 10},
  {multiplexers[2].pin(10), MIDI_CC::General_Purpose_Controller_2, 11},
  {multiplexers[2].pin(11), MIDI_CC::General_Purpose_Controller_2, 12},
  {multiplexers[2].pin(12), MIDI_CC::General_Purpose_Controller_2, 13},
  {multiplexers[2].pin(13), MIDI_CC::General_Purpose_Controller_2, 14},
  {multiplexers[2].pin(14), MIDI_CC::General_Purpose_Controller_2, 15},
  {multiplexers[2].pin(15), MIDI_CC::General_Purpose_Controller_2, 16},

  {multiplexers[3].pin(0), MIDI_CC::General_Purpose_Controller_3, 1},
  {multiplexers[3].pin(1), MIDI_CC::General_Purpose_Controller_3, 2},
  {multiplexers[3].pin(2), MIDI_CC::General_Purpose_Controller_3, 3},
  {multiplexers[3].pin(3), MIDI_CC::General_Purpose_Controller_3, 4},
  {multiplexers[3].pin(4), MIDI_CC::General_Purpose_Controller_3, 5},
  {multiplexers[3].pin(5), MIDI_CC::General_Purpose_Controller_3, 6},
  {multiplexers[3].pin(6), MIDI_CC::General_Purpose_Controller_3, 7},
  {multiplexers[3].pin(7), MIDI_CC::General_Purpose_Controller_3, 8},
  {multiplexers[3].pin(8), MIDI_CC::General_Purpose_Controller_3, 9},
  {multiplexers[3].pin(9), MIDI_CC::General_Purpose_Controller_3, 10},
  {multiplexers[3].pin(10), MIDI_CC::General_Purpose_Controller_3, 11},
  {multiplexers[3].pin(11), MIDI_CC::General_Purpose_Controller_3, 12},
  {multiplexers[3].pin(12), MIDI_CC::General_Purpose_Controller_3, 13},
  {multiplexers[3].pin(13), MIDI_CC::General_Purpose_Controller_3, 14},
  {multiplexers[3].pin(14), MIDI_CC::General_Purpose_Controller_3, 15},
  {multiplexers[3].pin(15), MIDI_CC::General_Purpose_Controller_3, 16},

  {multiplexers[4].pin(0), MIDI_CC::General_Purpose_Controller_4, 1},
  {multiplexers[4].pin(1), MIDI_CC::General_Purpose_Controller_4, 2},
  {multiplexers[4].pin(2), MIDI_CC::General_Purpose_Controller_4, 3},
  {multiplexers[4].pin(3), MIDI_CC::General_Purpose_Controller_4, 4},
  {multiplexers[4].pin(4), MIDI_CC::General_Purpose_Controller_4, 5},
  {multiplexers[4].pin(5), MIDI_CC::General_Purpose_Controller_4, 6},
  {multiplexers[4].pin(6), MIDI_CC::General_Purpose_Controller_4, 7},
  {multiplexers[4].pin(7), MIDI_CC::General_Purpose_Controller_4, 8},
  {multiplexers[4].pin(8), MIDI_CC::General_Purpose_Controller_4, 9},
  {multiplexers[4].pin(9), MIDI_CC::General_Purpose_Controller_4, 10},
  {multiplexers[4].pin(10), MIDI_CC::General_Purpose_Controller_4, 11},
  {multiplexers[4].pin(11), MIDI_CC::General_Purpose_Controller_4, 12},
  {multiplexers[4].pin(12), MIDI_CC::General_Purpose_Controller_4, 13},
  {multiplexers[4].pin(13), MIDI_CC::General_Purpose_Controller_4, 14},
  {multiplexers[4].pin(14), MIDI_CC::General_Purpose_Controller_4, 15},
  {multiplexers[4].pin(15), MIDI_CC::General_Purpose_Controller_4, 16},

 
 

}

void loop() {
  // Refresh the MIDI controller (check whether the potentiometer's input has changed since last time, if so, send the new value over MIDI)
  MIDI_Controller.refresh();
 
 
};

void setup() {}

void loop() {
  // Refresh the MIDI controller (check whether the potentiometer's input has changed since last time, if so, send the new value over MIDI)
  MIDI_Controller.refresh();
}

i need this filter on all multiplexers (potentiometers) and im realy don't know how to do it ,

i delete the code that i try because it makes me nervous reading full of red errors :frowning: :confused:

thanks peter for the support

ciabio:
so i google it but i don't know where to put this function : Analog::map(std::function<int(int)>)

You don't have to write it anywhere. Analog::map is the map method of the Analog class, and std::function is a function data type from the "functional" standard library. <int(int)> just means that it's a function that takes one integer parameter, and returns an integer. (std::function is a template class, that's why it uses <>.)

ciabio:
i search it but i found only java scipts and other strange things

http://en.cppreference.com/w/cpp/language/lambda

Lambda expressions (since C++11)
Constructs a closure: an unnamed function object capable of capturing variables in scope.

I'll push the changes to the library tonight or tomorrow.

Done: Add hysteresis to AnalogCC · tttapa/MIDI_controller@5671c0e · GitHub

Thanks a lot for the help!
There's still a problem with 10-bit analog MIDI events, where hysteresis would not be useful, but that's not really a priority, 7-bit is more than enough.

ciabio:
AnalogMultiplex multiplexers[] = {
{A0, { 2, 3, 4, 5 } },
{A1, { 2, 3, 4, 5 } },
{A2, { 2, 3, 4, 5 } },
{A3, { 2, 3, 4, 5 } },
{A4, { 2, 3, 4, 5 } },
{A5, { 2, 3, 4, 5 } },
{A6, { 2, 3, 4, 5 } },
{A7, { 2, 3, 4, 5 } },
{A8, { 2, 3, 4, 5 } },
{A9, { 2, 3, 4, 5 } },
{A10, { 2, 3, 4, 5 } },
};

...snip.....

i need this filter on all multiplexers (potentiometers) and im realy don't know how to do it ,

Okay you only need to filter the pins and know what pot # (mux addr/index) the data is for.

You have how many buttons times how much RAM to filter each? A pin number and 4 other args? Add mux channel?

PieterP:
Done: Add hysteresis to AnalogCC · tttapa/MIDI_controller@5671c0e · GitHub

Thanks a lot for the help!
There's still a problem with 10-bit analog MIDI events, where hysteresis would not be useful, but that's not really a priority, 7-bit is more than enough.

I do not know how to thank you...

can i copy this with git in the library like the other one?

thanks

ciabio:
can i copy this with git in the library like the other one?

In ~/Arduino/libraries/MIDI_Controller, run:

git checkout master && git pull

PieterP:
In ~/Arduino/libraries/MIDI_Controller, run:

git checkout master && git pull

thanks

should i use your code (Pot-map-hystFilter-custom) or can i use the code that i post on the bottom ?

i try to understand but in which tab of EMA.hpp,Hysteresis.cpp ecc... should inserit the std::function<int(int)>) and routing the multiplexer...

in the arduino software i have open all the tabs....

if you have time and if you want, can you show me an example to integrate all the multiplexer with the filters...so that i can copy the code its easier for me to understand

thank you... if the project finish all credit goes on you

thanks

The hysteresis filter is now integrated in all Analog objects, so you don't have to use Analog::map. Just use your normal code (not the one with the lambda expressions), and it should work.

PieterP:
The hysteresis filter is now integrated in all Analog objects, so you don't have to use Analog::map. Just use your normal code (not the one with the lambda expressions), and it should work.

yuhuuuu...

thanks realy :slight_smile:

i dont know if i should open a new post... but i want to ask you... how can i make that the pots that i use for the Pan are in the center... the potentiometer is in the center on ableton on 120 degrades and i want that the pot is on 90 degrades

THANK YOUUU

Your potentiometers are probably logarithmic ones (Audio). MIDI controllers use linear potentiometers, for obvious reasons.

You can do the correction in software, using Analog::map(int(*fn)(int)), you just need two linear approximations of the log taper, as shown in the image above, to reverse the effect. Take a look at the map example: MIDI_controller/Ex.08.Potentiometer-Calibrate.ino at master · tttapa/MIDI_controller · GitHub

I have no idea what kind impact this will have on the noise, though.

PieterP:
Your potentiometers are probably logarithmic ones (Audio). MIDI controllers use linear potentiometers, for obvious reasons.

You can do the correction in software, using Analog::map(int(*fn)(int)), you just need two linear approximations of the log taper, as shown in the image above, to reverse the effect. Take a look at the map example: MIDI_controller/examples/Ex.08.Potentiometer-Calibrate/Ex.08.Potentiometer-Calibrate.ino at master · tttapa/MIDI_controller · GitHub

I have no idea what kind impact this will have on the noise, though.

thanks there are linear pots,,

so the potentiometer are going but if i add the fader its say to me :

warning: array subscript is above array bounds

thanks

Again, I can't help you if you don't post your exact code and complete error messages.

PieterP:
Again, I can't help you if you don't post your exact code and complete error messages.

after putting the code that you sent me,

the potentiometers worked .. I wanted to connect the slider pot too.
but there is a problem .. when I attack one it works with two also .. when i attack the third no longer goes and if I move the first one also moves the third .. I tried everything, I also remade the connections and tested individually slider ... I do not know how to move on

thanks

PieterP:
Again, I can't help you if you don't post your exact code and complete error messages.