Skip to content

Instantly share code, notes, and snippets.

@felipelalli
Created December 23, 2025 07:03
Show Gist options
  • Select an option

  • Save felipelalli/aaa0d673f33aa6c6c767d8a3648feba8 to your computer and use it in GitHub Desktop.

Select an option

Save felipelalli/aaa0d673f33aa6c6c767d8a3648feba8 to your computer and use it in GitHub Desktop.
Doom Emacs Startup Soundtrack (Doom II Style)

🎵 Doom Emacs Startup Soundtrack (Doom II Style)

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.


Requirements

  • Doom Emacs
  • SoX (for the play command)

Install SoX

On NixOS:

environment.systemPackages = with pkgs; [
  sox
];

On Debian/Ubuntu:

sudo apt install sox

On Arch:

sudo pacman -S sox

1. Download the soundtrack

Download 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_-l4EpYJs

2. Add the code to Doom Emacs

Edit your Doom Emacs configuration file:

~/.config/doom/config.el

Add 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)

3. Sync Doom Emacs

After saving the file, run:

~/.emacs.d/bin/doom sync

Then restart Emacs.


Behavior

  • ✅ Plays once per Emacs session
  • ✅ No prompts when exiting Emacs
  • ✅ Works in GUI and terminal (-nw)
  • 🔇 Automatically stops on exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment