Basic question about FSRs

Two years ago I had a MIDI instrument project that was meant to have an FSR input but I got so frustrated that I ended up just using a momentary button instead.

I am back in the electronics game again and want to rebuild this project correctly, but embarrassingly enough am flummoxed by the same problem.

All I need to do is use an FSR to control a MIDI volume message. Everything I have tried creates a problem wherein the FSR is read over and over again while the FSR is being pressed creating a staccato burst of noteOn messages. What I want is one note to be played once when I press the FSR, and for it the volume of it to smoothly vary according to the amount of pressure I apply to the FSR.

Can anyone point me in the right direction?

Try something like this? (untested)

const uint8_t FSRPIN; // pin that the FSR is connected to
const uint16_t THRESHOLD; // threshold for starting a note
const uint16_t DEBOUNCE_THRESHOLD; // threshold for changing volume
const uint16_t NOISE_THRESHOLD; // threshold for no-touch noise

uint16_t pVal;

void setVolume(uint8_t vol); // 8-bit volume setting
void noteOn(uint16_t freq); // 16-bit frequency in Hz
void noteOff();

bool FSRIsOn;

void loop() {
    uint16_t val = analogRead(FSRPIN);
    if ( ! FSRIsOn && ( val > THRESHOLD ) ) {
        noteOn( 440 ); // play an A4
        setVolume( val >> 2 ); // right-shift 2 to convert 10bit (0-1024) to 8bit (0-255)
        FSRIsOn = true;
    } else if ( FSRIsOn && abs(pVal - val) > 8 ) {
        setVolume( val >> 2 );
    } else if ( abs( pVal - val ) < NOISE_THRESHOLD && pVal < THRESHOLD && val < THRESHOLD ) {
        FSRIsOn = false;
        noteOff();
    }
}

Replace the function prototypes with equivalent methods from your existing code.