-
Notifications
You must be signed in to change notification settings - Fork 1
/
drum.html
320 lines (227 loc) · 11.3 KB
/
drum.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
<!DOCTYPE html>
<html >
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Drum Transcription</title>
<link rel="stylesheet" href="_static/pygments.css">
<link rel="stylesheet" href="_static/theme.css">
<link rel="stylesheet" href="_static/sphinx_press_theme.css">
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<!-- sphinx script_files -->
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/language_data.js"></script>
<script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script src="_static/theme-vendors.js"></script>
<script src="_static/theme.js" defer></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Feature" href="feature.html" />
<link rel="prev" title="Music Transcription" href="music.html" />
</head>
<body>
<div id="app" class="theme-container" :class="pageClasses"><navbar @toggle-sidebar="toggleSidebar">
<router-link to="index.html" class="home-link">
<span class="site-name">omnizart</span>
</router-link>
<div class="links">
<navlinks class="can-hide">
<div class="nav-item">
<a href="index.html#omniscient-mozart-s-document"
class="nav-link ">
Contents
</a>
</div>
<div class="nav-item">
<a href="index.html#omniscient-mozart-s-document"
class="nav-link router-link-active">
API Reference
</a>
</div>
</navlinks>
</div>
</navbar>
<div class="sidebar-mask" @click="toggleSidebar(false)">
</div>
<sidebar @toggle-sidebar="toggleSidebar">
<navlinks>
<div class="nav-item">
<a href="index.html#omniscient-mozart-s-document"
class="nav-link ">
Contents
</a>
</div>
<div class="nav-item">
<a href="index.html#omniscient-mozart-s-document"
class="nav-link router-link-active">
API Reference
</a>
</div>
</navlinks><div id="searchbox" class="searchbox" role="search">
<div class="caption"><span class="caption-text">Quick search</span>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Search" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div><div class="sidebar-links" role="navigation" aria-label="main navigation">
<div class="sidebar-group">
<p class="caption">
<span class="caption-text"><a href="index.html#omniscient-mozart-s-document">Contents</a></span>
</p>
<ul class="">
<li class="toctree-l1 "><a href="quick-start.html" class="reference internal ">Quick Start</a>
</li>
<li class="toctree-l1 "><a href="cli.html" class="reference internal ">Command Line Interface</a>
</li>
</ul>
</div>
<div class="sidebar-group">
<p class="caption">
<span class="caption-text"><a href="index.html#omniscient-mozart-s-document">API Reference</a></span>
</p>
<ul class="current">
<li class="toctree-l1 "><a href="music.html" class="reference internal ">Music Transcription</a>
</li>
<li class="toctree-l1 current"><a href="#" class="reference internal current">Drum Transcription</a>
<ul>
<li class="toctree-l2"><a href="#transcribe" class="reference internal">Transcribe</a></li>
<li class="toctree-l2"><a href="#module-omnizart.drum.prediction" class="reference internal">Prediction</a></li>
</ul>
</li>
<li class="toctree-l1 "><a href="feature.html" class="reference internal ">Feature</a>
</li>
<li class="toctree-l1 "><a href="models.html" class="reference internal ">Models</a>
</li>
<li class="toctree-l1 "><a href="training.html" class="reference internal ">Training</a>
</li>
<li class="toctree-l1 "><a href="base.html" class="reference internal ">Base Classes</a>
</li>
<li class="toctree-l1 "><a href="constants.html" class="reference internal ">Constants</a>
</li>
<li class="toctree-l1 "><a href="utils.html" class="reference internal ">Utilities</a>
</li>
</ul>
</div>
</div>
</sidebar>
<page>
<div class="body-header" role="navigation" aria-label="navigation">
<ul class="breadcrumbs">
<li><a href="index.html">Docs</a> »</li>
<li>Drum Transcription</li>
</ul>
<ul class="page-nav">
<li class="prev">
<a href="music.html"
title="previous chapter">← Music Transcription</a>
</li>
<li class="next">
<a href="feature.html"
title="next chapter">Feature →</a>
</li>
</ul>
</div>
<hr>
<div class="content" role="main">
<div class="section" id="module-omnizart.drum">
<span id="drum-transcription"></span><h1>Drum Transcription<a class="headerlink" href="#module-omnizart.drum" title="Permalink to this headline">¶</a></h1>
<p>Drum transcription module.</p>
<p>Utilities for transcribing drum percussions in the music.</p>
<div class="section" id="transcribe">
<h2>Transcribe<a class="headerlink" href="#transcribe" title="Permalink to this headline">¶</a></h2>
<dl class="py function">
<dt id="omnizart.drum.app.DrumTranscription.transcribe">
<code class="sig-prename descclassname">omnizart.drum.app.DrumTranscription.</code><code class="sig-name descname">transcribe</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">self</span></em>, <em class="sig-param"><span class="n">input_audio</span></em>, <em class="sig-param"><span class="n">model_path</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">output</span><span class="o">=</span><span class="default_value">'./'</span></em><span class="sig-paren">)</span><a class="headerlink" href="#omnizart.drum.app.DrumTranscription.transcribe" title="Permalink to this definition">¶</a></dt>
<dd><p>Transcribe drum in the audio.</p>
<p>This function transcribes drum activations in the music. Currently the model
predicts 13 classes of different drum sets, and 3 of them will be written to
the MIDI file.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>input_audio: Path</strong></dt><dd><p>Path to the raw audio file (.wav).</p>
</dd>
<dt><strong>model_path: Path</strong></dt><dd><p>Path to the trained model.</p>
</dd>
<dt><strong>output: Path (optional)</strong></dt><dd><p>Path for writing out the transcribed MIDI file. Default to current path.</p>
</dd>
</dl>
</dd>
</dl>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><code class="xref py py-obj docutils literal notranslate"><span class="pre">omnizart.cli.drum.transcribe</span></code></dt><dd><p>CLI entry point of this function.</p>
</dd>
</dl>
</div>
</dd></dl>
</div>
<div class="section" id="module-omnizart.drum.prediction">
<span id="prediction"></span><h2>Prediction<a class="headerlink" href="#module-omnizart.drum.prediction" title="Permalink to this headline">¶</a></h2>
<dl class="py function">
<dt id="omnizart.drum.prediction.create_batches">
<code class="sig-prename descclassname">omnizart.drum.prediction.</code><code class="sig-name descname">create_batches</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">feature</span></em>, <em class="sig-param"><span class="n">mini_beat_per_seg</span></em>, <em class="sig-param"><span class="n">b_size</span><span class="o">=</span><span class="default_value">6</span></em><span class="sig-paren">)</span><a class="headerlink" href="#omnizart.drum.prediction.create_batches" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a 4D input for model prediction.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>feature: 3D numpy array</strong></dt><dd><p>Should be in shape [mini_beat_pos x time x freq].</p>
</dd>
<dt><strong>mini_beat_per_seg: int</strong></dt><dd><p>Number of mini beats in one segment (a beat).</p>
</dd>
<dt><strong>b_size: int</strong></dt><dd><p>Output batch size.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt>batch_feature: 5D numpy array</dt><dd><p>Dimensions are [batches x b_size x time x freq x mini_beat_per_seg].</p>
</dd>
<dt>pad_size: int</dt><dd><p>The additional padded size at the end of the batch.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt id="omnizart.drum.prediction.merge_batches">
<code class="sig-prename descclassname">omnizart.drum.prediction.</code><code class="sig-name descname">merge_batches</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">batch_pred</span></em><span class="sig-paren">)</span><a class="headerlink" href="#omnizart.drum.prediction.merge_batches" title="Permalink to this definition">¶</a></dt>
<dd><p>Reverse process of create_batches.</p>
<p>Merges a 5D batched-prediction into 2D output.</p>
</dd></dl>
<dl class="py function">
<dt id="omnizart.drum.prediction.predict">
<code class="sig-prename descclassname">omnizart.drum.prediction.</code><code class="sig-name descname">predict</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">patch_cqt_feature</span></em>, <em class="sig-param"><span class="n">model</span></em>, <em class="sig-param"><span class="n">mini_beat_per_seg</span></em>, <em class="sig-param"><span class="n">batch_size</span><span class="o">=</span><span class="default_value">6</span></em><span class="sig-paren">)</span><a class="headerlink" href="#omnizart.drum.prediction.predict" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</div>
</div>
</div>
<div class="page-nav">
<div class="inner"><ul class="page-nav">
<li class="prev">
<a href="music.html"
title="previous chapter">← Music Transcription</a>
</li>
<li class="next">
<a href="feature.html"
title="next chapter">Feature →</a>
</li>
</ul><div class="footer" role="contentinfo">
© Copyright 2020, BreezeWhite.
<br>
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 3.2.1 with <a href="https://github.com/schettino72/sphinx_press_theme">Press Theme</a>.
</div>
</div>
</div>
</page>
</div>
</body>
</html>