I was trying to customize my org-clock-sound
with a file I took from Wikimedia Commons (here is the file). I know that Emacs can only play, natively, .wav
and .au
files. But apparently, my file is recognized as an "x-wav" file, as I see from my file manager: "Type: WAV audio (audio/x-wav)". When I inspect it with file
, I get:
Bicycle-bell-1.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 24 bit, stereo 44100 Hz
Unsurprisingly, when I try to set the variable:
(setq org-clock-sound "/home/alessandro/.emacs.d/Bicycle-bell-1.wav")
and the bell is triggered, I get the standard "bip", as if org-clock-sound
was set to t
.
So, it seems Emacs cannot recognize it.
I have found a workaround solution:
I tried using an online converter to produce an .au
file, and it works!. Inspecting with the file manager gives "Type: ULAW (Sun) audio (audio/basic)", and with file
:
Bicycle-bell-1.au: Sun/NeXT audio data: 16-bit linear PCM, stereo, 44100 Hz
However, I've already written this question, so for the sake of bug-solving, my questions are:
- Can I play the x-wav file on Emacs?
- Is there a way I can convert it in
.wav
? Is themailcap.el
library useful in some way?
Thanks for your time!
Some additional information that may be useful:
- Calling the function
(play-sound "~/.emacs.d/Bicycle-bell-1.wav")
gives the error
Debugger entered--Lisp error: (error "Invalid sound specification")
play-sound-internal("~/.emacs.d/Bicycle-bell-1.wav")
play-sound("~/.emacs.d/Bicycle-bell-1.wav")
(progn (play-sound "~/.emacs.d/Bicycle-bell-1.wav"))
eval((progn (play-sound "~/.emacs.d/Bicycle-bell-1.wav")) t)
- Calling the function
(play-sound-file "~/.emacs.d/Bicycle-bell-1.wav")
gives the error
Debugger entered--Lisp error: (error "Unsupported WAV file format")
play-sound-internal((sound :file "~/.emacs.d/Bicycle-bell-1.wav"))
play-sound((sound :file "~/.emacs.d/Bicycle-bell-1.wav"))
play-sound-file("~/.emacs.d/Bicycle-bell-1.wav")
(progn (play-sound-file "~/.emacs.d/Bicycle-bell-1.wav"))
Bicycle-bell-1.wav
file is 24-bit and even if your emacs is built with the alsa libraries, they don't seem able to play 24-bit WAV files. You can convert it to 16-bit withffmpeg
and try again. See the edit in my answer.