Emacs Lisp: Record voice notes within GNU Emacs

Emacs Lisp: Record voice notes within GNU Emacs

Sometimes you have no time to write and maybe you are talking or maybe you simply wish to record a voice note. Maybe you wish to send a voice message to somebody by email. Just use the record-voice-note function and it will invoke the shell command rec from SOX sound tools system package. Yes, you must have it or this will not work. It will record a sound note and open it in Dired. Press q to finish recording the sound.

Recording sound notes is very common on mobile devices. A function to record sound notes shall be available within GNU Emacs too, it helps to record important conversations or simple to prepare the voice message to be sent by email. Tuning these functions is left to the reader. Low quality recording here have been so set for reasons of sending voice notes by email and having smaller files. Tune the rate of recording for better quality if you wish.

(defvar sound-recordings-dir "/home/data1/protected/Media/Sound/Recordings/"
  "This is your sound recording directory. Keep slash on the end")

(defvar sound-recording-extension ".ogg"
  "This is your sound file extension")

(defun record-voice-note ()
  "This function uses SOX sound tools to record voice notes. The
concept is more important than which tools are used. It starts
recording the sound file within emacs. It can be your sound
note. Once you press `q` it will stop recording, and open up the
directory with sound files"
  (interactive)
  (let* ((filepath (concat sound-recordings-dir (format-time-string "%Y/%m/%Y-%m-%d/")))
     (filename (concat filepath (format-time-string "%Y-%m-%d-%H:%M:%S") sound-recording-extension))
         (command-1 (voice-record-command filename))
     (buffer "*Sound Recording*"))
    (make-directory filepath t)
    (switch-to-buffer buffer)
    (erase-buffer)
    (setq-local header-line-format "➜ Finish recording with 'q'")
    (let* ((process (start-process-shell-command buffer buffer command-1)))
      (local-set-key "q" (lambda () (interactive) (kill-process process nil)
               (local-set-key "q" 'kill-current-buffer)
               (find-file filepath)
               (revert-buffer)))
      (recursive-edit))))

(defun voice-record-command (filename &optional rate channels)
  "Returns sound recording command with default rate and channels"
  (let* ((rate (if rate rate 16000))
     (channels (if channels channels 1))
     (command (format "rec --comment \"Voice of %s: %s\" -r %s -c %s \"%s\"" user-full-name filename rate channels filename)))
    command))

You should be able to quickly record voice notes on every computing device. Today it is quite easy on smart phones to record voice notes. It is trivial to record voice notes straight from Emacs.

Bind the function to a key, and make your voice notes handy for future.

Mail the voice note to your friend. Communicate by voice on long distances even if network is poor for real time conversation.

It is possible to make an Org mode link to sound file, so that you can listen to certain voice notes.

Or make your own podcasting if you wish.

The concept of quick recording voice notes and sending them to friends and family is underused.

So many people write emails, but you can speak by emails. You do not need to write them.

Sending voice notes is great for making new relations. People get surprised when they receive voice mail. It is to quite easy to send voice notes by email.

Writing text is at one level and text may not be diminished by voice or videos.

Sending voice is useful function just like sending videos by email.

The concept is that workflows may be adjusted and aligned so that that better communication takes place.

Imagine pressing a button and choosing person’s name and your computer is recording the voice note, then publishing it to a web server if necessary, with the public or secret URL, and attaching it to the email. Or one without the other. And all that automatically. You are only recording a voice note. Concepts and quick workflows for communication shall be implemented on every computer.

Or pressing a button, choosing person’’s name and recording video. Then relaxing, while your computer converts the video in background, optimizing it for Internet and publishing it to the URL. Email and SMS with the link is then sent to the person with the note that they are receiving a video message.

The workflow concept is what matters.

Is it quick and easy to submit communication? That is what matters.

Majority of the world is not well connectd. They are paying higher prices for Internet and majority do not have computers. But they do have their phones, SMS and emails.

Connecting over low quality networks to speak to somebody or making video conference is often not possible.

Providing email attachments with voice notes, or emails and SMS with links to videos gives them possibility to download the message and improves good relations.

Comments by visitors

By Toby Warner on 2020-07-07 18:02:20:

Hi, thanks for making this page, I really like the fact that you can make voice notes in Emacs.

Leave Your Comment or Contact GNU.Support

Contact GNU.Support now. There is a simple rule at GNU.Support: if we can help you, we do, whenever and wherever necessary, and it's the way we've been doing business since 2002, and the only way we know


Full name:


E-mail:


Message: