I'm replacing a wall sconce light with a bluetooth speaker so I have AC wires coming into the spot where the speaker will be but I'll be removing the circular gang box that the sconce light connected to. The bluetooth speaker has a DC adapter that I can wire to the existing AC wires. But do I need to add a new covered gang box for the adapter to live in or can it just dangle behind the wall?
In general, AC 120 and 240 wiring may not be terminated in a wall except in approved boxes or fixtures. And those boxes must be accessible. You cannot splice wires in a wall without boxes (except for certain approved in-line splices), and you cannot bury a box in a wall without an accessible cover.
That means you need to attach the DC adapter (basically a transformer) to an approved electrical box. This is usually done with the transformer bolted to the outside of the box with the wires from AC side of the box feeding inside, where they are attached to the line in. And this box must remain accessible, with a cover that can be removed to get to the wiring.
If this is not aesthetically pleasing, you may be able to locate the DC adapter somewhere else (in a basement or an attic) with an appropriate box, and then run low voltage wires to your speaker.
If this is a plug in adapter, you need to attach it to a conventional outlet in a conventional box, not buried in a wall.