Newbe question

Using pins 0 and 1 is generally not recommended, as that interferes with uploading sketches. In addition, those pins have extra resistors that also interfere with some functions that you might want the pins to do.

but I notice that the switching of the leds is going awkwardly slow, I can’t seem to find the error…

 Serial.begin(31250);       // MIDI speed

This isn’t going to work if you are using pins 0 and 1 as part of your portArray.

  for(int i=0; i<16; i++){
    pinMode(portArray[i], OUTPUT);
    digitalWrite(portArray[i], HIGH);
  }

You only have 13 pins define in portArray, not 16.

I had no idea that pin 0 and 1 were used for that. Is there any other way for me then to translate the incoming signal to an X&Y value in MIDI? Or did I completely block out any form of communication between the arduino and computer?

Pins 0 and 1 can be used for general I/O OR for serial communication, but you can't do both at the same time.

If you must use 0 and 1 for general I/O, then you need to use another pair, and NewSoftSerial to communicate with the computer. Of course, this means that you can't use the standard USB cable.

With the need for 16 I/O pins, plus serial communication, plus some sensor(s), it doesn't seem like you have enough pins.

int inputPin = A4;
  if(analogRead(inputPin) == HIGH){

A4's value is that needed to address an analog pin as a digital pin. You don't use analogRead to read a digital pin, and you don't get HIGH or LOW from an analog pin (at least not usually).

Sounds like my project is crashing down. Is there any method that can quickly overcome these problems?

I need those 16 components and I need the serial communication.

Is there any method that can quickly overcome these problems?

Depends how quickly you can get a Mega. It has more than enough I/O pins AND 4 hardware serial ports.

I can't seem to be able to get the Mega within time, but isn't it possible to use anologue pins as digital ports? I

Analog Input Pins

A description of the analog input pins on an Arduino chip (Atmega8, Atmega168, Atmega328, or Atmega1280).

A/D converter

The Atmega controllers used for the Arduino contain an onboard 6 channel analog-to-digital (A/D) converter. The converter has 10 bit resolution, returning integers from 0 to 1023. While the main function of the analog pins for most Arduino users is to read analog sensors, the analog pins also have all the functionality of general purpose input/output (GPIO) pins (the same as digital pins 0 - 13).

Consequently, if a user needs more general purpose input output pins, and all the analog pins are not in use, the analog pins may be used for GPIO.

Yes, you can use the analog pins as digital I/O pins. There are 14 digital pins and 6 analog pins, for a total of 20 pins. You can use 0 and 1, because you are using them for serial communications. That still leaves 18 pins. You have 1 input pin defined, leaving 17 pins that can be used as output, as long as there are not more inputs required.