This is the traditional bugle call known as Retreat or Sunset. Although the name might suggest it is used to order a "retreat", it is actually used by UK and other forces to accompany the lowering of the flag. It is also frequently played at the end of ceremonial occasions, for example it is regularly played towards the end of the Edinburgh Military Tatoo which takes place beside Edinburgh Castle as part of the Edinburgh International Festival. For other flag-related bugle calls, see the one known as To The Colours which is associated in the US with loyalty to the flag. See the links at the left to download the sheet music or audio files. More bugle calls are listed in our article about the history and cultural impact of Bugle Calls
The image below is the first page of the sheet music, and here you can download the full sheet music for Retreat (bugle call) in PDF format.