How to analogRead() 2 separate pins simultanously?
This is not a full code but more of an explanation of the logic of your program.


  when the flex sensor is triggered, a sound is played on the piezzo buzzer. The tone it makes is dependent the values received from the proximity sensor.


Follow this logic and try to code it:

1- read the flex sensor values

int val = analogRead(flexPin);


2- if it is triggered, THEN read the proximity sensor.

if(val &gt; minimum) {
  int distance = analogRead(proximityPin); //this line depends on which proximity sensor you are using


3- play the sound accordingly to the proximity sensor (still in the if loop).

analogWrite(distance);


This logic should work fine. If you could include more info like board, flex sensor and proximity sensor, that could help.