❖ Browsing media by syogm
(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 48000)) (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))
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.