Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 15 of 15

Thread: Ribbon Midi guidance

  1. #1
    Banned
    Join Date
    May 2018
    Posts
    16

    Ribbon Midi guidance

    I had done simple midi ribbon controller and I need to do something with reading values from soft pot strip. I have problem with linearity or simple said “note placement on ribbon”
    Ribbon potentiometer is 500mm long and have 20k resistance.
    analogRead mapping is 0-1023 on A3 input.
    I can play 2 octaves from C2 to C4 on ribbon.
    Notes placement is really problematic, because distance between notes is not equal. By this, ribbon is not really playable.
    For example on beginning ribbon, first 100mm placement notes is stretched and next to next ones, distance between notes is smaller and smaller. Firsts notes have 20mm per note space on ribbon and next ones 15mm and 10mm and so on.
    I need get proper equal placement of notes on ribbon. Ribbon has 500mm, and 25 notes can be played. I need to get 20mm per note. 500/25=20 or even 500/25=20 - 1
    -1 for space 1mm between notes.
    How I can do it? Any specific functions can be useful for that?

    int positionSensorPin = A3
    int positionSensor;
    int ribbon;
    positionSensor = analogRead(positionSensorPin);
    ribbon = map(positionSensor,0,1023,0,127);
    //need function for note equal placement

  2. #2
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,459
    First of all: These soft pot ribbons have basically very good linearity, so I suspect that you did not connect it in an ideal way. The ribbon pot has 3 connectors. Let's call them A,B, and C. A must be connected to GND, C must be connected to +3.3V, and the middle pin (B) goes to the analog input of the Teensy . No other resistors should be connected to that, but a 10nF capacitor is needed between the analog input pin of the Teensy and GND (thus in parallel to A and B of the ribbon) to make the readings more stable. With that, you'll get already the full range of 128 midi notes equally spaced on the ribbon.

    To limit the pitch range to 2 octaves which makes 25 notes only, you'll have to modify your map function afterwards:
    Code:
    const int lowestNote = 24; // This is midi note C2 if i remember correctly, chose any value at your convenience
    const int octaves = 2; // You might vary the range if needed, having 3 octaves with equal note spacing is also well playable on 500mm
    ribbon = map(positionSensor, 0, 1023, lowestNote, lowestNote + (octaves * 12));
    ...and you are done!

    I case you find the direction of notes reversed, it's enough to swap pins A and C of the ribbon. The 10nF capacitor remains between B and GND.

  3. #3
    Banned
    Join Date
    May 2018
    Posts
    16
    Hi Theremingenieur
    Thank you for suggestions.
    I will try your code, I have done some coding, I put it here when I get my laptop.
    About connection ribbon, I had done almost in the same way what you described + 10k resistor between viper and ground coz was too much floating noises even with 100n caps. Without resistor all notes are on equal positions and ribbon is very playable but noisy when not touching. I need do something with noise.

  4. #4
    Junior Member
    Join Date
    Jun 2017
    Posts
    13
    I ran into the same problem with my midi guitar controller. Long story short, you can't fix the linearity problem while pulling the wiper pin down.

    See http://blog.qqrs.us/blog/2013/04/22/...sor-to-an-adc/ for a good explanation.

    A couple of options.

    1. Mechanically keep the wiper connected with a plastic pin (see the Spectra symbol datasheet for an example) or similar. This prevents the wiper from floating, making it a normal pot.

    2. Laminate the softpot on top of an FSR, and use that to detect force. That way you can ignore the floating wiper until an FSR threshold has been reached. Advantage, you get velocity dynamics as well! Interlink has some that are 500mm long.

    I ended up doing neither for my project because the non linearity actually fits well to the fret spacing of a guitar.

    Good luck!

  5. #5
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,138
    Quote Originally Posted by recursinging View Post
    ...

    I ended up doing neither for my project because the non linearity actually fits well to the fret spacing of a guitar.

    ....
    I'd love to see what that means... have you published the project anywhere?

  6. #6
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,459
    The proof that it can be done in the video below. That’s an electronic cello which I developed in 2013. It has even a 1000mm soft pot and 5 octaves with linear tone spacing. As you can hear, that linearity was rather difficult to handle for Marieke, a professional Dutch cellist, since she is naturally used to the non linear tone spacing of the acoustic cello.

    https://youtu.be/1ugZ1-oy_MI

  7. #7
    Senior Member
    Join Date
    Dec 2016
    Posts
    101
    Hi

    If I look at the soft pod on adafruit (https://www.adafruit.com/product/178) I see that those need a 10K resistor between Vcc and the ribbon and another one between the ribbon and ground.

  8. #8
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,459
    It’s not that a soft pot generally needs this or that. It’s all about careful circuit design to obtain the desired result I an specific use case. But as long as Kirazvora does not publish fully elaborated schematics, one can‘t help him, since we don‘t know what he did in supply voltage filtering and signal buffering.

  9. #9
    Junior Member
    Join Date
    Jun 2017
    Posts
    13
    Quote Originally Posted by Theremingenieur View Post
    It’s not that a soft pot generally needs this or that. It’s all about careful circuit design to obtain the desired result I an specific use case.

    Could you please elaborate? I'd be interested in what measures you took to stabilize the voltage on the floating wiper. Do you have a schematic available?


    Quote Originally Posted by oddson View Post
    I'd love to see what that means... have you published the project anywhere?
    I didn't really document the build, but it's basically a hollowed out e-guitar and neck with the frets removed. I managed to fit four 500mm soft pots on the neck, four 50x50mm FSR pads, four faders, four led buttons and a mini joystick on the body, a little SSD1306 display on the side, powered by a Teensy 3.6. Additionally, (it's own monster of a project) I have a headstock module with 4 RGB rotary encoders, an accelerometer, powered by a Teensy LC which communicates via i˛c through the neck to the body module.

    The code is here: https://github.com/recursinging/ruitar - but fair warning, it's a mess as I'm trying to turn it into a synth with Paul's awesome audio library. Unfortunately being a Java programmer hinders rather than helps when making the mental switch to embedded C++! It's fun, but difficult to play. I'll admit though, I'm more of a tinkerer than a musician.

  10. #10
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,459
    In my design I didn't have a floating wiper. I fed the ribbon from an adjustable constant current source and thus the wiper and one end of the pot were grounded (see schematic below) which already minimized all noise problems. But then, I still found that coming close to the ribbon with my fingers would still induce some buzz (similar to touching the hot pin of an audio input), so I took self glueing 10mm copper tape and glued one stripe on each side next to the ribbon and connected these to ground, which then gave a perfect control voltage. The latter was then even not used by a MCU (I was still fully analog in 2013), but went through an exponential voltage to current converter into a triangle wave oscillator built around a LM13700 OTA. This exponential conversion made the circuit still more sensitive to CV noise, so the fact that it worked well finally means that it will also work well with a linear ADC.

    Since the fine tuning is not forcibly needed when processing the pitch CV digitally, that 2k2 pot can be omitted and the current somewhat lowered with the 10k pot to adjust the output voltage range. I highly recommend a 10 turn trimmer potentiometer for easy and precise adjustment of the pitch CV range.

    That circuit works "reversed" which means that it will produce by default the highest possible tone when the ribbon is not touched. In my analog oscillator, the voltage to current converter was inverting, so that I got the lowest note (like an empty string on a cello) at the end.

    When processing that digitally, it's easy to revert in the map function:
    Code:
        note = map(cv, 1023, 0, lowestNote, lowestNote + (octaves * 12)); //reversed mapping
        if(note != previous_note) { //something has changed???
            sendNoteOff(previous_note);
            sendNoteOn(note);
            previous_note = note
        }
    Afterwards, if you don't want any sound when the ribbon is not touched, just drop the highest values:
    Code:
    if(cv < 1020) {
        // place the above code here
    } else {
        sendNoteOff(previous_note);
    }
    Click image for larger version. 

Name:	IMG_0265.jpg 
Views:	43 
Size:	57.0 KB 
ID:	14116

  11. #11
    Junior Member
    Join Date
    Jun 2017
    Posts
    13
    Very, very cool. If I understand correctly, the 2N3819 would also work with with a 3.3v or 5v supply, but a rail-to-rail alternative to the TL-072 would be needed. Only a little bit more complicated than the voltage divider.

    Thanks for sharing!

  12. #12
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,459
    The 2N3819 FET (or every other NJFET as constant current source) needs at least 6V above the max pitch CV to work stable (Ugs ~ -3V, Uds ~ 3V). With a max pitch CV of 5V you really can't get away below 11V, sorry.

    Using a FET with a smaller pinch off voltage like the now obsolete 2N5484 allows you to drop that headroom to about 3V. One might imagine a more complex circuit with a current mirror to reduce that to about 0.5V, but that risks to introduce more temperature drift.

    Having done lots of modular synth stuff in that time, it was self understanding to have always a +5V,+/-12V power supply at hands...
    Last edited by Theremingenieur; 06-29-2018 at 01:18 PM.

  13. #13
    Junior Member
    Join Date
    Jun 2017
    Posts
    13
    Yeah, just realized that myself as well:

    Click image for larger version. 

Name:	Screenshot from 2018-06-29 15-26-50.png 
Views:	49 
Size:	51.7 KB 
ID:	14117

  14. #14
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,459
    Either LT-Spice's default parameters for the 2N3819 are atrociously wrong or I have a wrong memory. But with what I see in your graph, the 10k potentiometer for adjusting the ribbon current might be a little small... In that case I'd replace the 10k by a 22k 10-turn pot to allow to reduce the current for safe and stable 0 - 3.3V pitch cv.

  15. #15
    If this problem still persists I had recommended a correction curve in software including stretching to overcoming the zero and maxlimit issue like this:
    http://www.96khz.org/htm/midicontroller16.htm
    (image at bottom of the page)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •