]> code.delx.au - gnu-emacs-elpa/blob - packages/transcribe/transcribe.el
Added some usage information
[gnu-emacs-elpa] / packages / transcribe / transcribe.el
1 ;;;transcribe.el --- package for audio transcriptions
2
3 ;;Copyright 2014 David González Gándara
4
5 ;;Author: David Gonzalez Gandara <dggandara@member.fsf.org>
6 ;;version: 0.0.1
7
8 ;;This program is free software: you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
12 ;;
13 ;; This program is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
17 ;;
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
20
21
22 ;;;Commentary:
23
24 ;; INSTALLATION
25 ;;-------------------
26 ;; If you don't use transcribe as a package, you can install manually:
27 ;; Copy this file to somewhere in your drive
28
29 ;; To load the file --> M-: (load "~/transcribe.el") --- change the route to where you copied the file
30
31 ;; DEPENDENCIES:
32 ;;-----------------------------
33 ;; In order to use the most important functions of transcribe, you need to install emms and mpg321.
34 ;;
35 ;; DESCRIPTION
36 ;;-------------------------
37 ;; Transcribe is a tool to make audio transcriptions easy. It allows the transcriber to control the audio easily while typing, as well as automate the insertion of xml tags, in case the transcription protocol include them.
38 ;;
39 ;; AUDIO COMMANDS
40 ;;------------------------------
41 ;; C-x C-p --------> Play audio file. You will be prompted for the name of the file. The recommended format is mp2.
42 ;; <f5> -----------> Pause or play audio.
43 ;; C-x <right> ----> seek audio 10 seconds forward.
44 ;; C-x <left> ----->seek audio 10 seconds backward.
45 ;; <f8> -----------> seek interactively: positive seconds go forward and negative seconds go backward
46 ;;
47 ;; XML TAGGING COMMANDS
48 ;;--------------------------------------------------
49 ;; C-x C-n --> Create new episode structure. This is useful in case your xml file structure requires it. You can customize the text inserted manipulating the realted function.
50 ;; <f6> -----> Interactively insert new tag. You will be prompted for the content of the tag. The starting tag and the end tag will be inserted automatically and the cursor placed in the proper place to type.
51 ;;
52 ;;
53 ;;
54 ;; SPECIFIC COMMANDS I USE, THAT YOU MAY FIND USEFUL
55 ;;------------------------------------------------
56 ;; C-x C-a ------> This runs an external discourse analysis tool. It defaults to my own script analyze_episodes2.py, but you can customise the command to launch any other.
57 ;; <f11> --------> Customised tag 1. Edit the function to adapt to your needs.
58 ;; <f12> --------> Customised tag 2. Edit the function to adapt to your needs.
59 ;; <f7> ---------> Break tag. This command "breaks" a tag in two, that is it inserts an ending tag and then a starting tag. Edit the function to suit your needs. It is useful if you are segmenting discourse into tags and then you decide the segmentation was not correct.
60 ;; <f4> ---------> Insert atributes. This function insert custom xml attributes. Edit the function to suit you needs.
61
62 ;;;Code:
63
64 (require 'emms-setup)
65 ;(require 'emms-player-mpd)
66 ;(setq emms-player-mpd-server-name "localhost")
67 ;(setq emms-player-mpd-server-port "6600")
68
69 (emms-standard)
70 (emms-default-players)
71 (require 'emms-player-mpg321-remote)
72 (push 'emms-player-mpg321-remote emms-player-list)
73
74 (require 'emms-mode-line)
75 (emms-mode-line 1)
76 (require 'emms-playing-time)
77 (emms-playing-time 1)
78
79 (global-set-key (kbd "C-x C-p") 'emms-play-file)
80
81 (global-set-key (kbd "<f5>") 'emms-pause)
82
83 (global-set-key (kbd "C-x <down>") 'emms-stop)
84
85 (global-set-key (kbd "C-x <right>") 'emms-seek-forward)
86
87 (global-set-key (kbd "C-x <left>") 'emms-seek-backward)
88
89 (global-set-key (kbd "<f8>") 'emms-seek)
90
91 (defun analyze-episode (episode person)
92 (interactive "sepisode: \nsperson:")
93 (shell-command (concat (expand-file-name "analyze_episodes2.py") " -e " episode " -p " person " -i " buffer-file-name )))
94
95 (global-unset-key (kbd "C-x C-A"))
96 (global-set-key (kbd "C-x C-A") 'analyze-episode)
97
98 (defun draw-boxplot ()
99 (interactive)
100 (shell-command (concat (expand-file-name "/usr/bin/Rscript ") "boxplot_students.R " buffer-file-name)))
101
102 (global-unset-key (kbd "C-x C-B"))
103 (global-set-key (kbd "C-x C-B") 'draw-boxplot)
104
105 (defun define-xml-tag (xmltag)
106 (interactive "stag:")
107 (insert (format "<%s></%s>" xmltag xmltag))
108 (backward-char 3)
109 (backward-char (string-width xmltag)))
110
111 (defun xml-tag-l1 ()
112 (interactive)
113 (insert "<l1></l1>")
114 (backward-char 3)
115 (backward-char 2))
116
117 (defun xml-tag-l2 ()
118 (interactive)
119 (insert "<l2 clauses=\"1\" errors=\"0\"></l2>")
120 (backward-char 3)
121 (backward-char 2))
122
123 (fset 'xml-tag-l2-break "</l2><l2 clauses=\"1\" errors=\"0\">")
124 (fset 'set-attributes "clauses=\"1\" errors=\"0\"")
125
126 (defun display-audio-info ()
127 (interactive)
128 (emms-player-mpg321-remote-proc)
129 (shell-command "/usr/bin/mpg321 -R - &"))
130
131
132 (global-set-key (kbd "<f6>") 'define-xml-tag)
133 (global-set-key (kbd "<f7>") 'xml-tag-l2-break)
134 (global-set-key (kbd "<f4>") 'set-attributes)
135 (global-set-key (kbd "<f11>") 'xml-tag-l1)
136 (global-set-key (kbd "<f12>") 'xml-tag-l2)
137
138 (fset 'NewEpisode
139 "<episode>\n<number>DATE-NUMBER</number>\n<duration></duration>\n<comment></comment>\n<subject>Subject (level)</subject>\n<task>\n\t<role>low or high</role>\n<context>low or high</context>\n<demand>low or high</demand>\r</task>\n<auxiliar>Yes/no</auxiliar>\n<transcription>\n</transcription>\n</episode>")
140
141 (global-unset-key (kbd "C-x C-n"))
142 (global-set-key (kbd "C-x C-n") 'NewEpisode)
143
144 ;;;transcribe.el ends here