Ok so a few months back I finally achieved reading a midi signal on an atmega328p controller using software serial BUT there was a caveat - the standard midi baud rate is 31270 but i could not get this to work on a controller with an external 16mhz ctystal. Later on I managed to get this to work by thinking "Ok, the controller was running on 8hmz clock speed and I switched to a 16mhz external so the speed has doubled." This was hinted by the fact that the delay(1000) was only delaying for half a second instead of a full. So I halved the baud rate for software serial and voila, it started working.
So this got me thinking. Does the baud rate of serial directly depend on the speed of the processor? Or is this just Software serial library? I've read a post here that said the arduino software is smart and keeps these values proportionally scaled to the selected clock speeds.
Mainly I am now doing a project that uses an Attiny85 instead of an atmega328. It runs on a 1mhz internal clock speed. If I were to follow the same logic, I'd have to now, instead of setting half the default speed, multiply it by 16.
Or if I wanted to add an external crystal on this one too, I'd have to sacrifice 2 I/O pins (on a controller with all of 5 i/o pins in total while the atmega328 had dedicated crystal pins)
I get a rare occasional signal of incoming midi into the controller as indicated by an led flashing and this circuit was used on a few successful projects in the past so I know that works. Only thing is that I don't know if Software serial could handle such baud rates as 31250 (default) multiplied by 16... it certainly is not listed in its preferences.
Well I've just got this thing to run on the 16mhz crystal and read the data correctly so now I have this option to fall back to but this way I do lose the 2 i/o pins that a needed for the crystal in the attiny85.
What you mentioned in terms of settings :
The problem you describe in your first paragraph is very likely because F_CPU was the wrong value.
The baud rate mismatch was due on my last project that used the atmega328 so although I found an uneducated workaround, I than you for pointing the solution. I just found this setting in the boards.txt file for the 328 and yes it was indeed set to 8mhz instead of the 16 one. I guess that is the value that the Arduino IDE uses to match the baud rates and delay functions and so on. Thank you