Inspired by this question about a homebrew spell, I was wondering if there are any official spells or abilities which cause either a target creature or creatures within an area to involuntarily make noise, which would help detecting them if they are hidden or invisible. Something like Faerie Fire, but with audible instead of visual detection. The Alarm spell somewhat fulfills this but requires some setup, I am looking for a spell with an instant casting time. Tasha's Hideous Laughter also works but requires you to see the creature before they hide.
Try Stinking Cloud
Each creature that is completely within the cloud at the start of its turn must make a Constitution saving throw against poison. On a failed save, the creature spends its action that turn retching and reeling.
Retching: "make the sound and movement of vomiting."
If your goal is detection...magic mouth
A bit of an XY answer here, but while forcing another creature to make a sound so that you have a chance to hear them is alright, for your stated purposes (detecting creatures that are are hidden or invisible) it might be better to rely on a spell with a better perception than your own, and here magic mouth excels as being cheap, versatile, and permanent.
The trigger of Magic mouth
must be based on visual or audible conditions that occur within 30 feet of the object
but within these limitations, you can consider it to have what Icyfire calls "arbitrarily high perception". That is, if something can be seen or heard, magic mouth will see and hear it.
Thus detecting nearby invisible creatures is easy - just program it to trigger whenever it hears something that it cannot see, 'Unseen source of noise detected.' For the cost of 10gp each you can set as many contingent triggers into your object as you would like, they are permanent (until dispelled), and can be set to repeat their message whenever the trigger occurs - which I would argue is better than an instant spell you get the effects of once per casting.
For example, for 110gp, you can make a wand triggered to eight quadrants around you and at three distances. Something approaches from behind you, and your wand announces 'Unseen source of noise detected behind you...at greater than 20 feet', and then it adjusts in real time as you or the creature moves; 'Unseen source of noise detected to your right rear between 10 and 20 feet from you'.
Hidden creatures are a bit trickier than invisible ones, for the spell cannot 'know' that the creature is trying to Hide. However, as the PHB says "You can't hide from a creature that can see you clearly" and we can assume that the magic mouth can see everything clearly within 30 feet even if you can't. If we assume that you cannot see the creature because they have some kind of cover from your location, the magic mouth can note the discrepancy. As you approach a creature Hidden behind a tapestry, for example, your properly-programmed magic mouth might announce "There is a creature ahead not visible from the vantage point of my holder."
But if you really want the sound...symbol of discord
If what you are really interested in is forcing invisible and Hidden creatures into making noise, Groody's answer of Stinking Cloud is a great suggestion. A more expensive version of this would be the Symbol of Discord, where for 1000gp you can force any creature within 60 feet of the symbol to make a Constitution save each round or 'bicker and argue with other creatures' for a minute, which should give you plenty of opportunity to hear them. One advantage over Stinking Cloud is that you can automatically exclude yourself and your allies from the effects; one disadvantage (aside from the cost) is the one minute casting time. However, if you have access to a portable hole, you may be able to pre-cast it and then draw it forth when needed.