My toilet had what sounds like the same problem, a loud whining noise when filling up after flushing.
The solution was to replace the ball valve diaphragm which had become worn out.
As this is very...