gnu-emacs-sources
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

guitarr-tune.el 0.1


From: Mathias Dahl
Subject: guitarr-tune.el 0.1
Date: Sat, 12 Jan 2008 22:00:48 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

Enjoy!

/Mathias

;;; guitarr-tune.el --- Tune your guitarr
;;
;; Copyright (C) 2008 Mathias Dahl
;;
;; Version: 0.1
;; Keywords: convenience, music
;; Author: Mathias Dahl <address@hidden>

;; This file is NOT part of GNU Emacs.

;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.

;;; Commentary:
;;
;; This is a small hack to help you tune your guitarr.  To use, first
;; you need some sound files, which can be downloaded as per
;; below.  Save each URL as the file name described in the table:

;; Save as  URL
;; =======  ===

;; E1.wav   http://www.box.net/shared/xgeh7yqskg
;; A2.wav   http://www.box.net/shared/lvlcuyvkso
;; D3.wav   http://www.box.net/shared/u7hg1tg8cg
;; G4.wav   http://www.box.net/shared/yfzha20g8s
;; B5.wav   http://www.box.net/shared/nlitky58gg
;; E6.wav   http://www.box.net/shared/x12ksgj4sk

;; The files can only be downloaded through a javascript-enabled web
;; browser, it seems (I don't want to host the files on my web server
;; so I had to use the Box.net account, if you know about any better
;; free sound hosting, please tell me.)

;; Next, do M-x eval-buffer RET

;; Now you need to define the place where you saved the sound
;; files.  Do that by customizing `guitarr-sound-dir'.

;; Finally, type M-x guitarr-tune RET and follow the instructions
;; on the screen.
;;
;; Enjoy!

;;; Requirements
;;
;; - EMMS
;; - The sound files mentioned above

;;; History:
;;

;;; Code:

(require 'emms-setup)

(emms-all)
(emms-default-players)

(defun guitarr-tune ()
  "Tune your guitarr."
  (interactive)
  (pop-to-buffer (get-buffer-create "*guitarr-tune*"))
  (toggle-read-only 0)
  (erase-buffer)
  (insert "*** Guitarr Tune ***\n\nType e, a, d, g, b, or E (uppercase\
 e, for the high e note) to play.\nThe numbers 1
through 6 are also bound to the six strings on the guitarr.\n")
  (toggle-read-only 1)
  (guitarr-tune-mode))

(defcustom guitarr-sound-dir "~/gfx/sound"
  "Path to where the sound files are."
  :type 'string
  :group 'multimedia)

(defun guitarr-tune-play (note)
  "Play NOTE."
    (emms-play-file (concat (file-name-as-directory guitarr-sound-dir)
                            (symbol-name note)
                            ".wav")))

(define-derived-mode guitarr-tune-mode
  fundamental-mode "guitarr-tune"
  "Mode for playing guitarr"
  (guitarr-tune-define-mode-keymap))

(defvar guitarr-tune-mode-map (make-sparse-keymap)
  "Keymap for `guitarr-tune-mode'.")

(defun guitarr-tune-define-mode-keymap ()
  "Define keymap for `guitarr-tune-mode'."
  (mapc
   (lambda (x)
     (define-key guitarr-tune-mode-map (car x)
       `(lambda () (interactive) (guitarr-tune-play ',(cdr x)))))
   '(("e" . E1)
     ("a" . A2)
     ("d" . D3)
     ("g" . G4)
     ("b" . B5)
     ("E" . E6)
     ("1" . E1)
     ("2" . A2)
     ("3" . D3)
     ("4" . G4)
     ("5" . B5)
     ("6" . E6))))

(provide 'guitarr-tune)

(provide 'guitarr-tune)

;;; guitarr-tune.el ends here


reply via email to

[Prev in Thread] Current Thread [Next in Thread]