The boatswain's whistle (pronounced bosun's whistle) is a small whistle that was used aboard old sailing ships since the 15th century, usually to gain the attention of the crew, and was still used on starships up to the 24th century.
Constitution-class starships in the 23rd century used the sound of a boatswain's whistle to open shipboard communications via the ship's intercom. (Star Trek: The Original Series; ENT: "In a Mirror, Darkly, Part II")
Aboard starships into the 24th century, it was normally used when an honorary guest came aboard or at a crewmember's funeral, when their body was released into space. The shrill whistle was often played before a ship-wide or open frequency communication, usually made by the captain or another senior officer. (TNG: "Where No One Has Gone Before", "Hide and Q") The actual tone of the call has varied, as some captains preferred the distinctive notes of the electronic type over the more traditional metal whistle. (TNG: "Lower Decks")
In 2373, Captain Janeway hallucinated her own death and funeral aboard the USS Voyager when a non-corporeal being tried to convince her she was dead, at which Crewman William McKenzie blew the whistle during her memorial. (VOY: "Coda")
In 2375, Nog blew the boatswain's whistle, at the wedding of Kasidy Yates and Benjamin Sisko, right before Kasidy entered the wardroom. Odo complimented him on his playing, despite Nog only having had twenty minutes to learn it. (DS9: "'Til Death Do Us Part")