Add a classic Doom II–style intro soundtrack that plays once when Doom Emacs starts — clean, simple, and without exit prompts.
This setup works for:
- GUI Emacs
- Terminal (
-nw)
Audio playback is handled by SoX (play), which is lightweight and reliable.
- Doom Emacs
- SoX (for the
playcommand)
On NixOS:
environment.systemPackages = with pkgs; [
sox
];On Debian/Ubuntu:
sudo apt install soxOn Arch:
sudo pacman -S soxDownload the Doom II intro soundtrack and place it in your Doom config directory:
mkdir -p ~/.config/doom
curl -o ~/.config/doom/doom.mp3 https://mega.nz/file/k5BVjAiI#6au0-FqbukiHAYxeHfRoNVh3IfI2fnxDEh_-l4EpYJsEdit your Doom Emacs configuration file:
~/.config/doom/config.elAdd the following code anywhere in the file:
;; Soundtrack
;; ==========
;; Holds the SoX `play` process for the Doom startup track
(defvar doom-startup-music-process nil
"Doom startup music process.")
(defun doom-play-startup-music ()
"Play the Doom startup track once per Emacs session."
(unless (process-live-p doom-startup-music-process)
(when (file-exists-p "~/.config/doom/doom.mp3")
(setq doom-startup-music-process
(start-process
"doom-startup-music" nil
"play" "-q" "~/.config/doom/doom.mp3"))
;; Never prompt about this process when exiting Emacs
(set-process-query-on-exit-flag doom-startup-music-process nil))))
(defun doom-stop-startup-music ()
"Stop the Doom startup music if it's still running."
(when (process-live-p doom-startup-music-process)
(ignore-errors (kill-process doom-startup-music-process))
(setq doom-startup-music-process nil)))
;; Play once when Emacs finishes starting (works for GUI and -nw)
(add-hook 'emacs-startup-hook #'doom-play-startup-music)
;; Always stop cleanly on exit (no prompts)
(add-hook 'kill-emacs-hook #'doom-stop-startup-music)After saving the file, run:
~/.emacs.d/bin/doom syncThen restart Emacs.
- ✅ Plays once per Emacs session
- ✅ No prompts when exiting Emacs
- ✅ Works in GUI and terminal (
-nw) - 🔇 Automatically stops on exit