Audio-Beep-0.07 > 0.10 との差分

Audio::Beep 0.10 と 0.07 の差分

11
22=encoding euc-jp
33
44=head1 名前
55
66Audio::Beep - 素敵な方法で、コンピュータの警報機を使うモジュール
77
88=head1 概要
99
1010 #関数的な簡単なやりかた
1111 use Audio::Beep;
1212
1313 beep($freq, $milliseconds);
1414
1515 #オブジェクト指向的なより音楽的なやりかた
1616 use Audio::Beep;
1717
1818 my $beeper = Audio::Beep->new();
1919
2020 # lilypond サブセット文法が受け入れられます。
2121 # 相対的な記法がデフォルトです。
2222 # (今現在実装されています)
2323 my $music = "g' f bes' c8 f d4 c8 f d4 bes c g f2";
2424 # モデスト・ムソルグスキーの「展覧会の絵」
2525
2626 $beeper->play( $music );
2727
2828=head1 使用法
2929
3030=head2 export される関数
3131
3232=over 4
3333
3434=item beep([FREQUENCY], [DURATION]);
3535
3636Plays a customizable beep out of your computer beeper.
3737
3838カスタマイズできるビープ音を、コンピュータの警報機で再生します。
3939
4040FREQUENCY is in Hz. Defaults to 440.
4141
4242FREQUENCY は、Hz で、デフォルトは、440です。
4343
4444DURATION is in milliseconds. Defaults to 100.
4545
4646DURATION は、ミリ秒で、デフォルトは100です。
4747
4848=back
4949
5050=head2 オブジェクト指向メソッド
5151
5252=over 4
5353
5454=item Audio::Beep->new([%options])
5555
5656Returns a new "beeper" object. Follows the available
5757options for the new method to be passed in hash fashion.
5858
5959新しい"beeper" オブジェクトを返します。
6060new メソッドには、下記のオプションがハッシュのかたちで渡されます。
6161
6262=back
6363
6464=over 8
6565
6666=item player => [player object | player module]
6767
6868You can initialize your player object and then give it to the
6969Audio::Beep object.
7070Player objects come from Audio::Beep submodules (like
7171Audio::Beep::Linux::beep).
7272
7373演奏オブジェクトを初期化でき、それから、
7474Audio::Beep オブジェクトに、演奏オブジェクトを渡せます。
7575演奏オブジェクトは Audio::Beep サブモジュール(Audio::Beep::Linux::Beepのような)からもたらされます。
7676
7777If you're lazy (as any good programmer should be)
7878you can give a string as a player,
7979like C<"Audio::Beep::Linux::PP"> or even just C<"Linux::PP">: the method
8080will prepend the C<Audio::Beep> namespace, require the module and call
8181the new method on it for you.
8282The new method will try to look up the best player
8383on your platform if you don't specify one.
8484So the following is all valid:
8585
8686もし、あなたが怠惰なら(どんなよいプログラマはそうあるべきように)、player として、
8787C<"Audio::Beep::Linux::PP">か、ただ、C<"Linux::PP">のような文字列をあたえることができます:
8888メソッドはC<"Audio::Beep">名前空間を先頭に付け加え(訳註:prepend)し、
8989そのモジュールを require し、new メソッドをその上で呼び出します。
9090
9191 use Audio::Beep;
9292
9393 #とても怠惰 (通常、正しいことを行うべきです)
9494 my $beeper = Audio::Beep->new();
9595
9696 #まだ怠惰。
9797 my $beeper2 = Audio::Beep->new(player => 'Linux::PP');
9898
9999 #なかなか怠惰。
100100 my $beeper3 = Audio::Beep->new(
101101 player => 'Audio::Beep::Win32::API'
102102 );
103103
104104 #怠惰じゃないが、より可変性がある。
105105 require Audio::Beep::Linux::beep;
106106 my $beeper4 = Audio::Beep->new(
107107 player => Audio::Beep::Linux::beep->new(
108108 path => '/home/foo/bin/beep/'
109109 )
110110 );
111111
112112
113113=item rest => [ms]
114114
115115Sets the rest in milliseconds between every sound played (and
116116even pause). This is useful for users which computer beeper has problems
117117and would just stick to the first sound played.
118118For example on my PowerbookG3 i have to set this around 120 milliseconds.
119119In that way i can still hear some music. Otherwise is just a long single beep.
120120
121121演奏されるサウンド(とポーズ)ごとに、ミリ秒の休憩をセットします。
122122このことは、問題のあるコンピュータの警報機のユーザ -
123123演奏される最初の音を突き刺すような - にとって、有益です。
124124たとえば、私の PowerbookGCで は、120ミリ秒あたりをセットしなければなりません。
125125このようにすれば、まだ、音楽を聞くことができます。
126126さもなくば、長い単一のビープになります。
127127
128128=back
129129
130130=over 4
131131
132132=item $beeper->play( $music )
133133
134134Plays the "music" written in $music.
135135The accepted format is a subset of lilypond.org syntax.
136136The string is a space separated list of notes to play.
137137See the NOTATION section below for more info.
138138
139139$music にかかれた"音楽"を演奏します。
140140受け入れるフォーマットは lilypond.org の文法のサブセットです。
141141文字列はスペースで分割された演奏する音符のリストです。
142142詳しくは、後述の記法のセクションを見て下さい。
143143
144144=item $beeper->player( [player] )
145145
146146Sets the player object that will be used to play your music.
147147See the player option above at the C<new> method for more info.
148148With no parameter it just gives you back the current player.
149149
150150音楽を演奏するのに使った演奏オブジェクトをセットします。
151151詳しくは、上述のC<new>メソッドの player オプションを見て下さい。
152152パラメータをあたえなければ、現在の player を戻します。
153153
154154=item $beeper->rest( [ms] )
155155
156156Sets the extra rest between each note.
157157See the rest option above at the C<new> method for more info.
158158With no parameter it gives you back the current rest.
159159
160160それぞれの音符の間に特別の休憩をセットします。
161161詳しくは、上述のC<new>メソッドの rest オプションを見て下さい。
162162パラメータをあたえなければ、現在の rest を戻します。
163163
164164=back
165165
166166=head1 記法
167167
168168The defaults at start are middle octave C and a quarter length.
169169Standard notation is the relative notation.
170170Here is an explanation from Lilypond documentation:
171171
172172最初のデフォルトは、中間のオクターブのドで、1/4長です。
173173標準の記法は相対的な記法です。Lilypond ドキュメントにある説明です;
174174
175175 If no octave changing marks are used, the basic interval between
176176 this and the last note is always taken to be a fourth or less
177177 (This distance is determined without regarding alterations;
178178 a fisis following a ceses will be put above the ceses)
179179
180180 もし、オクターブを変更するマークが使われなければ、
181181 これと最後の音符の間の基本的な間隔は常に1/4かより少なくなります。
182182 (この間隔は変更に注意せずに決定されます;
183183 a fisis following a ceses will be put above the ceses)
184184
185185 The octave changing marks ' and , can be added to raise or lower
186186 the pitch by an extra octave.
187187
188188 オクターブを変更するマークは ' で、特別なオクターブでピッチをあげたり下げたり
189189 できます。
190190
191191You can switch from relative to non relative notation (in which you specify for
192192every note the octave) using the C<\norel> and C<\rel> commands (see below)
193193
194194C<\norel>と、C<\rel> コマンド(後述)を使って、相対から相対でない記法にスイッチできます
195195(音符ごとにオクターブを特定します)。
196196
197197=head2 音符
198198
199199Every note has the following structure:
200200
201201全ての音符には下記の構造があります。
202202
203203 [note][flat|sharp][octave][duration][dots]
204204
205205 [音符][フラット|シャープ][オクターブ][長さ][ドット]
206206
207207NB: previous note duration is used if omitted.
208208"Flatness", "Sharpness" and "Dottiness" are reset after each note.
209209
210210注意:省略されると前の音符の持続時間が使われます。
211211"Flatness"と、"Sharpness"と、"Dottiness" は、音符ごとにリセットされます。
212212
213213=over 4
214214
215215=item note
216216
217217A note can be any of [c d e f g a b] or [r] for rest.
218218
219219音符は[c d e f g a b] か、休符の[r] のどれかです。
220220
221221=item flat or sharp
222222
223223A sharp note is produced postponing a "is" to the note itself
224224(like "cis" for a C#).
225225
226226シャープの音符は、"is"を音符の後に置くことで、作れます。
227227(C#のために、"cis"のようにします)
228228
229229A flat note is produced adding a "es" or "s"
230230(so "aes" and "as" are both an A flat).
231231
232232フラットの音符は、"es"か、"s"を音符の後に置くことで、作れます。
233233("aes"と、"as"は、どちらもAフラットです)
234234
235235=item octave
236236
237237A ' (apostrophe) raise one octave, while a , (comma) lower it.
238238
239239'(アポストロフィ) は、オクターブをひとつあげます。
240240一方、,(カンマ)は、オクターブをひとつ下げます。
241241
242242=item duration
243243
244244A duration is expressed with a number.
245245A 4 is a beat, a 1 is a whole 4/4 measure. Higher the number, shorter the note.
246246
247247duration は、数字で表します。
2482484 は、ビートで、1 は、まったく4/4の長さです。
249249数字が高ければ高いほど、音符は短くなります。
250250
251251=item dots
252252
253253You can add dots after the duration number to add half its length.
254254So a4. is an A note long 1/4 + 1/8 and gis2.. is a G# long 7/8 (1/2 + 1/4 + 1/8)
255255
256256durationの数字の後に、ドットを加えることができ、その長さの半分を加えることができます。
257257a4. でしたら、ラの 1/4 + 1/8 の長さの音符ですし、gis2 は、ソ# 8/7(1/2 + 1/4 + 1/8)の長さです。
258258
259259=item 特記: "r"
260260
261261A r note means a rest. You can still use duration and dots parameters.
262262
263263r 音符は、休符を意味します。duration と、dots のパラメタを使うことができます。
264264
265265=back
266266
267267=head2 特別なコマンド
268268
269269Special commands always begin with a "\". They change the behavior of the
270270parser or the music played. Unlike in the Lilypond original syntax, these
271271commands are embedded between notes so they have a slightly different syntax.
272272
273273特別なコマンドは常に、"\" で始まります。
274274パーサか、演奏される音楽の振る舞いを変更します。Lilypondのオリジナルの文法とは違って、
275275これらのコマンドは音符の間に埋め込まれます。それで、少々違った文法になっています。
276276
277277=over 4
278278
279279=item \bpm(\d+)
280280
281281You can use this option to change the tempo of the music.
282282The only parameter you can use is a number following the bpm string
283283(like "bpm144").
284284BPM stands for Beats Per Minute.
285285The default is 120 BPM.
286286You can also invoke this command as C<\tempo>
287287
288288このオプションを使って、音楽のテンポを変更できます。
289289使うパラメタは、bpmの後に数字が続く文字列です("bpm144"のような)。
290290BPM は、Beats Per Minute を意味します。デフォルトは 120 BPM です。
291291C<\tempo> のようなコマンドで、呼び出すこともできます。
292292
293293=item \norel
294294
295295Switches the relative mode off. From here afterward you have to always specify
296296the octave where the note is.
297297
298298相対モードをオフにするスイッチです。
299299ここから後は、いつも、音符がある場所のオクターブを特定する必要があります。
300300
301301=item \rel
302302
303303Switches the relative mode on. This is the default.
304304
305305相対モードをオンにするスイッチです。これはデフォルトです。
306306
307307=item \transpose([',]+)
308308
309309You can transpose all your music up or down some octave.
310310' (apostrophe) raise octave. , (comma) lowers it. This has effect just
311311if you are in non-relative mode.
312312
313313全ての音楽のオクターブをいくつか上げるか下げるか置き換えます。
314314'(アポストロフィ)はオクターブを上げます。,(comma)はオクターブを下げます。
315315相対モードでないモードでだけ、これは効果があります。
316316
317317=back
318318
319319=head2 コメント
320320
321321You can embed comments in your music the Perl way. Everything after a #
322will be ignored until end of file
322will be ignored
323323
324音楽にPerlの方法でコメントを埋め込めます。
324音楽にPerlの方法でコメントを埋め込めます。 #の後の全てのものは無視されます。
325ファイルの最後まで、#の後の全てのものは無視されます。
326325
327326=head2 音楽の例
328327
329 my $scale = <<'EOS';
328 my $scale = <<EOS;
330329 \rel \bpm144
331330 c d e f g a b c2. r4 # a scale going up
332331 c b a g f e d c1 # and then down
333332 EOS
334333
335 my $music = <<'EOM'; # a Smashing Pumpkins tune
334 my $music = <<EOM; # a Smashing Pumpkins tune
336335 \bpm90 \norel \transpose''
337336 d8 a, e a, d a, fis16 d a,8
338337 d a, e a, d a, fis16 d a,8
339338 EOM
340339
341 my $love_will_tear_us_apart = <<'EOLOVE'; # a happier tune
342 \bpm160
343 d'8
344 e1 fis4 g8 fis4 e8 d4
345 b2.. d8 a2.. d8
346 e1 fis4 g8 fis4 e8 d4
347 b2.. d8 a1
348 EOLOVE
349
350
351340There should be extra examples in the "music" directory of this tarball.
352341
353342tarballの"music"ディレクトリに、特別な例があるでしょう。
354343
355344=head1 例
356345
357346 #大きなビープ
358347 perl -MAudio::Beep -ne 'print and beep(550, 1000) if /ERROR/i' logfile
359348
360349 # PCをホフマンモードにする (courtesy of Thomas Klausner)
361350 perl -MAudio::Beep -e 'beep(21 + rand 1000, rand 300) while 1'
362351
363352 #あなたの新しいミュージックプレイヤー
364353 perl -mAudio::Beep -0777e 'Audio::Beep->new->play(<>)' musicfile
365354
366355=head1 必要条件
367356
368357=head2 Linux
369358
370359Requires either the "beep" program by Johnathan Nightingale
371360(you should find sources in this tarball) SUID root or you to be root (that's
372361because we need writing access to the /dev/console device).
373362If you don't have the "beep" program this library will also assume some kernel
374363constants which may vary from kernel to kernel (or not, i'm no kernel expert).
375364Anyway this was tested on a 2.4.20 kernel compiled for i386.
376365With the same kernel i have problems on my PowerBook G3 (it plays a continous
377366single beep). See the C<rest> method if you'd like to play something anyway.
378367
379368Johnathan Nightingale による、"beep"プログラム
380369(tarballのソースで見つけるはずです)を必要とします。
381370rootにSUIDするか、rootになる必要があります
382371(/dev/consoleデバイスに書き込みアクセスする必要があるからです)。
383372"beep"プログラムがなければ、このライブラリは、
384373kernelからkernelに変えるいくつかのkernel定数を想定します
385374(違うかもしれない。私はkernelエキスパートではないので)。
386375とにかく、このモジュールは、i386用にコンパイルされた2.4.20 kernel でテストされています。
387376同じkernelで私のPowerBook G3に問題があります(単一のbeepを連続して演奏します)。
388377とにかく、何かを演奏したい場合は、C<rest>メソッドを見て下さい。
389378
390379=head2 Windows
391380
392381Requires Windows NT, 2000 or XP and the Win32::API module.
393382You can find sources on CPAN.
394383Some PPM precompiled packages are at http://dada.perl.it/PPM/
395384No support is available for Windows 95, 98 and ME yet:
396385that would require some assembler and an XS module.
397386
398387Windows NT か 2000 か XP と、Win32::APIモジュールを必要とします。
399388CPANでソースを見付けることができます。
400389プリコンパイルされたパッケージはhttp://data.perl.it/RPM/ にあります。
401390Window 95, 98, ME は、まだ、サポートしていません:
402391それはアセンブラと、XSモジュールを必要とします。
403392
404393=head1 バックエンド
405394
406395If you are a developer interested in having Audio::Beep working on your
407396platform, you should think about writing a backend module.
408397A backend module for Beep should offer just a couple of methods:
409398
410399Audio::Beepを自分のプラットフォームで動かせるのに関心のある開発者なら、
411400バックエンドモジュールを書くことについて考えるべきです。
412401Beepのための、バックエンドモジュールは1組のメソッドを提供すべきです:
413402
414403NB: FREQUENCY is in Hertz. DURATION in milliseconds
415404
416405注意:FREQUENCY は、ヘルツであり、DURATIONは、ミリ秒です。
417406
418407=over 4
419408
420409=item new([%options])
421410
422411This is kinda obvious. Take in the options you like. Keep the hash fashion
423412for parameters, thanks.
424413
425414これはある程度自明です。お好みならオプションを入れて下さい。
426415パラメータはハッシュの形式です。よろしく。
427416
428417=item play(FREQUENCY, DURATION)
429418
430419Plays a single sound.
431420
432421単一の音を演奏します。
433422
434423=item rest(DURATION)
435424
436425Rests a DURATION amount of time
437426
438427DURATIONの時間、休止させます。
439428
440429=back
441430
442431=head1 TODO
443432
444433This module works for me, but if someone wants to help here is some cool stuff
445434to do:
446435
447436このモジュールは、私のために働きます。ですが、助けてくださるなら、
448437やるべき、cool stuff があります:
449438
450439- an XS backend
451440
452441- an XS Windoze backend (look at the Prima project for some useful code)
453442
454- some work is needed on Windows Makefile part
455
456443=head1 バグ
457444
458445もちろん、いくつかは。
459446
460447=head1 著作権
461448
462449(原文まま)
463450
464451Copyright 2003 Giulio Motta <giulienk@cpan.org>.
465452
466453This library is free software; you can redistribute it and/or
467454modify it under the same terms as Perl itself.
468
469=head1 翻訳について
470
471翻訳者:加藤敦 (ktat.is@gmail.com)
472
473Perlドキュメント日本語訳 Project にて、
474Perlモジュール、ドキュメントの翻訳を行っております。
475
476 http://perldocjp.sourceforge.jp
477 http://sourceforge.jp/projects/perldocjp/
478 http://www.freeml.com/ctrl/html/MLInfoForm/perldocjp@freeml.com
479 http://www.perldoc.jp