A Multi-Output Device in Audio MIDI Setup can send playback to multiple devices together. It is useful for a deliberate shared listening setup, but it is not a per-app mixer.
Create a small test setup
Open Audio MIDI Setup and show the Audio Devices window. Use the add button to create a Multi-Output Device, select the intended member devices and choose the primary device.
Name it clearly and select it as output for your test. Begin at low levels, especially if one of the devices is a room speaker. Verify both destinations before playing anything private.
Understand the trade-offs
Different devices can have different delays and volume controls. Hearing the same sound from headphones and speakers can feel like an echo. Wireless and wired outputs may not stay perceptually aligned for short typing sounds.
This setup duplicates a playback path; it does not automatically send one app to headphones and another to speakers. Applications with their own output selector can make independent choices.
A simpler TapNoise case
If your only goal is music in headphones and typing audio on the laptop, TapNoise’s Use MacBook speakers option is more direct. It does not require creating a combined output device.
Return to your normal output when testing ends. Remove a custom Multi-Output Device only when you no longer need it, and check output routing if later playback unexpectedly goes to both places.
Source: Apple: play through multiple devices, TapNoise speaker routing.
TapNoise