[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: guitar-tune.el 0.1
From: |
Mathias Dahl |
Subject: |
Re: guitar-tune.el 0.1 |
Date: |
Sat, 12 Jan 2008 22:28:52 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux) |
Mathias Dahl <address@hidden> writes:
How embarrassing, I misspelled "guitar". Have to blame it on the Swedish
:)
Here is a corrected version.
/Mathias
;;; guitar-tune.el --- Tune your guitar
;;
;; 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 guitar. 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 `guitar-sound-dir'.
;; Finally, type M-x guitar-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 guitar-tune ()
"Tune your guitar."
(interactive)
(pop-to-buffer (get-buffer-create "*guitar-tune*"))
(toggle-read-only 0)
(erase-buffer)
(insert "*** Guitar 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 guitar.\n")
(toggle-read-only 1)
(guitar-tune-mode))
(defcustom guitar-sound-dir "~/gfx/sound"
"Path to where the sound files are."
:type 'string
:group 'multimedia)
(defun guitar-tune-play (note)
"Play NOTE."
(emms-play-file (concat (file-name-as-directory guitar-sound-dir)
(symbol-name note)
".wav")))
(define-derived-mode guitar-tune-mode
fundamental-mode "guitar-tune"
"Mode for playing guitar"
(guitar-tune-define-mode-keymap))
(defvar guitar-tune-mode-map (make-sparse-keymap)
"Keymap for `guitar-tune-mode'.")
(defun guitar-tune-define-mode-keymap ()
"Define keymap for `guitar-tune-mode'."
(mapc
(lambda (x)
(define-key guitar-tune-mode-map (car x)
`(lambda () (interactive) (guitar-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 'guitar-tune)
(provide 'guitar-tune)
;;; guitar-tune.el ends here
Message not available