The police may attend at incidents such as this and can ask the organisers to turn the music down. The police also have powers to prosecute for noise nuisance in terms of Civic Government Scotland Act 1982 section 54 for persisting, to the annoyance of others, in playing musical instruments, singing, playing radios etc. on being required to stop.
Local authorities also have powers under the Antisocial Behaviour Scotland Act 2004 to deal with noise nuisance. Persistent offenders can be given a warning notice and if they fail to comply with that notice they will commit an offence. If you suffer from a persistently noisy neighbour you should report this to your local authority