cw 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardoc/checksums +33 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/cw.gemspec +1 -1
- data/doc/Alphabet.html +433 -0
- data/doc/AudioPlayer.html +805 -0
- data/doc/Book.html +3134 -0
- data/doc/BookDetails.html +664 -0
- data/doc/CW.html +849 -0
- data/doc/CWThreads.html +514 -0
- data/doc/Cl.html +1125 -0
- data/doc/CurrentWord.html +636 -0
- data/doc/CwDsl.html +1871 -0
- data/doc/CwEncoding.html +329 -0
- data/doc/FileDetails.html +236 -0
- data/doc/KeyInput.html +758 -0
- data/doc/MonitorKeys.html +482 -0
- data/doc/Numbers.html +433 -0
- data/doc/Params.html +352 -0
- data/doc/Print.html +1130 -0
- data/doc/Print/ProgressPrint.html +419 -0
- data/doc/Process.html +202 -0
- data/doc/Progress.html +337 -0
- data/doc/Randomize.html +959 -0
- data/doc/RepeatWord.html +816 -0
- data/doc/Rss.html +630 -0
- data/doc/Sentence.html +1457 -0
- data/doc/Spoken.html +215 -0
- data/doc/Str.html +771 -0
- data/doc/Stream.html +1401 -0
- data/doc/TestLetters.html +586 -0
- data/doc/TestWords.html +646 -0
- data/doc/Tester.html +3064 -0
- data/doc/Timing.html +1244 -0
- data/doc/ToneGenerator.html +2111 -0
- data/doc/Voice.html +273 -0
- data/doc/Words.html +1750 -0
- data/doc/_index.html +376 -0
- data/doc/class_list.html +58 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +148 -0
- data/doc/file_list.html +60 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +148 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +181 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +2697 -0
- data/doc/monitor.html +435 -0
- data/doc/top-level-namespace.html +114 -0
- metadata +53 -1
@@ -0,0 +1,2111 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: ToneGenerator
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '';
|
20
|
+
framesUrl = "frames.html#!ToneGenerator.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="_index.html">Index (T)</a> »
|
35
|
+
|
36
|
+
|
37
|
+
<span class="title">ToneGenerator</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Class: ToneGenerator
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">ToneGenerator</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
97
|
+
<dd class="r2 last">lib/cw/tone_generator.rb</dd>
|
98
|
+
|
99
|
+
</dl>
|
100
|
+
<div class="clear"></div>
|
101
|
+
|
102
|
+
|
103
|
+
<h2>Constant Summary</h2>
|
104
|
+
|
105
|
+
<dl class="constants">
|
106
|
+
|
107
|
+
<dt id="HERE-constant" class="">HERE =
|
108
|
+
|
109
|
+
</dt>
|
110
|
+
<dd><pre class="code"><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/../../</span><span class='tstring_end'>'</span></span></pre></dd>
|
111
|
+
|
112
|
+
<dt id="DOT_FILENAME-constant" class="">DOT_FILENAME =
|
113
|
+
|
114
|
+
</dt>
|
115
|
+
<dd><pre class="code"><span class='const'>HERE</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>audio/dot.wav</span><span class='tstring_end'>"</span></span></pre></dd>
|
116
|
+
|
117
|
+
<dt id="DASH_FILENAME-constant" class="">DASH_FILENAME =
|
118
|
+
|
119
|
+
</dt>
|
120
|
+
<dd><pre class="code"><span class='const'>HERE</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>audio/dash.wav</span><span class='tstring_end'>"</span></span></pre></dd>
|
121
|
+
|
122
|
+
<dt id="SPACE_FILENAME-constant" class="">SPACE_FILENAME =
|
123
|
+
|
124
|
+
</dt>
|
125
|
+
<dd><pre class="code"><span class='const'>HERE</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>audio/space.wav</span><span class='tstring_end'>"</span></span></pre></dd>
|
126
|
+
|
127
|
+
<dt id="E_SPACE_FILENAME-constant" class="">E_SPACE_FILENAME =
|
128
|
+
|
129
|
+
</dt>
|
130
|
+
<dd><pre class="code"><span class='const'>HERE</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>audio/e_space.wav</span><span class='tstring_end'>"</span></span></pre></dd>
|
131
|
+
|
132
|
+
<dt id="TWO_PI-constant" class="">TWO_PI =
|
133
|
+
|
134
|
+
</dt>
|
135
|
+
<dd><pre class="code"><span class='int'>2</span> <span class='op'>*</span> <span class='const'>Math</span><span class='op'>::</span><span class='const'>PI</span></pre></dd>
|
136
|
+
|
137
|
+
</dl>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
<h2>
|
148
|
+
Instance Method Summary
|
149
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
150
|
+
</h2>
|
151
|
+
|
152
|
+
<ul class="summary">
|
153
|
+
|
154
|
+
<li class="public ">
|
155
|
+
<span class="summary_signature">
|
156
|
+
|
157
|
+
<a href="#char_space-instance_method" title="#char_space (instance method)">- (Object) <strong>char_space</strong> </a>
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
</span>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
172
|
+
|
173
|
+
</li>
|
174
|
+
|
175
|
+
|
176
|
+
<li class="public ">
|
177
|
+
<span class="summary_signature">
|
178
|
+
|
179
|
+
<a href="#compile_fundamentals-instance_method" title="#compile_fundamentals (instance method)">- (Object) <strong>compile_fundamentals</strong> </a>
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
</span>
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
194
|
+
|
195
|
+
</li>
|
196
|
+
|
197
|
+
|
198
|
+
<li class="public ">
|
199
|
+
<span class="summary_signature">
|
200
|
+
|
201
|
+
<a href="#convert_words-instance_method" title="#convert_words (instance method)">- (Object) <strong>convert_words</strong>(wrds) </a>
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
</span>
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
216
|
+
|
217
|
+
</li>
|
218
|
+
|
219
|
+
|
220
|
+
<li class="public ">
|
221
|
+
<span class="summary_signature">
|
222
|
+
|
223
|
+
<a href="#create_element_method-instance_method" title="#create_element_method (instance method)">- (Object) <strong>create_element_method</strong>(ele) </a>
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
</span>
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
238
|
+
|
239
|
+
</li>
|
240
|
+
|
241
|
+
|
242
|
+
<li class="public ">
|
243
|
+
<span class="summary_signature">
|
244
|
+
|
245
|
+
<a href="#create_element_methods-instance_method" title="#create_element_methods (instance method)">- (Object) <strong>create_element_methods</strong> </a>
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
</span>
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
260
|
+
|
261
|
+
</li>
|
262
|
+
|
263
|
+
|
264
|
+
<li class="public ">
|
265
|
+
<span class="summary_signature">
|
266
|
+
|
267
|
+
<a href="#cw_encoding-instance_method" title="#cw_encoding (instance method)">- (Object) <strong>cw_encoding</strong> </a>
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
</span>
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
282
|
+
|
283
|
+
</li>
|
284
|
+
|
285
|
+
|
286
|
+
<li class="public ">
|
287
|
+
<span class="summary_signature">
|
288
|
+
|
289
|
+
<a href="#data-instance_method" title="#data (instance method)">- (Object) <strong>data</strong> </a>
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
</span>
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
304
|
+
|
305
|
+
</li>
|
306
|
+
|
307
|
+
|
308
|
+
<li class="public ">
|
309
|
+
<span class="summary_signature">
|
310
|
+
|
311
|
+
<a href="#elements-instance_method" title="#elements (instance method)">- (Object) <strong>elements</strong> </a>
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
</span>
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
326
|
+
|
327
|
+
</li>
|
328
|
+
|
329
|
+
|
330
|
+
<li class="public ">
|
331
|
+
<span class="summary_signature">
|
332
|
+
|
333
|
+
<a href="#filter_maybe-instance_method" title="#filter_maybe (instance method)">- (Object) <strong>filter_maybe</strong>(size, count) </a>
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
</span>
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
348
|
+
|
349
|
+
</li>
|
350
|
+
|
351
|
+
|
352
|
+
<li class="public ">
|
353
|
+
<span class="summary_signature">
|
354
|
+
|
355
|
+
<a href="#generate-instance_method" title="#generate (instance method)">- (Object) <strong>generate</strong>(wrds) </a>
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
</span>
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
370
|
+
|
371
|
+
</li>
|
372
|
+
|
373
|
+
|
374
|
+
<li class="public ">
|
375
|
+
<span class="summary_signature">
|
376
|
+
|
377
|
+
<a href="#generate_buffer-instance_method" title="#generate_buffer (instance method)">- (Object) <strong>generate_buffer</strong>(audio_samples, ele) </a>
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
</span>
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
392
|
+
|
393
|
+
</li>
|
394
|
+
|
395
|
+
|
396
|
+
<li class="public ">
|
397
|
+
<span class="summary_signature">
|
398
|
+
|
399
|
+
<a href="#generate_samples-instance_method" title="#generate_samples (instance method)">- (Object) <strong>generate_samples</strong>(ele) </a>
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
</span>
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
414
|
+
|
415
|
+
</li>
|
416
|
+
|
417
|
+
|
418
|
+
<li class="public ">
|
419
|
+
<span class="summary_signature">
|
420
|
+
|
421
|
+
<a href="#generate_space-instance_method" title="#generate_space (instance method)">- (Object) <strong>generate_space</strong>(number_of_samples) </a>
|
422
|
+
|
423
|
+
|
424
|
+
|
425
|
+
</span>
|
426
|
+
|
427
|
+
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
436
|
+
|
437
|
+
</li>
|
438
|
+
|
439
|
+
|
440
|
+
<li class="public ">
|
441
|
+
<span class="summary_signature">
|
442
|
+
|
443
|
+
<a href="#generate_tone-instance_method" title="#generate_tone (instance method)">- (Object) <strong>generate_tone</strong>(number_of_samples) </a>
|
444
|
+
|
445
|
+
|
446
|
+
|
447
|
+
</span>
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
458
|
+
|
459
|
+
</li>
|
460
|
+
|
461
|
+
|
462
|
+
<li class="public ">
|
463
|
+
<span class="summary_signature">
|
464
|
+
|
465
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (ToneGenerator) <strong>initialize</strong> </a>
|
466
|
+
|
467
|
+
|
468
|
+
|
469
|
+
</span>
|
470
|
+
|
471
|
+
|
472
|
+
<span class="note title constructor">constructor</span>
|
473
|
+
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
|
480
|
+
|
481
|
+
<span class="summary_desc"><div class='inline'>
|
482
|
+
<p>A new instance of ToneGenerator.</p>
|
483
|
+
</div></span>
|
484
|
+
|
485
|
+
</li>
|
486
|
+
|
487
|
+
|
488
|
+
<li class="public ">
|
489
|
+
<span class="summary_signature">
|
490
|
+
|
491
|
+
<a href="#last_element%3F-instance_method" title="#last_element? (instance method)">- (Boolean) <strong>last_element?</strong>(idx, chr) </a>
|
492
|
+
|
493
|
+
|
494
|
+
|
495
|
+
</span>
|
496
|
+
|
497
|
+
|
498
|
+
|
499
|
+
|
500
|
+
|
501
|
+
|
502
|
+
|
503
|
+
|
504
|
+
|
505
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
506
|
+
|
507
|
+
</li>
|
508
|
+
|
509
|
+
|
510
|
+
<li class="public ">
|
511
|
+
<span class="summary_signature">
|
512
|
+
|
513
|
+
<a href="#make_word_parts-instance_method" title="#make_word_parts (instance method)">- (Object) <strong>make_word_parts</strong>(words) </a>
|
514
|
+
|
515
|
+
|
516
|
+
|
517
|
+
</span>
|
518
|
+
|
519
|
+
|
520
|
+
|
521
|
+
|
522
|
+
|
523
|
+
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
528
|
+
|
529
|
+
</li>
|
530
|
+
|
531
|
+
|
532
|
+
<li class="public ">
|
533
|
+
<span class="summary_signature">
|
534
|
+
|
535
|
+
<a href="#play-instance_method" title="#play (instance method)">- (Object) <strong>play</strong> </a>
|
536
|
+
|
537
|
+
|
538
|
+
|
539
|
+
</span>
|
540
|
+
|
541
|
+
|
542
|
+
|
543
|
+
|
544
|
+
|
545
|
+
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
550
|
+
|
551
|
+
</li>
|
552
|
+
|
553
|
+
|
554
|
+
<li class="public ">
|
555
|
+
<span class="summary_signature">
|
556
|
+
|
557
|
+
<a href="#play_filename-instance_method" title="#play_filename (instance method)">- (Object) <strong>play_filename</strong> </a>
|
558
|
+
|
559
|
+
|
560
|
+
|
561
|
+
</span>
|
562
|
+
|
563
|
+
|
564
|
+
|
565
|
+
|
566
|
+
|
567
|
+
|
568
|
+
|
569
|
+
|
570
|
+
|
571
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
572
|
+
|
573
|
+
</li>
|
574
|
+
|
575
|
+
|
576
|
+
<li class="public ">
|
577
|
+
<span class="summary_signature">
|
578
|
+
|
579
|
+
<a href="#prepare_buffers-instance_method" title="#prepare_buffers (instance method)">- (Object) <strong>prepare_buffers</strong> </a>
|
580
|
+
|
581
|
+
|
582
|
+
|
583
|
+
</span>
|
584
|
+
|
585
|
+
|
586
|
+
|
587
|
+
|
588
|
+
|
589
|
+
|
590
|
+
|
591
|
+
|
592
|
+
|
593
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
594
|
+
|
595
|
+
</li>
|
596
|
+
|
597
|
+
|
598
|
+
<li class="public ">
|
599
|
+
<span class="summary_signature">
|
600
|
+
|
601
|
+
<a href="#progress-instance_method" title="#progress (instance method)">- (Object) <strong>progress</strong> </a>
|
602
|
+
|
603
|
+
|
604
|
+
|
605
|
+
</span>
|
606
|
+
|
607
|
+
|
608
|
+
|
609
|
+
|
610
|
+
|
611
|
+
|
612
|
+
|
613
|
+
|
614
|
+
|
615
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
616
|
+
|
617
|
+
</li>
|
618
|
+
|
619
|
+
|
620
|
+
<li class="public ">
|
621
|
+
<span class="summary_signature">
|
622
|
+
|
623
|
+
<a href="#push_enc-instance_method" title="#push_enc (instance method)">- (Object) <strong>push_enc</strong>(chr) </a>
|
624
|
+
|
625
|
+
|
626
|
+
|
627
|
+
</span>
|
628
|
+
|
629
|
+
|
630
|
+
|
631
|
+
|
632
|
+
|
633
|
+
|
634
|
+
|
635
|
+
|
636
|
+
|
637
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
638
|
+
|
639
|
+
</li>
|
640
|
+
|
641
|
+
|
642
|
+
<li class="public ">
|
643
|
+
<span class="summary_signature">
|
644
|
+
|
645
|
+
<a href="#reset-instance_method" title="#reset (instance method)">- (Object) <strong>reset</strong> </a>
|
646
|
+
|
647
|
+
|
648
|
+
|
649
|
+
</span>
|
650
|
+
|
651
|
+
|
652
|
+
|
653
|
+
|
654
|
+
|
655
|
+
|
656
|
+
|
657
|
+
|
658
|
+
|
659
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
660
|
+
|
661
|
+
</li>
|
662
|
+
|
663
|
+
|
664
|
+
<li class="public ">
|
665
|
+
<span class="summary_signature">
|
666
|
+
|
667
|
+
<a href="#send_char-instance_method" title="#send_char (instance method)">- (Object) <strong>send_char</strong>(c) </a>
|
668
|
+
|
669
|
+
|
670
|
+
|
671
|
+
</span>
|
672
|
+
|
673
|
+
|
674
|
+
|
675
|
+
|
676
|
+
|
677
|
+
|
678
|
+
|
679
|
+
|
680
|
+
|
681
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
682
|
+
|
683
|
+
</li>
|
684
|
+
|
685
|
+
|
686
|
+
<li class="public ">
|
687
|
+
<span class="summary_signature">
|
688
|
+
|
689
|
+
<a href="#space_or_espace-instance_method" title="#space_or_espace (instance method)">- (Object) <strong>space_or_espace</strong> </a>
|
690
|
+
|
691
|
+
|
692
|
+
|
693
|
+
</span>
|
694
|
+
|
695
|
+
|
696
|
+
|
697
|
+
|
698
|
+
|
699
|
+
|
700
|
+
|
701
|
+
|
702
|
+
|
703
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
704
|
+
|
705
|
+
</li>
|
706
|
+
|
707
|
+
|
708
|
+
<li class="public ">
|
709
|
+
<span class="summary_signature">
|
710
|
+
|
711
|
+
<a href="#space_sample%3F-instance_method" title="#space_sample? (instance method)">- (Boolean) <strong>space_sample?</strong>(ele) </a>
|
712
|
+
|
713
|
+
|
714
|
+
|
715
|
+
</span>
|
716
|
+
|
717
|
+
|
718
|
+
|
719
|
+
|
720
|
+
|
721
|
+
|
722
|
+
|
723
|
+
|
724
|
+
|
725
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
726
|
+
|
727
|
+
</li>
|
728
|
+
|
729
|
+
|
730
|
+
<li class="public ">
|
731
|
+
<span class="summary_signature">
|
732
|
+
|
733
|
+
<a href="#word_composite-instance_method" title="#word_composite (instance method)">- (Object) <strong>word_composite</strong>(word) </a>
|
734
|
+
|
735
|
+
|
736
|
+
|
737
|
+
</span>
|
738
|
+
|
739
|
+
|
740
|
+
|
741
|
+
|
742
|
+
|
743
|
+
|
744
|
+
|
745
|
+
|
746
|
+
|
747
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
748
|
+
|
749
|
+
</li>
|
750
|
+
|
751
|
+
|
752
|
+
<li class="public ">
|
753
|
+
<span class="summary_signature">
|
754
|
+
|
755
|
+
<a href="#word_parts-instance_method" title="#word_parts (instance method)">- (Object) <strong>word_parts</strong>(str = nil) </a>
|
756
|
+
|
757
|
+
|
758
|
+
|
759
|
+
</span>
|
760
|
+
|
761
|
+
|
762
|
+
|
763
|
+
|
764
|
+
|
765
|
+
|
766
|
+
|
767
|
+
|
768
|
+
|
769
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
770
|
+
|
771
|
+
</li>
|
772
|
+
|
773
|
+
|
774
|
+
<li class="public ">
|
775
|
+
<span class="summary_signature">
|
776
|
+
|
777
|
+
<a href="#word_space-instance_method" title="#word_space (instance method)">- (Object) <strong>word_space</strong> </a>
|
778
|
+
|
779
|
+
|
780
|
+
|
781
|
+
</span>
|
782
|
+
|
783
|
+
|
784
|
+
|
785
|
+
|
786
|
+
|
787
|
+
|
788
|
+
|
789
|
+
|
790
|
+
|
791
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
792
|
+
|
793
|
+
</li>
|
794
|
+
|
795
|
+
|
796
|
+
<li class="public ">
|
797
|
+
<span class="summary_signature">
|
798
|
+
|
799
|
+
<a href="#write_audio-instance_method" title="#write_audio (instance method)">- (Object) <strong>write_audio</strong> </a>
|
800
|
+
|
801
|
+
|
802
|
+
|
803
|
+
</span>
|
804
|
+
|
805
|
+
|
806
|
+
|
807
|
+
|
808
|
+
|
809
|
+
|
810
|
+
|
811
|
+
|
812
|
+
|
813
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
814
|
+
|
815
|
+
</li>
|
816
|
+
|
817
|
+
|
818
|
+
<li class="public ">
|
819
|
+
<span class="summary_signature">
|
820
|
+
|
821
|
+
<a href="#write_audio_file-instance_method" title="#write_audio_file (instance method)">- (Object) <strong>write_audio_file</strong> </a>
|
822
|
+
|
823
|
+
|
824
|
+
|
825
|
+
</span>
|
826
|
+
|
827
|
+
|
828
|
+
|
829
|
+
|
830
|
+
|
831
|
+
|
832
|
+
|
833
|
+
|
834
|
+
|
835
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
836
|
+
|
837
|
+
</li>
|
838
|
+
|
839
|
+
|
840
|
+
<li class="public ">
|
841
|
+
<span class="summary_signature">
|
842
|
+
|
843
|
+
<a href="#write_element_audio_file-instance_method" title="#write_element_audio_file (instance method)">- (Object) <strong>write_element_audio_file</strong>(ele, buffer) </a>
|
844
|
+
|
845
|
+
|
846
|
+
|
847
|
+
</span>
|
848
|
+
|
849
|
+
|
850
|
+
|
851
|
+
|
852
|
+
|
853
|
+
|
854
|
+
|
855
|
+
|
856
|
+
|
857
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
858
|
+
|
859
|
+
</li>
|
860
|
+
|
861
|
+
|
862
|
+
<li class="public ">
|
863
|
+
<span class="summary_signature">
|
864
|
+
|
865
|
+
<a href="#write_word_parts-instance_method" title="#write_word_parts (instance method)">- (Object) <strong>write_word_parts</strong> </a>
|
866
|
+
|
867
|
+
|
868
|
+
|
869
|
+
</span>
|
870
|
+
|
871
|
+
|
872
|
+
|
873
|
+
|
874
|
+
|
875
|
+
|
876
|
+
|
877
|
+
|
878
|
+
|
879
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
880
|
+
|
881
|
+
</li>
|
882
|
+
|
883
|
+
|
884
|
+
</ul>
|
885
|
+
|
886
|
+
|
887
|
+
<div id="constructor_details" class="method_details_list">
|
888
|
+
<h2>Constructor Details</h2>
|
889
|
+
|
890
|
+
<div class="method_details first">
|
891
|
+
<h3 class="signature first" id="initialize-instance_method">
|
892
|
+
|
893
|
+
- (<tt><span class='object_link'><a href="" title="ToneGenerator (class)">ToneGenerator</a></span></tt>) <strong>initialize</strong>
|
894
|
+
|
895
|
+
|
896
|
+
|
897
|
+
|
898
|
+
|
899
|
+
</h3><div class="docstring">
|
900
|
+
<div class="discussion">
|
901
|
+
|
902
|
+
<p>Returns a new instance of ToneGenerator</p>
|
903
|
+
|
904
|
+
|
905
|
+
</div>
|
906
|
+
</div>
|
907
|
+
<div class="tags">
|
908
|
+
|
909
|
+
|
910
|
+
</div><table class="source_code">
|
911
|
+
<tr>
|
912
|
+
<td>
|
913
|
+
<pre class="lines">
|
914
|
+
|
915
|
+
|
916
|
+
14
|
917
|
+
15
|
918
|
+
16
|
919
|
+
17
|
920
|
+
18
|
921
|
+
19
|
922
|
+
20
|
923
|
+
21</pre>
|
924
|
+
</td>
|
925
|
+
<td>
|
926
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 14</span>
|
927
|
+
|
928
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
929
|
+
<span class='ivar'>@max_amplitude</span> <span class='op'>=</span> <span class='float'>0.5</span>
|
930
|
+
<span class='ivar'>@wpm</span> <span class='op'>=</span> <span class='const'>Params</span><span class='period'>.</span><span class='id identifier rubyid_wpm'>wpm</span>
|
931
|
+
<span class='ivar'>@frequency</span> <span class='op'>=</span> <span class='const'>Params</span><span class='period'>.</span><span class='id identifier rubyid_frequency'>frequency</span>
|
932
|
+
<span class='ivar'>@effective_wpm</span> <span class='op'>=</span> <span class='const'>Params</span><span class='period'>.</span><span class='id identifier rubyid_effective_wpm'>effective_wpm</span> <span class='op'>?</span> <span class='const'>Params</span><span class='period'>.</span><span class='id identifier rubyid_effective_wpm'>effective_wpm</span> <span class='op'>:</span> <span class='ivar'>@wpm</span>
|
933
|
+
<span class='ivar'>@sample_rate</span> <span class='op'>=</span> <span class='int'>2400</span>
|
934
|
+
<span class='ivar'>@print</span> <span class='op'>=</span> <span class='const'>Print</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
935
|
+
<span class='kw'>end</span></pre>
|
936
|
+
</td>
|
937
|
+
</tr>
|
938
|
+
</table>
|
939
|
+
</div>
|
940
|
+
|
941
|
+
</div>
|
942
|
+
|
943
|
+
|
944
|
+
<div id="instance_method_details" class="method_details_list">
|
945
|
+
<h2>Instance Method Details</h2>
|
946
|
+
|
947
|
+
|
948
|
+
<div class="method_details first">
|
949
|
+
<h3 class="signature first" id="char_space-instance_method">
|
950
|
+
|
951
|
+
- (<tt>Object</tt>) <strong>char_space</strong>
|
952
|
+
|
953
|
+
|
954
|
+
|
955
|
+
|
956
|
+
|
957
|
+
</h3><table class="source_code">
|
958
|
+
<tr>
|
959
|
+
<td>
|
960
|
+
<pre class="lines">
|
961
|
+
|
962
|
+
|
963
|
+
192
|
964
|
+
193
|
965
|
+
194</pre>
|
966
|
+
</td>
|
967
|
+
<td>
|
968
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 192</span>
|
969
|
+
|
970
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_char_space'>char_space</span>
|
971
|
+
<span class='ivar'>@effective_wpm</span> <span class='op'>==</span> <span class='ivar'>@wpm</span> <span class='op'>?</span> <span class='lbracket'>[</span><span class='id identifier rubyid_space'>space</span><span class='comma'>,</span><span class='id identifier rubyid_space'>space</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='lbracket'>[</span><span class='id identifier rubyid_e_space'>e_space</span><span class='comma'>,</span><span class='id identifier rubyid_e_space'>e_space</span><span class='rbracket'>]</span>
|
972
|
+
<span class='kw'>end</span></pre>
|
973
|
+
</td>
|
974
|
+
</tr>
|
975
|
+
</table>
|
976
|
+
</div>
|
977
|
+
|
978
|
+
<div class="method_details ">
|
979
|
+
<h3 class="signature " id="compile_fundamentals-instance_method">
|
980
|
+
|
981
|
+
- (<tt>Object</tt>) <strong>compile_fundamentals</strong>
|
982
|
+
|
983
|
+
|
984
|
+
|
985
|
+
|
986
|
+
|
987
|
+
</h3><table class="source_code">
|
988
|
+
<tr>
|
989
|
+
<td>
|
990
|
+
<pre class="lines">
|
991
|
+
|
992
|
+
|
993
|
+
123
|
994
|
+
124
|
995
|
+
125
|
996
|
+
126
|
997
|
+
127
|
998
|
+
128
|
999
|
+
129
|
1000
|
+
130</pre>
|
1001
|
+
</td>
|
1002
|
+
<td>
|
1003
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 123</span>
|
1004
|
+
|
1005
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_compile_fundamentals'>compile_fundamentals</span>
|
1006
|
+
<span class='id identifier rubyid_elements'>elements</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_ele'>ele</span><span class='op'>|</span>
|
1007
|
+
<span class='comment'># progress.increment
|
1008
|
+
</span> <span class='id identifier rubyid_audio_samples'>audio_samples</span> <span class='op'>=</span> <span class='id identifier rubyid_generate_samples'>generate_samples</span> <span class='id identifier rubyid_ele'>ele</span>
|
1009
|
+
<span class='id identifier rubyid_buffer'>buffer</span> <span class='op'>=</span> <span class='id identifier rubyid_generate_buffer'>generate_buffer</span><span class='lparen'>(</span><span class='id identifier rubyid_audio_samples'>audio_samples</span><span class='comma'>,</span> <span class='id identifier rubyid_ele'>ele</span><span class='rparen'>)</span>
|
1010
|
+
<span class='id identifier rubyid_write_element_audio_file'>write_element_audio_file</span> <span class='id identifier rubyid_ele'>ele</span><span class='comma'>,</span> <span class='id identifier rubyid_buffer'>buffer</span>
|
1011
|
+
<span class='kw'>end</span>
|
1012
|
+
<span class='kw'>end</span></pre>
|
1013
|
+
</td>
|
1014
|
+
</tr>
|
1015
|
+
</table>
|
1016
|
+
</div>
|
1017
|
+
|
1018
|
+
<div class="method_details ">
|
1019
|
+
<h3 class="signature " id="convert_words-instance_method">
|
1020
|
+
|
1021
|
+
- (<tt>Object</tt>) <strong>convert_words</strong>(wrds)
|
1022
|
+
|
1023
|
+
|
1024
|
+
|
1025
|
+
|
1026
|
+
|
1027
|
+
</h3><table class="source_code">
|
1028
|
+
<tr>
|
1029
|
+
<td>
|
1030
|
+
<pre class="lines">
|
1031
|
+
|
1032
|
+
|
1033
|
+
27
|
1034
|
+
28
|
1035
|
+
29</pre>
|
1036
|
+
</td>
|
1037
|
+
<td>
|
1038
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 27</span>
|
1039
|
+
|
1040
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_convert_words'>convert_words</span> <span class='id identifier rubyid_wrds'>wrds</span>
|
1041
|
+
<span class='id identifier rubyid_wrds'>wrds</span><span class='period'>.</span><span class='id identifier rubyid_to_array'>to_array</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span><span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_wrd'>wrd</span><span class='op'>|</span> <span class='id identifier rubyid_wrd'>wrd</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rbrace'>}</span>
|
1042
|
+
<span class='kw'>end</span></pre>
|
1043
|
+
</td>
|
1044
|
+
</tr>
|
1045
|
+
</table>
|
1046
|
+
</div>
|
1047
|
+
|
1048
|
+
<div class="method_details ">
|
1049
|
+
<h3 class="signature " id="create_element_method-instance_method">
|
1050
|
+
|
1051
|
+
- (<tt>Object</tt>) <strong>create_element_method</strong>(ele)
|
1052
|
+
|
1053
|
+
|
1054
|
+
|
1055
|
+
|
1056
|
+
|
1057
|
+
</h3><table class="source_code">
|
1058
|
+
<tr>
|
1059
|
+
<td>
|
1060
|
+
<pre class="lines">
|
1061
|
+
|
1062
|
+
|
1063
|
+
103
|
1064
|
+
104
|
1065
|
+
105</pre>
|
1066
|
+
</td>
|
1067
|
+
<td>
|
1068
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 103</span>
|
1069
|
+
|
1070
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_create_element_method'>create_element_method</span> <span class='id identifier rubyid_ele'>ele</span>
|
1071
|
+
<span class='id identifier rubyid_define_singleton_method'>define_singleton_method</span><span class='lparen'>(</span><span class='id identifier rubyid_ele'>ele</span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_ele'>ele</span><span class='rbracket'>]</span><span class='rbrace'>}</span>
|
1072
|
+
<span class='kw'>end</span></pre>
|
1073
|
+
</td>
|
1074
|
+
</tr>
|
1075
|
+
</table>
|
1076
|
+
</div>
|
1077
|
+
|
1078
|
+
<div class="method_details ">
|
1079
|
+
<h3 class="signature " id="create_element_methods-instance_method">
|
1080
|
+
|
1081
|
+
- (<tt>Object</tt>) <strong>create_element_methods</strong>
|
1082
|
+
|
1083
|
+
|
1084
|
+
|
1085
|
+
|
1086
|
+
|
1087
|
+
</h3><table class="source_code">
|
1088
|
+
<tr>
|
1089
|
+
<td>
|
1090
|
+
<pre class="lines">
|
1091
|
+
|
1092
|
+
|
1093
|
+
107
|
1094
|
+
108
|
1095
|
+
109
|
1096
|
+
110
|
1097
|
+
111
|
1098
|
+
112</pre>
|
1099
|
+
</td>
|
1100
|
+
<td>
|
1101
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 107</span>
|
1102
|
+
|
1103
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_create_element_methods'>create_element_methods</span>
|
1104
|
+
<span class='id identifier rubyid_elements'>elements</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_ele'>ele</span><span class='op'>|</span>
|
1105
|
+
<span class='comment'># progress.increment
|
1106
|
+
</span> <span class='id identifier rubyid_create_element_method'>create_element_method</span> <span class='id identifier rubyid_ele'>ele</span>
|
1107
|
+
<span class='kw'>end</span>
|
1108
|
+
<span class='kw'>end</span></pre>
|
1109
|
+
</td>
|
1110
|
+
</tr>
|
1111
|
+
</table>
|
1112
|
+
</div>
|
1113
|
+
|
1114
|
+
<div class="method_details ">
|
1115
|
+
<h3 class="signature " id="cw_encoding-instance_method">
|
1116
|
+
|
1117
|
+
- (<tt>Object</tt>) <strong>cw_encoding</strong>
|
1118
|
+
|
1119
|
+
|
1120
|
+
|
1121
|
+
|
1122
|
+
|
1123
|
+
</h3><table class="source_code">
|
1124
|
+
<tr>
|
1125
|
+
<td>
|
1126
|
+
<pre class="lines">
|
1127
|
+
|
1128
|
+
|
1129
|
+
23
|
1130
|
+
24
|
1131
|
+
25</pre>
|
1132
|
+
</td>
|
1133
|
+
<td>
|
1134
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 23</span>
|
1135
|
+
|
1136
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_cw_encoding'>cw_encoding</span>
|
1137
|
+
<span class='ivar'>@encoding</span> <span class='op'>||=</span> <span class='const'>CwEncoding</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
1138
|
+
<span class='kw'>end</span></pre>
|
1139
|
+
</td>
|
1140
|
+
</tr>
|
1141
|
+
</table>
|
1142
|
+
</div>
|
1143
|
+
|
1144
|
+
<div class="method_details ">
|
1145
|
+
<h3 class="signature " id="data-instance_method">
|
1146
|
+
|
1147
|
+
- (<tt>Object</tt>) <strong>data</strong>
|
1148
|
+
|
1149
|
+
|
1150
|
+
|
1151
|
+
|
1152
|
+
|
1153
|
+
</h3><table class="source_code">
|
1154
|
+
<tr>
|
1155
|
+
<td>
|
1156
|
+
<pre class="lines">
|
1157
|
+
|
1158
|
+
|
1159
|
+
51
|
1160
|
+
52
|
1161
|
+
53
|
1162
|
+
54
|
1163
|
+
55
|
1164
|
+
56
|
1165
|
+
57
|
1166
|
+
58
|
1167
|
+
59
|
1168
|
+
60
|
1169
|
+
61
|
1170
|
+
62
|
1171
|
+
63
|
1172
|
+
64</pre>
|
1173
|
+
</td>
|
1174
|
+
<td>
|
1175
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 51</span>
|
1176
|
+
|
1177
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_data'>data</span>
|
1178
|
+
<span class='lbrace'>{</span> <span class='symbol'>:dot</span> <span class='op'>=></span> <span class='lbrace'>{</span><span class='symbol'>:name</span> <span class='op'>=></span> <span class='symbol'>:dot</span><span class='comma'>,</span>
|
1179
|
+
<span class='symbol'>:filename</span> <span class='op'>=></span> <span class='const'>DOT_FILENAME</span><span class='comma'>,</span>
|
1180
|
+
<span class='symbol'>:spb</span> <span class='op'>=></span> <span class='lparen'>(</span><span class='ivar'>@sample_rate</span> <span class='op'>*</span> <span class='float'>1.2</span> <span class='op'>/</span> <span class='ivar'>@wpm</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='rbrace'>}</span><span class='comma'>,</span>
|
1181
|
+
<span class='symbol'>:dash</span> <span class='op'>=></span> <span class='lbrace'>{</span><span class='symbol'>:name</span> <span class='op'>=></span> <span class='symbol'>:dash</span><span class='comma'>,</span>
|
1182
|
+
<span class='symbol'>:filename</span> <span class='op'>=></span> <span class='const'>DASH_FILENAME</span><span class='comma'>,</span>
|
1183
|
+
<span class='symbol'>:spb</span> <span class='op'>=></span> <span class='lparen'>(</span><span class='ivar'>@sample_rate</span> <span class='op'>*</span> <span class='float'>3.6</span> <span class='op'>/</span> <span class='ivar'>@wpm</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='rbrace'>}</span><span class='comma'>,</span>
|
1184
|
+
<span class='symbol'>:space</span> <span class='op'>=></span> <span class='lbrace'>{</span><span class='symbol'>:name</span> <span class='op'>=></span> <span class='symbol'>:space</span><span class='comma'>,</span>
|
1185
|
+
<span class='symbol'>:filename</span> <span class='op'>=></span> <span class='const'>SPACE_FILENAME</span> <span class='comma'>,</span>
|
1186
|
+
<span class='symbol'>:spb</span> <span class='op'>=></span> <span class='lparen'>(</span><span class='ivar'>@sample_rate</span> <span class='op'>*</span> <span class='float'>1.2</span> <span class='op'>/</span> <span class='ivar'>@wpm</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='rbrace'>}</span><span class='comma'>,</span>
|
1187
|
+
<span class='symbol'>:e_space</span> <span class='op'>=></span> <span class='lbrace'>{</span><span class='symbol'>:name</span> <span class='op'>=></span> <span class='symbol'>:e_space</span><span class='comma'>,</span>
|
1188
|
+
<span class='symbol'>:filename</span> <span class='op'>=></span> <span class='const'>E_SPACE_FILENAME</span> <span class='comma'>,</span>
|
1189
|
+
<span class='symbol'>:spb</span> <span class='op'>=></span> <span class='lparen'>(</span><span class='ivar'>@sample_rate</span> <span class='op'>*</span> <span class='float'>1.2</span> <span class='op'>/</span> <span class='ivar'>@effective_wpm</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='rbrace'>}</span><span class='rbrace'>}</span>
|
1190
|
+
<span class='kw'>end</span></pre>
|
1191
|
+
</td>
|
1192
|
+
</tr>
|
1193
|
+
</table>
|
1194
|
+
</div>
|
1195
|
+
|
1196
|
+
<div class="method_details ">
|
1197
|
+
<h3 class="signature " id="elements-instance_method">
|
1198
|
+
|
1199
|
+
- (<tt>Object</tt>) <strong>elements</strong>
|
1200
|
+
|
1201
|
+
|
1202
|
+
|
1203
|
+
|
1204
|
+
|
1205
|
+
</h3><table class="source_code">
|
1206
|
+
<tr>
|
1207
|
+
<td>
|
1208
|
+
<pre class="lines">
|
1209
|
+
|
1210
|
+
|
1211
|
+
99
|
1212
|
+
100
|
1213
|
+
101</pre>
|
1214
|
+
</td>
|
1215
|
+
<td>
|
1216
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 99</span>
|
1217
|
+
|
1218
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_elements'>elements</span>
|
1219
|
+
<span class='lbracket'>[</span><span class='symbol'>:dot</span><span class='comma'>,</span> <span class='symbol'>:dash</span><span class='comma'>,</span> <span class='symbol'>:space</span><span class='comma'>,</span> <span class='symbol'>:e_space</span><span class='rbracket'>]</span>
|
1220
|
+
<span class='kw'>end</span></pre>
|
1221
|
+
</td>
|
1222
|
+
</tr>
|
1223
|
+
</table>
|
1224
|
+
</div>
|
1225
|
+
|
1226
|
+
<div class="method_details ">
|
1227
|
+
<h3 class="signature " id="filter_maybe-instance_method">
|
1228
|
+
|
1229
|
+
- (<tt>Object</tt>) <strong>filter_maybe</strong>(size, count)
|
1230
|
+
|
1231
|
+
|
1232
|
+
|
1233
|
+
|
1234
|
+
|
1235
|
+
</h3><table class="source_code">
|
1236
|
+
<tr>
|
1237
|
+
<td>
|
1238
|
+
<pre class="lines">
|
1239
|
+
|
1240
|
+
|
1241
|
+
70
|
1242
|
+
71
|
1243
|
+
72
|
1244
|
+
73
|
1245
|
+
74
|
1246
|
+
75</pre>
|
1247
|
+
</td>
|
1248
|
+
<td>
|
1249
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 70</span>
|
1250
|
+
|
1251
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_filter_maybe'>filter_maybe</span><span class='lparen'>(</span><span class='id identifier rubyid_size'>size</span><span class='comma'>,</span> <span class='id identifier rubyid_count'>count</span><span class='rparen'>)</span>
|
1252
|
+
<span class='id identifier rubyid_ramp'>ramp</span> <span class='op'>=</span> <span class='float'>0.05</span>
|
1253
|
+
<span class='id identifier rubyid_ramp_point'>ramp_point</span> <span class='op'>=</span> <span class='ivar'>@max_amplitude</span> <span class='op'>/</span> <span class='id identifier rubyid_ramp'>ramp</span>
|
1254
|
+
<span class='id identifier rubyid_ampl'>ampl</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_count'>count</span> <span class='op'><</span> <span class='id identifier rubyid_ramp_point'>ramp_point</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='lparen'>(</span><span class='id identifier rubyid_ramp'>ramp</span> <span class='op'>*</span> <span class='id identifier rubyid_count'>count</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='ivar'>@max_amplitude</span>
|
1255
|
+
<span class='lparen'>(</span><span class='id identifier rubyid_count'>count</span> <span class='op'>></span> <span class='lparen'>(</span><span class='id identifier rubyid_size'>size</span> <span class='op'>-</span> <span class='id identifier rubyid_ramp_point'>ramp_point</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='lparen'>(</span><span class='id identifier rubyid_ramp'>ramp</span> <span class='op'>*</span> <span class='lparen'>(</span><span class='id identifier rubyid_size'>size</span> <span class='op'>-</span> <span class='id identifier rubyid_count'>count</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_ampl'>ampl</span>
|
1256
|
+
<span class='kw'>end</span></pre>
|
1257
|
+
</td>
|
1258
|
+
</tr>
|
1259
|
+
</table>
|
1260
|
+
</div>
|
1261
|
+
|
1262
|
+
<div class="method_details ">
|
1263
|
+
<h3 class="signature " id="generate-instance_method">
|
1264
|
+
|
1265
|
+
- (<tt>Object</tt>) <strong>generate</strong>(wrds)
|
1266
|
+
|
1267
|
+
|
1268
|
+
|
1269
|
+
|
1270
|
+
|
1271
|
+
</h3><table class="source_code">
|
1272
|
+
<tr>
|
1273
|
+
<td>
|
1274
|
+
<pre class="lines">
|
1275
|
+
|
1276
|
+
|
1277
|
+
35
|
1278
|
+
36
|
1279
|
+
37
|
1280
|
+
38
|
1281
|
+
39
|
1282
|
+
40
|
1283
|
+
41</pre>
|
1284
|
+
</td>
|
1285
|
+
<td>
|
1286
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 35</span>
|
1287
|
+
|
1288
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_generate'>generate</span> <span class='id identifier rubyid_wrds'>wrds</span>
|
1289
|
+
<span class='id identifier rubyid_word_parts'>word_parts</span><span class='lparen'>(</span><span class='id identifier rubyid_wrds'>wrds</span><span class='rparen'>)</span>
|
1290
|
+
<span class='comment'># progress.init elements.size * 3 + (wrds.size)
|
1291
|
+
</span> <span class='id identifier rubyid_create_element_methods'>create_element_methods</span>
|
1292
|
+
<span class='id identifier rubyid_compile_fundamentals'>compile_fundamentals</span>
|
1293
|
+
<span class='id identifier rubyid_write_word_parts'>write_word_parts</span>
|
1294
|
+
<span class='kw'>end</span></pre>
|
1295
|
+
</td>
|
1296
|
+
</tr>
|
1297
|
+
</table>
|
1298
|
+
</div>
|
1299
|
+
|
1300
|
+
<div class="method_details ">
|
1301
|
+
<h3 class="signature " id="generate_buffer-instance_method">
|
1302
|
+
|
1303
|
+
- (<tt>Object</tt>) <strong>generate_buffer</strong>(audio_samples, ele)
|
1304
|
+
|
1305
|
+
|
1306
|
+
|
1307
|
+
|
1308
|
+
|
1309
|
+
</h3><table class="source_code">
|
1310
|
+
<tr>
|
1311
|
+
<td>
|
1312
|
+
<pre class="lines">
|
1313
|
+
|
1314
|
+
|
1315
|
+
89
|
1316
|
+
90
|
1317
|
+
91</pre>
|
1318
|
+
</td>
|
1319
|
+
<td>
|
1320
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 89</span>
|
1321
|
+
|
1322
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_generate_buffer'>generate_buffer</span> <span class='id identifier rubyid_audio_samples'>audio_samples</span><span class='comma'>,</span> <span class='id identifier rubyid_ele'>ele</span>
|
1323
|
+
<span class='const'>WaveFile</span><span class='op'>::</span><span class='const'>Buffer</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_audio_samples'>audio_samples</span><span class='comma'>,</span> <span class='const'>WaveFile</span><span class='op'>::</span><span class='const'>Format</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:mono</span><span class='comma'>,</span> <span class='symbol'>:float</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_ele'>ele</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:spb</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1324
|
+
<span class='kw'>end</span></pre>
|
1325
|
+
</td>
|
1326
|
+
</tr>
|
1327
|
+
</table>
|
1328
|
+
</div>
|
1329
|
+
|
1330
|
+
<div class="method_details ">
|
1331
|
+
<h3 class="signature " id="generate_samples-instance_method">
|
1332
|
+
|
1333
|
+
- (<tt>Object</tt>) <strong>generate_samples</strong>(ele)
|
1334
|
+
|
1335
|
+
|
1336
|
+
|
1337
|
+
|
1338
|
+
|
1339
|
+
</h3><table class="source_code">
|
1340
|
+
<tr>
|
1341
|
+
<td>
|
1342
|
+
<pre class="lines">
|
1343
|
+
|
1344
|
+
|
1345
|
+
118
|
1346
|
+
119
|
1347
|
+
120
|
1348
|
+
121</pre>
|
1349
|
+
</td>
|
1350
|
+
<td>
|
1351
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 118</span>
|
1352
|
+
|
1353
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_generate_samples'>generate_samples</span> <span class='id identifier rubyid_ele'>ele</span>
|
1354
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_generate_space'>generate_space</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_ele'>ele</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:spb</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_space_sample?'>space_sample?</span> <span class='id identifier rubyid_ele'>ele</span>
|
1355
|
+
<span class='id identifier rubyid_generate_tone'>generate_tone</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_ele'>ele</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:spb</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_space_sample?'>space_sample?</span> <span class='id identifier rubyid_ele'>ele</span>
|
1356
|
+
<span class='kw'>end</span></pre>
|
1357
|
+
</td>
|
1358
|
+
</tr>
|
1359
|
+
</table>
|
1360
|
+
</div>
|
1361
|
+
|
1362
|
+
<div class="method_details ">
|
1363
|
+
<h3 class="signature " id="generate_space-instance_method">
|
1364
|
+
|
1365
|
+
- (<tt>Object</tt>) <strong>generate_space</strong>(number_of_samples)
|
1366
|
+
|
1367
|
+
|
1368
|
+
|
1369
|
+
|
1370
|
+
|
1371
|
+
</h3><table class="source_code">
|
1372
|
+
<tr>
|
1373
|
+
<td>
|
1374
|
+
<pre class="lines">
|
1375
|
+
|
1376
|
+
|
1377
|
+
66
|
1378
|
+
67
|
1379
|
+
68</pre>
|
1380
|
+
</td>
|
1381
|
+
<td>
|
1382
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 66</span>
|
1383
|
+
|
1384
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_generate_space'>generate_space</span> <span class='id identifier rubyid_number_of_samples'>number_of_samples</span>
|
1385
|
+
<span class='lbracket'>[</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_fill'>fill</span><span class='lparen'>(</span><span class='float'>0.0</span><span class='comma'>,</span> <span class='int'>0</span><span class='comma'>,</span> <span class='id identifier rubyid_number_of_samples'>number_of_samples</span><span class='rparen'>)</span>
|
1386
|
+
<span class='kw'>end</span></pre>
|
1387
|
+
</td>
|
1388
|
+
</tr>
|
1389
|
+
</table>
|
1390
|
+
</div>
|
1391
|
+
|
1392
|
+
<div class="method_details ">
|
1393
|
+
<h3 class="signature " id="generate_tone-instance_method">
|
1394
|
+
|
1395
|
+
- (<tt>Object</tt>) <strong>generate_tone</strong>(number_of_samples)
|
1396
|
+
|
1397
|
+
|
1398
|
+
|
1399
|
+
|
1400
|
+
|
1401
|
+
</h3><table class="source_code">
|
1402
|
+
<tr>
|
1403
|
+
<td>
|
1404
|
+
<pre class="lines">
|
1405
|
+
|
1406
|
+
|
1407
|
+
77
|
1408
|
+
78
|
1409
|
+
79
|
1410
|
+
80
|
1411
|
+
81
|
1412
|
+
82
|
1413
|
+
83
|
1414
|
+
84
|
1415
|
+
85
|
1416
|
+
86
|
1417
|
+
87</pre>
|
1418
|
+
</td>
|
1419
|
+
<td>
|
1420
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 77</span>
|
1421
|
+
|
1422
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_generate_tone'>generate_tone</span><span class='lparen'>(</span><span class='id identifier rubyid_number_of_samples'>number_of_samples</span><span class='rparen'>)</span>
|
1423
|
+
<span class='id identifier rubyid_position_in_period'>position_in_period</span><span class='comma'>,</span> <span class='id identifier rubyid_position_in_period_delta'>position_in_period_delta</span> <span class='op'>=</span> <span class='float'>0.0</span><span class='comma'>,</span> <span class='ivar'>@frequency</span> <span class='op'>/</span> <span class='ivar'>@sample_rate</span>
|
1424
|
+
<span class='id identifier rubyid_audio_samples'>audio_samples</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_fill'>fill</span><span class='lparen'>(</span><span class='float'>0.0</span><span class='comma'>,</span> <span class='int'>0</span><span class='comma'>,</span> <span class='id identifier rubyid_number_of_samples'>number_of_samples</span><span class='rparen'>)</span>
|
1425
|
+
<span class='id identifier rubyid_number_of_samples'>number_of_samples</span><span class='period'>.</span><span class='id identifier rubyid_times'>times</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_sample_number'>sample_number</span><span class='op'>|</span>
|
1426
|
+
<span class='id identifier rubyid_amplitude'>amplitude</span> <span class='op'>=</span> <span class='id identifier rubyid_filter_maybe'>filter_maybe</span><span class='lparen'>(</span><span class='id identifier rubyid_number_of_samples'>number_of_samples</span><span class='comma'>,</span> <span class='id identifier rubyid_sample_number'>sample_number</span><span class='rparen'>)</span>
|
1427
|
+
<span class='comment'># amplitude = 1.0 # @max_amplitude
|
1428
|
+
</span> <span class='id identifier rubyid_sine_radians'>sine_radians</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='lparen'>(</span><span class='ivar'>@frequency</span> <span class='op'>*</span> <span class='const'>TWO_PI</span><span class='rparen'>)</span> <span class='op'>/</span> <span class='ivar'>@sample_rate</span><span class='rparen'>)</span> <span class='op'>*</span> <span class='id identifier rubyid_sample_number'>sample_number</span>
|
1429
|
+
<span class='id identifier rubyid_audio_samples'>audio_samples</span><span class='lbracket'>[</span><span class='id identifier rubyid_sample_number'>sample_number</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_amplitude'>amplitude</span> <span class='op'>*</span> <span class='const'>Math</span><span class='period'>.</span><span class='id identifier rubyid_sin'>sin</span><span class='lparen'>(</span><span class='id identifier rubyid_sine_radians'>sine_radians</span><span class='rparen'>)</span>
|
1430
|
+
<span class='kw'>end</span>
|
1431
|
+
<span class='id identifier rubyid_audio_samples'>audio_samples</span>
|
1432
|
+
<span class='kw'>end</span></pre>
|
1433
|
+
</td>
|
1434
|
+
</tr>
|
1435
|
+
</table>
|
1436
|
+
</div>
|
1437
|
+
|
1438
|
+
<div class="method_details ">
|
1439
|
+
<h3 class="signature " id="last_element?-instance_method">
|
1440
|
+
|
1441
|
+
- (<tt>Boolean</tt>) <strong>last_element?</strong>(idx, chr)
|
1442
|
+
|
1443
|
+
|
1444
|
+
|
1445
|
+
|
1446
|
+
|
1447
|
+
</h3><div class="docstring">
|
1448
|
+
<div class="discussion">
|
1449
|
+
|
1450
|
+
|
1451
|
+
</div>
|
1452
|
+
</div>
|
1453
|
+
<div class="tags">
|
1454
|
+
|
1455
|
+
<p class="tag_title">Returns:</p>
|
1456
|
+
<ul class="return">
|
1457
|
+
|
1458
|
+
<li>
|
1459
|
+
|
1460
|
+
|
1461
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
1462
|
+
|
1463
|
+
|
1464
|
+
|
1465
|
+
</li>
|
1466
|
+
|
1467
|
+
</ul>
|
1468
|
+
|
1469
|
+
</div><table class="source_code">
|
1470
|
+
<tr>
|
1471
|
+
<td>
|
1472
|
+
<pre class="lines">
|
1473
|
+
|
1474
|
+
|
1475
|
+
136
|
1476
|
+
137
|
1477
|
+
138</pre>
|
1478
|
+
</td>
|
1479
|
+
<td>
|
1480
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 136</span>
|
1481
|
+
|
1482
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_last_element?'>last_element?</span> <span class='id identifier rubyid_idx'>idx</span><span class='comma'>,</span> <span class='id identifier rubyid_chr'>chr</span>
|
1483
|
+
<span class='id identifier rubyid_idx'>idx</span> <span class='op'>==</span> <span class='id identifier rubyid_chr'>chr</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span> <span class='op'>-</span> <span class='int'>1</span>
|
1484
|
+
<span class='kw'>end</span></pre>
|
1485
|
+
</td>
|
1486
|
+
</tr>
|
1487
|
+
</table>
|
1488
|
+
</div>
|
1489
|
+
|
1490
|
+
<div class="method_details ">
|
1491
|
+
<h3 class="signature " id="make_word_parts-instance_method">
|
1492
|
+
|
1493
|
+
- (<tt>Object</tt>) <strong>make_word_parts</strong>(words)
|
1494
|
+
|
1495
|
+
|
1496
|
+
|
1497
|
+
|
1498
|
+
|
1499
|
+
</h3><table class="source_code">
|
1500
|
+
<tr>
|
1501
|
+
<td>
|
1502
|
+
<pre class="lines">
|
1503
|
+
|
1504
|
+
|
1505
|
+
166
|
1506
|
+
167
|
1507
|
+
168
|
1508
|
+
169
|
1509
|
+
170
|
1510
|
+
171
|
1511
|
+
172
|
1512
|
+
173</pre>
|
1513
|
+
</td>
|
1514
|
+
<td>
|
1515
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 166</span>
|
1516
|
+
|
1517
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_make_word_parts'>make_word_parts</span> <span class='id identifier rubyid_words'>words</span>
|
1518
|
+
<span class='id identifier rubyid_parts'>parts</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
1519
|
+
<span class='ivar'>@word_parts</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_part'>part</span><span class='op'>|</span>
|
1520
|
+
<span class='comment'># progress.increment
|
1521
|
+
</span> <span class='id identifier rubyid_parts'>parts</span> <span class='op'>+=</span> <span class='id identifier rubyid_send_char'>send_char</span> <span class='id identifier rubyid_part'>part</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span>
|
1522
|
+
<span class='kw'>end</span>
|
1523
|
+
<span class='id identifier rubyid_parts'>parts</span>
|
1524
|
+
<span class='kw'>end</span></pre>
|
1525
|
+
</td>
|
1526
|
+
</tr>
|
1527
|
+
</table>
|
1528
|
+
</div>
|
1529
|
+
|
1530
|
+
<div class="method_details ">
|
1531
|
+
<h3 class="signature " id="play-instance_method">
|
1532
|
+
|
1533
|
+
- (<tt>Object</tt>) <strong>play</strong>
|
1534
|
+
|
1535
|
+
|
1536
|
+
|
1537
|
+
|
1538
|
+
|
1539
|
+
</h3><table class="source_code">
|
1540
|
+
<tr>
|
1541
|
+
<td>
|
1542
|
+
<pre class="lines">
|
1543
|
+
|
1544
|
+
|
1545
|
+
47
|
1546
|
+
48
|
1547
|
+
49
|
1548
|
+
50</pre>
|
1549
|
+
</td>
|
1550
|
+
<td>
|
1551
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 47</span>
|
1552
|
+
|
1553
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_play'>play</span>
|
1554
|
+
<span class='id identifier rubyid_cmd'>cmd</span> <span class='op'>=</span> <span class='id identifier rubyid_play_command'>play_command</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> </span><span class='tstring_end'>'</span></span> <span class='op'>+</span> <span class='id identifier rubyid_play_filename'>play_filename</span>
|
1555
|
+
<span class='ivar'>@pid</span> <span class='op'>=</span> <span class='op'>!</span> <span class='ivar'>@dry_run</span> <span class='op'>?</span> <span class='const'>Process</span><span class='period'>.</span><span class='id identifier rubyid_spawn'>spawn</span><span class='lparen'>(</span><span class='id identifier rubyid_cmd'>cmd</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_cmd'>cmd</span>
|
1556
|
+
<span class='kw'>end</span></pre>
|
1557
|
+
</td>
|
1558
|
+
</tr>
|
1559
|
+
</table>
|
1560
|
+
</div>
|
1561
|
+
|
1562
|
+
<div class="method_details ">
|
1563
|
+
<h3 class="signature " id="play_filename-instance_method">
|
1564
|
+
|
1565
|
+
- (<tt>Object</tt>) <strong>play_filename</strong>
|
1566
|
+
|
1567
|
+
|
1568
|
+
|
1569
|
+
|
1570
|
+
|
1571
|
+
</h3><table class="source_code">
|
1572
|
+
<tr>
|
1573
|
+
<td>
|
1574
|
+
<pre class="lines">
|
1575
|
+
|
1576
|
+
|
1577
|
+
43
|
1578
|
+
44
|
1579
|
+
45</pre>
|
1580
|
+
</td>
|
1581
|
+
<td>
|
1582
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 43</span>
|
1583
|
+
|
1584
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_play_filename'>play_filename</span>
|
1585
|
+
<span class='const'>HERE</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>audio/</span><span class='embexpr_beg'>#{</span><span class='const'>Params</span><span class='period'>.</span><span class='id identifier rubyid_audio_filename'>audio_filename</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
1586
|
+
<span class='kw'>end</span></pre>
|
1587
|
+
</td>
|
1588
|
+
</tr>
|
1589
|
+
</table>
|
1590
|
+
</div>
|
1591
|
+
|
1592
|
+
<div class="method_details ">
|
1593
|
+
<h3 class="signature " id="prepare_buffers-instance_method">
|
1594
|
+
|
1595
|
+
- (<tt>Object</tt>) <strong>prepare_buffers</strong>
|
1596
|
+
|
1597
|
+
|
1598
|
+
|
1599
|
+
|
1600
|
+
|
1601
|
+
</h3><table class="source_code">
|
1602
|
+
<tr>
|
1603
|
+
<td>
|
1604
|
+
<pre class="lines">
|
1605
|
+
|
1606
|
+
|
1607
|
+
175
|
1608
|
+
176
|
1609
|
+
177
|
1610
|
+
178
|
1611
|
+
179
|
1612
|
+
180
|
1613
|
+
181
|
1614
|
+
182
|
1615
|
+
183
|
1616
|
+
184
|
1617
|
+
185</pre>
|
1618
|
+
</td>
|
1619
|
+
<td>
|
1620
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 175</span>
|
1621
|
+
|
1622
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_prepare_buffers'>prepare_buffers</span>
|
1623
|
+
<span class='ivar'>@buffers</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1624
|
+
<span class='id identifier rubyid_elements'>elements</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_ele'>ele</span><span class='op'>|</span>
|
1625
|
+
<span class='comment'># progress.increment
|
1626
|
+
</span> <span class='ivar'>@buffers</span><span class='lbracket'>[</span><span class='id identifier rubyid_ele'>ele</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
1627
|
+
<span class='const'>WaveFile</span><span class='op'>::</span><span class='const'>Reader</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_ele'>ele</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:filename</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span>
|
1628
|
+
<span class='id identifier rubyid_each_buffer'>each_buffer</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_ele'>ele</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:spb</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_buffer'>buffer</span><span class='op'>|</span>
|
1629
|
+
<span class='ivar'>@buffers</span><span class='lbracket'>[</span><span class='id identifier rubyid_ele'>ele</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_buffer'>buffer</span>
|
1630
|
+
<span class='kw'>end</span>
|
1631
|
+
<span class='kw'>end</span>
|
1632
|
+
<span class='kw'>end</span></pre>
|
1633
|
+
</td>
|
1634
|
+
</tr>
|
1635
|
+
</table>
|
1636
|
+
</div>
|
1637
|
+
|
1638
|
+
<div class="method_details ">
|
1639
|
+
<h3 class="signature " id="progress-instance_method">
|
1640
|
+
|
1641
|
+
- (<tt>Object</tt>) <strong>progress</strong>
|
1642
|
+
|
1643
|
+
|
1644
|
+
|
1645
|
+
|
1646
|
+
|
1647
|
+
</h3><table class="source_code">
|
1648
|
+
<tr>
|
1649
|
+
<td>
|
1650
|
+
<pre class="lines">
|
1651
|
+
|
1652
|
+
|
1653
|
+
31
|
1654
|
+
32
|
1655
|
+
33</pre>
|
1656
|
+
</td>
|
1657
|
+
<td>
|
1658
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 31</span>
|
1659
|
+
|
1660
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_progress'>progress</span>
|
1661
|
+
<span class='ivar'>@progress</span> <span class='op'>||=</span> <span class='const'>Progress</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Compiling</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
1662
|
+
<span class='kw'>end</span></pre>
|
1663
|
+
</td>
|
1664
|
+
</tr>
|
1665
|
+
</table>
|
1666
|
+
</div>
|
1667
|
+
|
1668
|
+
<div class="method_details ">
|
1669
|
+
<h3 class="signature " id="push_enc-instance_method">
|
1670
|
+
|
1671
|
+
- (<tt>Object</tt>) <strong>push_enc</strong>(chr)
|
1672
|
+
|
1673
|
+
|
1674
|
+
|
1675
|
+
|
1676
|
+
|
1677
|
+
</h3><table class="source_code">
|
1678
|
+
<tr>
|
1679
|
+
<td>
|
1680
|
+
<pre class="lines">
|
1681
|
+
|
1682
|
+
|
1683
|
+
140
|
1684
|
+
141
|
1685
|
+
142
|
1686
|
+
143
|
1687
|
+
144
|
1688
|
+
145
|
1689
|
+
146
|
1690
|
+
147</pre>
|
1691
|
+
</td>
|
1692
|
+
<td>
|
1693
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 140</span>
|
1694
|
+
|
1695
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_push_enc'>push_enc</span> <span class='id identifier rubyid_chr'>chr</span>
|
1696
|
+
<span class='id identifier rubyid_arry'>arry</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
1697
|
+
<span class='id identifier rubyid_chr'>chr</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='comma'>,</span><span class='id identifier rubyid_idx'>idx</span><span class='op'>|</span>
|
1698
|
+
<span class='id identifier rubyid_arry'>arry</span> <span class='op'><<</span> <span class='id identifier rubyid_c'>c</span>
|
1699
|
+
<span class='id identifier rubyid_arry'>arry</span> <span class='op'><<</span> <span class='lparen'>(</span><span class='lparen'>(</span><span class='id identifier rubyid_last_element?'>last_element?</span><span class='lparen'>(</span><span class='id identifier rubyid_idx'>idx</span><span class='comma'>,</span> <span class='id identifier rubyid_chr'>chr</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='lparen'>(</span><span class='id identifier rubyid_space_or_espace'>space_or_espace</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_space'>space</span><span class='rparen'>)</span>
|
1700
|
+
<span class='kw'>end</span>
|
1701
|
+
<span class='id identifier rubyid_arry'>arry</span> <span class='op'>+=</span> <span class='id identifier rubyid_char_space'>char_space</span>
|
1702
|
+
<span class='kw'>end</span></pre>
|
1703
|
+
</td>
|
1704
|
+
</tr>
|
1705
|
+
</table>
|
1706
|
+
</div>
|
1707
|
+
|
1708
|
+
<div class="method_details ">
|
1709
|
+
<h3 class="signature " id="reset-instance_method">
|
1710
|
+
|
1711
|
+
- (<tt>Object</tt>) <strong>reset</strong>
|
1712
|
+
|
1713
|
+
|
1714
|
+
|
1715
|
+
|
1716
|
+
|
1717
|
+
</h3><table class="source_code">
|
1718
|
+
<tr>
|
1719
|
+
<td>
|
1720
|
+
<pre class="lines">
|
1721
|
+
|
1722
|
+
|
1723
|
+
215
|
1724
|
+
216
|
1725
|
+
217
|
1726
|
+
218</pre>
|
1727
|
+
</td>
|
1728
|
+
<td>
|
1729
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 215</span>
|
1730
|
+
|
1731
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_reset'>reset</span>
|
1732
|
+
<span class='ivar'>@word_parts</span> <span class='op'>=</span> <span class='ivar'>@progress</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
1733
|
+
<span class='comment'># puts "\r"
|
1734
|
+
</span><span class='kw'>end</span></pre>
|
1735
|
+
</td>
|
1736
|
+
</tr>
|
1737
|
+
</table>
|
1738
|
+
</div>
|
1739
|
+
|
1740
|
+
<div class="method_details ">
|
1741
|
+
<h3 class="signature " id="send_char-instance_method">
|
1742
|
+
|
1743
|
+
- (<tt>Object</tt>) <strong>send_char</strong>(c)
|
1744
|
+
|
1745
|
+
|
1746
|
+
|
1747
|
+
|
1748
|
+
|
1749
|
+
</h3><table class="source_code">
|
1750
|
+
<tr>
|
1751
|
+
<td>
|
1752
|
+
<pre class="lines">
|
1753
|
+
|
1754
|
+
|
1755
|
+
149
|
1756
|
+
150
|
1757
|
+
151
|
1758
|
+
152
|
1759
|
+
153
|
1760
|
+
154
|
1761
|
+
155
|
1762
|
+
156</pre>
|
1763
|
+
</td>
|
1764
|
+
<td>
|
1765
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 149</span>
|
1766
|
+
|
1767
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_send_char'>send_char</span> <span class='id identifier rubyid_c'>c</span>
|
1768
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_c'>c</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> </span><span class='tstring_end'>'</span></span>
|
1769
|
+
<span class='id identifier rubyid_enc'>enc</span> <span class='op'>=</span> <span class='id identifier rubyid_word_space'>word_space</span>
|
1770
|
+
<span class='kw'>else</span>
|
1771
|
+
<span class='id identifier rubyid_enc'>enc</span> <span class='op'>=</span> <span class='id identifier rubyid_cw_encoding'>cw_encoding</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='id identifier rubyid_c'>c</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_enc'>enc</span><span class='op'>|</span> <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_enc'>enc</span><span class='rparen'>)</span><span class='rbrace'>}</span>
|
1772
|
+
<span class='kw'>end</span>
|
1773
|
+
<span class='id identifier rubyid_push_enc'>push_enc</span> <span class='id identifier rubyid_enc'>enc</span>
|
1774
|
+
<span class='kw'>end</span></pre>
|
1775
|
+
</td>
|
1776
|
+
</tr>
|
1777
|
+
</table>
|
1778
|
+
</div>
|
1779
|
+
|
1780
|
+
<div class="method_details ">
|
1781
|
+
<h3 class="signature " id="space_or_espace-instance_method">
|
1782
|
+
|
1783
|
+
- (<tt>Object</tt>) <strong>space_or_espace</strong>
|
1784
|
+
|
1785
|
+
|
1786
|
+
|
1787
|
+
|
1788
|
+
|
1789
|
+
</h3><table class="source_code">
|
1790
|
+
<tr>
|
1791
|
+
<td>
|
1792
|
+
<pre class="lines">
|
1793
|
+
|
1794
|
+
|
1795
|
+
132
|
1796
|
+
133
|
1797
|
+
134</pre>
|
1798
|
+
</td>
|
1799
|
+
<td>
|
1800
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 132</span>
|
1801
|
+
|
1802
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_space_or_espace'>space_or_espace</span>
|
1803
|
+
<span class='lparen'>(</span><span class='ivar'>@effective_wpm</span> <span class='op'>==</span> <span class='ivar'>@wpm</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_space'>space</span> <span class='op'>:</span> <span class='id identifier rubyid_e_space'>e_space</span>
|
1804
|
+
<span class='kw'>end</span></pre>
|
1805
|
+
</td>
|
1806
|
+
</tr>
|
1807
|
+
</table>
|
1808
|
+
</div>
|
1809
|
+
|
1810
|
+
<div class="method_details ">
|
1811
|
+
<h3 class="signature " id="space_sample?-instance_method">
|
1812
|
+
|
1813
|
+
- (<tt>Boolean</tt>) <strong>space_sample?</strong>(ele)
|
1814
|
+
|
1815
|
+
|
1816
|
+
|
1817
|
+
|
1818
|
+
|
1819
|
+
</h3><div class="docstring">
|
1820
|
+
<div class="discussion">
|
1821
|
+
|
1822
|
+
|
1823
|
+
</div>
|
1824
|
+
</div>
|
1825
|
+
<div class="tags">
|
1826
|
+
|
1827
|
+
<p class="tag_title">Returns:</p>
|
1828
|
+
<ul class="return">
|
1829
|
+
|
1830
|
+
<li>
|
1831
|
+
|
1832
|
+
|
1833
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
1834
|
+
|
1835
|
+
|
1836
|
+
|
1837
|
+
</li>
|
1838
|
+
|
1839
|
+
</ul>
|
1840
|
+
|
1841
|
+
</div><table class="source_code">
|
1842
|
+
<tr>
|
1843
|
+
<td>
|
1844
|
+
<pre class="lines">
|
1845
|
+
|
1846
|
+
|
1847
|
+
114
|
1848
|
+
115
|
1849
|
+
116</pre>
|
1850
|
+
</td>
|
1851
|
+
<td>
|
1852
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 114</span>
|
1853
|
+
|
1854
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_space_sample?'>space_sample?</span> <span class='id identifier rubyid_ele'>ele</span>
|
1855
|
+
<span class='id identifier rubyid_ele'>ele</span> <span class='op'>==</span> <span class='symbol'>:space</span> <span class='op'>||</span> <span class='id identifier rubyid_ele'>ele</span> <span class='op'>==</span> <span class='symbol'>:e_space</span>
|
1856
|
+
<span class='kw'>end</span></pre>
|
1857
|
+
</td>
|
1858
|
+
</tr>
|
1859
|
+
</table>
|
1860
|
+
</div>
|
1861
|
+
|
1862
|
+
<div class="method_details ">
|
1863
|
+
<h3 class="signature " id="word_composite-instance_method">
|
1864
|
+
|
1865
|
+
- (<tt>Object</tt>) <strong>word_composite</strong>(word)
|
1866
|
+
|
1867
|
+
|
1868
|
+
|
1869
|
+
|
1870
|
+
|
1871
|
+
</h3><table class="source_code">
|
1872
|
+
<tr>
|
1873
|
+
<td>
|
1874
|
+
<pre class="lines">
|
1875
|
+
|
1876
|
+
|
1877
|
+
200
|
1878
|
+
201
|
1879
|
+
202</pre>
|
1880
|
+
</td>
|
1881
|
+
<td>
|
1882
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 200</span>
|
1883
|
+
|
1884
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_word_composite'>word_composite</span> <span class='id identifier rubyid_word'>word</span>
|
1885
|
+
<span class='id identifier rubyid_send_char'>send_char</span> <span class='id identifier rubyid_word'>word</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span>
|
1886
|
+
<span class='kw'>end</span></pre>
|
1887
|
+
</td>
|
1888
|
+
</tr>
|
1889
|
+
</table>
|
1890
|
+
</div>
|
1891
|
+
|
1892
|
+
<div class="method_details ">
|
1893
|
+
<h3 class="signature " id="word_parts-instance_method">
|
1894
|
+
|
1895
|
+
- (<tt>Object</tt>) <strong>word_parts</strong>(str = nil)
|
1896
|
+
|
1897
|
+
|
1898
|
+
|
1899
|
+
|
1900
|
+
|
1901
|
+
</h3><table class="source_code">
|
1902
|
+
<tr>
|
1903
|
+
<td>
|
1904
|
+
<pre class="lines">
|
1905
|
+
|
1906
|
+
|
1907
|
+
158
|
1908
|
+
159
|
1909
|
+
160
|
1910
|
+
161
|
1911
|
+
162
|
1912
|
+
163</pre>
|
1913
|
+
</td>
|
1914
|
+
<td>
|
1915
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 158</span>
|
1916
|
+
|
1917
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_word_parts'>word_parts</span> <span class='id identifier rubyid_str'>str</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
1918
|
+
<span class='kw'>return</span> <span class='ivar'>@word_parts</span> <span class='kw'>if</span> <span class='ivar'>@word_parts</span>
|
1919
|
+
<span class='ivar'>@word_parts</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
1920
|
+
<span class='id identifier rubyid_str'>str</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_part'>part</span><span class='op'>|</span> <span class='ivar'>@word_parts</span> <span class='op'><<</span> <span class='id identifier rubyid_part'>part</span><span class='rbrace'>}</span>
|
1921
|
+
<span class='ivar'>@word_parts</span>
|
1922
|
+
<span class='kw'>end</span></pre>
|
1923
|
+
</td>
|
1924
|
+
</tr>
|
1925
|
+
</table>
|
1926
|
+
</div>
|
1927
|
+
|
1928
|
+
<div class="method_details ">
|
1929
|
+
<h3 class="signature " id="word_space-instance_method">
|
1930
|
+
|
1931
|
+
- (<tt>Object</tt>) <strong>word_space</strong>
|
1932
|
+
|
1933
|
+
|
1934
|
+
|
1935
|
+
|
1936
|
+
|
1937
|
+
</h3><table class="source_code">
|
1938
|
+
<tr>
|
1939
|
+
<td>
|
1940
|
+
<pre class="lines">
|
1941
|
+
|
1942
|
+
|
1943
|
+
196
|
1944
|
+
197
|
1945
|
+
198</pre>
|
1946
|
+
</td>
|
1947
|
+
<td>
|
1948
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 196</span>
|
1949
|
+
|
1950
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_word_space'>word_space</span>
|
1951
|
+
<span class='ivar'>@effective_wpm</span> <span class='op'>==</span> <span class='ivar'>@wpm</span> <span class='op'>?</span> <span class='lbracket'>[</span><span class='id identifier rubyid_space'>space</span><span class='rbracket'>]</span> <span class='op'>:</span> <span class='lbracket'>[</span><span class='id identifier rubyid_e_space'>e_space</span><span class='rbracket'>]</span>
|
1952
|
+
<span class='kw'>end</span></pre>
|
1953
|
+
</td>
|
1954
|
+
</tr>
|
1955
|
+
</table>
|
1956
|
+
</div>
|
1957
|
+
|
1958
|
+
<div class="method_details ">
|
1959
|
+
<h3 class="signature " id="write_audio-instance_method">
|
1960
|
+
|
1961
|
+
- (<tt>Object</tt>) <strong>write_audio</strong>
|
1962
|
+
|
1963
|
+
|
1964
|
+
|
1965
|
+
|
1966
|
+
|
1967
|
+
</h3><table class="source_code">
|
1968
|
+
<tr>
|
1969
|
+
<td>
|
1970
|
+
<pre class="lines">
|
1971
|
+
|
1972
|
+
|
1973
|
+
204
|
1974
|
+
205
|
1975
|
+
206
|
1976
|
+
207
|
1977
|
+
208
|
1978
|
+
209
|
1979
|
+
210
|
1980
|
+
211
|
1981
|
+
212
|
1982
|
+
213</pre>
|
1983
|
+
</td>
|
1984
|
+
<td>
|
1985
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 204</span>
|
1986
|
+
|
1987
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_write_audio'>write_audio</span>
|
1988
|
+
<span class='const'>WaveFile</span><span class='op'>::</span><span class='const'>Writer</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_play_filename'>play_filename</span><span class='comma'>,</span> <span class='const'>WaveFile</span><span class='op'>::</span><span class='const'>Format</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:mono</span><span class='comma'>,</span> <span class='symbol'>:pcm_16</span><span class='comma'>,</span> <span class='ivar'>@sample_rate</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_writer'>writer</span><span class='op'>|</span>
|
1989
|
+
<span class='kw'>yield</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_char'>char</span><span class='op'>|</span>
|
1990
|
+
<span class='comment'># progress.increment
|
1991
|
+
</span> <span class='id identifier rubyid_char'>char</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_fta'>fta</span><span class='op'>|</span>
|
1992
|
+
<span class='id identifier rubyid_writer'>writer</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='ivar'>@buffers</span><span class='lbracket'>[</span><span class='id identifier rubyid_fta'>fta</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1993
|
+
<span class='kw'>end</span>
|
1994
|
+
<span class='kw'>end</span>
|
1995
|
+
<span class='kw'>end</span>
|
1996
|
+
<span class='kw'>end</span></pre>
|
1997
|
+
</td>
|
1998
|
+
</tr>
|
1999
|
+
</table>
|
2000
|
+
</div>
|
2001
|
+
|
2002
|
+
<div class="method_details ">
|
2003
|
+
<h3 class="signature " id="write_audio_file-instance_method">
|
2004
|
+
|
2005
|
+
- (<tt>Object</tt>) <strong>write_audio_file</strong>
|
2006
|
+
|
2007
|
+
|
2008
|
+
|
2009
|
+
|
2010
|
+
|
2011
|
+
</h3><table class="source_code">
|
2012
|
+
<tr>
|
2013
|
+
<td>
|
2014
|
+
<pre class="lines">
|
2015
|
+
|
2016
|
+
|
2017
|
+
220
|
2018
|
+
221
|
2019
|
+
222
|
2020
|
+
223</pre>
|
2021
|
+
</td>
|
2022
|
+
<td>
|
2023
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 220</span>
|
2024
|
+
|
2025
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_write_audio_file'>write_audio_file</span>
|
2026
|
+
<span class='id identifier rubyid_write_audio'>write_audio</span> <span class='lbrace'>{</span> <span class='ivar'>@word_parts</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_part'>part</span><span class='op'>|</span> <span class='id identifier rubyid_word_composite'>word_composite</span><span class='lparen'>(</span><span class='id identifier rubyid_part'>part</span><span class='rparen'>)</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span>
|
2027
|
+
<span class='id identifier rubyid_reset'>reset</span>
|
2028
|
+
<span class='kw'>end</span></pre>
|
2029
|
+
</td>
|
2030
|
+
</tr>
|
2031
|
+
</table>
|
2032
|
+
</div>
|
2033
|
+
|
2034
|
+
<div class="method_details ">
|
2035
|
+
<h3 class="signature " id="write_element_audio_file-instance_method">
|
2036
|
+
|
2037
|
+
- (<tt>Object</tt>) <strong>write_element_audio_file</strong>(ele, buffer)
|
2038
|
+
|
2039
|
+
|
2040
|
+
|
2041
|
+
|
2042
|
+
|
2043
|
+
</h3><table class="source_code">
|
2044
|
+
<tr>
|
2045
|
+
<td>
|
2046
|
+
<pre class="lines">
|
2047
|
+
|
2048
|
+
|
2049
|
+
93
|
2050
|
+
94
|
2051
|
+
95
|
2052
|
+
96
|
2053
|
+
97</pre>
|
2054
|
+
</td>
|
2055
|
+
<td>
|
2056
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 93</span>
|
2057
|
+
|
2058
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_write_element_audio_file'>write_element_audio_file</span> <span class='id identifier rubyid_ele'>ele</span><span class='comma'>,</span> <span class='id identifier rubyid_buffer'>buffer</span>
|
2059
|
+
<span class='const'>WaveFile</span><span class='op'>::</span><span class='const'>Writer</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='lbracket'>[</span><span class='id identifier rubyid_ele'>ele</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:filename</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='const'>WaveFile</span><span class='op'>::</span><span class='const'>Format</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:mono</span><span class='comma'>,</span> <span class='symbol'>:pcm_16</span><span class='comma'>,</span> <span class='ivar'>@sample_rate</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_writer'>writer</span><span class='op'>|</span>
|
2060
|
+
<span class='id identifier rubyid_writer'>writer</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_buffer'>buffer</span><span class='rparen'>)</span>
|
2061
|
+
<span class='kw'>end</span>
|
2062
|
+
<span class='kw'>end</span></pre>
|
2063
|
+
</td>
|
2064
|
+
</tr>
|
2065
|
+
</table>
|
2066
|
+
</div>
|
2067
|
+
|
2068
|
+
<div class="method_details ">
|
2069
|
+
<h3 class="signature " id="write_word_parts-instance_method">
|
2070
|
+
|
2071
|
+
- (<tt>Object</tt>) <strong>write_word_parts</strong>
|
2072
|
+
|
2073
|
+
|
2074
|
+
|
2075
|
+
|
2076
|
+
|
2077
|
+
</h3><table class="source_code">
|
2078
|
+
<tr>
|
2079
|
+
<td>
|
2080
|
+
<pre class="lines">
|
2081
|
+
|
2082
|
+
|
2083
|
+
187
|
2084
|
+
188
|
2085
|
+
189
|
2086
|
+
190</pre>
|
2087
|
+
</td>
|
2088
|
+
<td>
|
2089
|
+
<pre class="code"><span class="info file"># File 'lib/cw/tone_generator.rb', line 187</span>
|
2090
|
+
|
2091
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_write_word_parts'>write_word_parts</span>
|
2092
|
+
<span class='id identifier rubyid_prepare_buffers'>prepare_buffers</span>
|
2093
|
+
<span class='id identifier rubyid_write_audio_file'>write_audio_file</span>
|
2094
|
+
<span class='kw'>end</span></pre>
|
2095
|
+
</td>
|
2096
|
+
</tr>
|
2097
|
+
</table>
|
2098
|
+
</div>
|
2099
|
+
|
2100
|
+
</div>
|
2101
|
+
|
2102
|
+
</div>
|
2103
|
+
|
2104
|
+
<div id="footer">
|
2105
|
+
Generated on Mon May 23 21:20:17 2016 by
|
2106
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
2107
|
+
0.8.7.6 (ruby-2.2.0).
|
2108
|
+
</div>
|
2109
|
+
|
2110
|
+
</body>
|
2111
|
+
</html>
|