]> code.delx.au - gnu-emacs-elpa/blob - packages/transcribe/transcribe.el
Package transcribe added
[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 ;;
25 ;; to install manually:
26 ;; Copy this file to somewhere in your drive
27
28 ;; To load the file --> M-: (load "~/transcribe.el") --- change the route to where you copied the file
29
30 ;; Commands:
31 ;; C-x C-n --> new episode structure
32 ;; <f6> ----> New tag. Interactively insert new tag
33 ;; C-x C-a ----> call interactively analyze_episodes.py to extract interactions by a person
34 ;; C-x C-p ----> play audio file
35 ;; <f5> ----> pause or play audio
36 ;; C-x <right> ----> seek 10 seconds forward
37 ;; C-x <left> ---->seek 10 seconds backward
38 ;; <f8> ----> seek interactively: positive seconds go forward and negative seconds go backward
39 ;; <f11> --------> l1 tag
40 ;; <f12> --------> l2 tag
41
42 ;;;Code:
43
44 (require 'emms-setup)
45 ;(require 'emms-player-mpd)
46 ;(setq emms-player-mpd-server-name "localhost")
47 ;(setq emms-player-mpd-server-port "6600")
48
49 (emms-standard)
50 (emms-default-players)
51 (require 'emms-player-mpg321-remote)
52 (push 'emms-player-mpg321-remote emms-player-list)
53
54 (require 'emms-mode-line)
55 (emms-mode-line 1)
56 (require 'emms-playing-time)
57 (emms-playing-time 1)
58
59 (global-set-key (kbd "C-x C-p") 'emms-play-file)
60
61 (global-set-key (kbd "<f5>") 'emms-pause)
62
63 (global-set-key (kbd "C-x <down>") 'emms-stop)
64
65 (global-set-key (kbd "C-x <right>") 'emms-seek-forward)
66
67 (global-set-key (kbd "C-x <left>") 'emms-seek-backward)
68
69 (global-set-key (kbd "<f8>") 'emms-seek)
70
71 (defun analyze-episode (episode person)
72 (interactive "sepisode: \nsperson:")
73 (shell-command (concat (expand-file-name "analyze_episodes2.py") " -e " episode " -p " person " -i " buffer-file-name )))
74
75 (global-unset-key (kbd "C-x C-A"))
76 (global-set-key (kbd "C-x C-A") 'analyze-episode)
77
78 (defun draw-boxplot ()
79 (interactive)
80 (shell-command (concat (expand-file-name "/usr/bin/Rscript ") "boxplot_students.R " buffer-file-name)))
81
82 (global-unset-key (kbd "C-x C-B"))
83 (global-set-key (kbd "C-x C-B") 'draw-boxplot)
84
85 (defun define-xml-tag (xmltag)
86 (interactive "stag:")
87 (insert (format "<%s></%s>" xmltag xmltag))
88 (backward-char 3)
89 (backward-char (string-width xmltag)))
90
91 (defun xml-tag-l1 ()
92 (interactive)
93 (insert "<l1></l1>")
94 (backward-char 3)
95 (backward-char 2))
96
97 (defun xml-tag-l2 ()
98 (interactive)
99 (insert "<l2 clauses=\"1\" errors=\"0\"></l2>")
100 (backward-char 3)
101 (backward-char 2))
102
103 (fset 'xml-tag-l2-break "</l2><l2 clauses=\"1\" errors=\"0\">")
104 (fset 'set-attributes "clauses=\"1\" errors=\"0\"")
105
106 (defun display-audio-info ()
107 (interactive)
108 (emms-player-mpg321-remote-proc)
109 (shell-command "/usr/bin/mpg321 -R - &"))
110
111
112 (global-set-key (kbd "<f6>") 'define-xml-tag)
113 (global-set-key (kbd "<f7>") 'xml-tag-l2-break)
114 (global-set-key (kbd "<f4>") 'set-attributes)
115 (global-set-key (kbd "<f11>") 'xml-tag-l1)
116 (global-set-key (kbd "<f12>") 'xml-tag-l2)
117
118 (fset 'NewEpisode
119 "<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>")
120
121 (global-unset-key (kbd "C-x C-n"))
122 (global-set-key (kbd "C-x C-n") 'NewEpisode)
123
124 ;;;transcribe.el ends here