]> code.delx.au - gnu-emacs-elpa/blob - packages/transcribe/transcribe.el
Merge commit '85b3fbe091aba2d9dc581894a02f60acd46f4413'
[gnu-emacs-elpa] / packages / transcribe / transcribe.el
1 ;;; transcribe.el --- package for audio transcriptions
2
3 ;; Copyright 2014-2015 Free Software Foundation, Inc.
4
5 ;; Author: David Gonzalez Gandara <dggandara@member.fsf.org>
6 ;; Version: 0.5.0
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 ;;; Commentary:
22
23 ;; REQUIRES:
24 ;; -----------------------------
25 ;; In order to use the most important functions of transcribe, you need to install emms and mpg321.
26 ;;
27 ;; USAGE:
28 ;; -------------------------
29 ;; 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.
30 ;;
31 ;; AUDIO COMMANDS
32 ;; ------------------------------
33 ;; C-x C-p --------> Play audio file. You will be prompted for the name of the file. The recommended format is mp2.
34 ;; <f5> -----------> Pause or play audio.
35 ;; C-x <right> ----> seek audio 10 seconds forward.
36 ;; C-x <left> ----->seek audio 10 seconds backward.
37 ;; <f8> -----------> seek interactively: positive seconds go forward and negative seconds go backward
38 ;;
39 ;; XML TAGGING COMMANDS
40 ;; --------------------------------------------------
41 ;; 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.
42 ;; <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.
43 ;;
44 ;;
45 ;;
46 ;; SPECIFIC COMMANDS I USE, THAT YOU MAY FIND USEFUL
47 ;; ------------------------------------------------
48 ;; 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.
49 ;; <f11> --------> Customised tag 1. Edit the function to adapt to your needs.
50 ;; <f12> --------> Customised tag 2. Edit the function to adapt to your needs.
51 ;; <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.
52 ;; <f4> ---------> Insert atributes. This function insert custom xml attributes. Edit the function to suit you needs.
53
54 ;;; Code:
55
56 (if t (require 'emms-setup))
57 ;(require 'emms-player-mpd)
58 ;(setq emms-player-mpd-server-name "localhost")
59 ;(setq emms-player-mpd-server-port "6600")
60
61 (emms-standard)
62 (emms-default-players)
63 (if t (require 'emms-player-mpg321-remote))
64 (defvar emms-player-list)
65 (push 'emms-player-mpg321-remote emms-player-list)
66
67 (if t (require 'emms-mode-line))
68 (emms-mode-line 1)
69 (if t (require 'emms-playing-time))
70 (emms-playing-time 1)
71
72
73 (defun transcribe-analyze-episode (episode person)
74 (interactive "sepisode: \nsperson:")
75 (shell-command (concat (expand-file-name "analyze_episodes2.py") " -e " episode " -p " person " -i " buffer-file-name )))
76
77 (defun transcribe-define-xml-tag (xmltag)
78 (interactive "stag:")
79 (insert (format "<%s></%s>" xmltag xmltag))
80 (backward-char 3)
81 (backward-char (string-width xmltag)))
82
83 (defun transcribe-xml-tag-l1 ()
84 (interactive)
85 (insert "<l1></l1>")
86 (backward-char 3)
87 (backward-char 2))
88
89 (defun transcribe-xml-tag-l2 ()
90 (interactive)
91 (insert "<l2 clauses=\"1\" errors=\"0\"></l2>")
92 (backward-char 3)
93 (backward-char 2))
94
95 (fset 'transcribe-xml-tag-l2-break "</l2><l2 clauses=\"1\" errors=\"0\">")
96 (fset 'transcribe-set-attributes "clauses=\"1\" errors=\"0\"")
97
98 (defun transcribe-display-audio-info ()
99 (interactive)
100 (emms-player-mpg321-remote-proc)
101 (shell-command "/usr/bin/mpg321 -R - &"))
102
103
104 (fset 'NewEpisode
105 "<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>")
106
107 (define-minor-mode transcribe-mode
108 "Toggle transcribe-mode"
109 nil
110 " Transcribe"
111 '(([?\C-x ?\C-p] . emms-play-file)
112 ([?\C-x ?\C-a] . transcribe-analyze-episode)
113 ([?\C-x ?\C-n] . 'NewEpisode)
114 ([?\C-x down] . emms-stop)
115 ([?\C-x right] . emms-seek-forward)
116 ([?\C-x left] . emms-seek-backward)
117 ([f5] . emms-pause)
118 ([f6] . transcribe-define-xml-tag)
119 ([f7] . 'transcribe-xml-tag-l2-break)
120 ([f8] . emms-seek)
121 ([f4] . 'transcribe-set-atributes)
122 ([f11] . transcribe-xml-tag-l1)
123 ([f12] . transcribe-xml-tag-l2))
124 )
125
126 ;;;; ChangeLog:
127
128 ;; 2015-11-30 David Gonzalez Gandara <dggandara@member.fsf.org>
129 ;;
130 ;; Added minor-mode function as suggested
131 ;;
132 ;; 2015-11-29 Stefan Monnier <monnier@iro.umontreal.ca>
133 ;;
134 ;; * transcribe.el: Add `provide' statement
135 ;;
136 ;; 2015-11-29 Stefan Monnier <monnier@iro.umontreal.ca>
137 ;;
138 ;; * transcribe.el: Fix up formatting and copyright
139 ;;
140 ;; 2015-11-29 David Gonzalez Gandara <dggandara@member.fsf.org>
141 ;;
142 ;; Added some usage information
143 ;;
144 ;; 2015-11-29 David Gonzalez Gandara <dggandara@member.fsf.org>
145 ;;
146 ;; Package transcribe added
147 ;;
148
149
150 (provide 'transcribe)
151
152 ;;; transcribe.el ends here