Metalex:
I already did it and read about it, but I still do not understand why I need it and what it is doing in this circuit.
The opto is there to isolate the ground of the input, i.e. separate the ground of your DAW device and the Arduino.
btw the schematic in that instructible has a 10K resistor R1 between pin 5 and 7, I removed it because with it my circuit was not working, I was using a 6N135 opto.
Ground loops will cause horrendous hum, buzzes, and other noises, especially when connected to computerized gear or lighting equipment. The noises are caused by differences in voltage potential from one end of the cable to the other. The remedy, of course, is to run balanced audio lines and to NEVER physically connect the chassis grounds of different pieces of equipment together. MIDI instrument designers understand ground loops. In fact, a major design goal of MIDI, as seen in the electrical specification explanation in the MIDI Specification Document, is to prevent any ground loops that might occur with the MIDI cables. This is done by using a balanced current loop through an opto-isolator and only grounding the MIDI outputs. The MIDI IN connector is not grounded to the receiver's chassis. When done correctly, there are no ground loops and no hum or other noises caused by the MIDI setup.
Metalex:
but I still do not understand why I need it and what it is doing in this circuit.
You can get away without having it in some circumstances, but depending on how the sending device is wired up you can cause a short circuit, smoke and fire without it.
This is because the ground pin of a device is not always at the same absolute voltage level on different devices, so if you want to connect stuff and not worry about blowing things up then you have to have an optoisolator.
what it is doing in this circuit.
The clue is in the name, it is isolating a circuit from the other. How does it do it, well optically, the other part of the name.