Giulio Motta > Audio-Beep-0.11 > pods/jp/Beep.pod

Download:
Audio-Beep-0.11.tar.gz

Annotate this POD

View/Report Bugs
Source  

̾Á° ^

Audio::Beep - ÁÇŨ¤ÊÊýË¡¤Ç¡¢¥³¥ó¥Ô¥å¡¼¥¿¤Î·ÙÊ󵡤ò»È¤¦¥â¥¸¥å¡¼¥ë

³µÍ× ^

    #´Ø¿ôŪ¤Ê´Êñ¤Ê¤ä¤ê¤«¤¿
    use Audio::Beep;

    beep($freq, $milliseconds);

    #¥ª¥Ö¥¸¥§¥¯¥È»Ø¸þŪ¤Ê¤è¤ê²»³ÚŪ¤Ê¤ä¤ê¤«¤¿
    use Audio::Beep;

    my $beeper = Audio::Beep->new();
    
                # lilypond ¥µ¥Ö¥»¥Ã¥Èʸˡ¤¬¼õ¤±Æþ¤ì¤é¤ì¤Þ¤¹¡£
                # ÁêÂÐŪ¤Êµ­Ë¡¤¬¥Ç¥Õ¥©¥ë¥È¤Ç¤¹¡£
                # (º£¸½ºß¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤¹)
    my $music = "g' f bes' c8 f d4 c8 f d4 bes c g f2";
                # ¥â¥Ç¥¹¥È¡¦¥à¥½¥ë¥°¥¹¥­¡¼¤Î¡ÖŸÍ÷²ñ¤Î³¨¡×

    $beeper->play( $music );

»ÈÍÑË¡ ^

export ¤µ¤ì¤ë´Ø¿ô

beep([FREQUENCY], [DURATION]);

Plays a customizable beep out of your computer beeper.

¥«¥¹¥¿¥Þ¥¤¥º¤Ç¤­¤ë¥Ó¡¼¥×²»¤ò¡¢¥³¥ó¥Ô¥å¡¼¥¿¤Î·ÙÊ󵡤ǺÆÀ¸¤·¤Þ¤¹¡£

FREQUENCY is in Hz. Defaults to 440.

FREQUENCY ¤Ï¡¢Hz ¤Ç¡¢¥Ç¥Õ¥©¥ë¥È¤Ï¡¢440¤Ç¤¹¡£

DURATION is in milliseconds. Defaults to 100.

DURATION ¤Ï¡¢¥ß¥êÉäǡ¢¥Ç¥Õ¥©¥ë¥È¤Ï100¤Ç¤¹¡£

¥ª¥Ö¥¸¥§¥¯¥È»Ø¸þ¥á¥½¥Ã¥É

Audio::Beep->new([%options])

Returns a new "beeper" object. Follows the available options for the new method to be passed in hash fashion.

¿·¤·¤¤"beeper" ¥ª¥Ö¥¸¥§¥¯¥È¤òÊÖ¤·¤Þ¤¹¡£ new ¥á¥½¥Ã¥É¤Ë¤Ï¡¢²¼µ­¤Î¥ª¥×¥·¥ç¥ó¤¬¥Ï¥Ã¥·¥å¤Î¤«¤¿¤Á¤ÇÅϤµ¤ì¤Þ¤¹¡£

player => [player object | player module]

You can initialize your player object and then give it to the Audio::Beep object. Player objects come from Audio::Beep submodules (like Audio::Beep::Linux::beep).

±éÁÕ¥ª¥Ö¥¸¥§¥¯¥È¤ò½é´ü²½¤Ç¤­¡¢¤½¤ì¤«¤é¡¢ Audio::Beep ¥ª¥Ö¥¸¥§¥¯¥È¤Ë¡¢±éÁÕ¥ª¥Ö¥¸¥§¥¯¥È¤òÅϤ»¤Þ¤¹¡£ ±éÁÕ¥ª¥Ö¥¸¥§¥¯¥È¤Ï Audio::Beep ¥µ¥Ö¥â¥¸¥å¡¼¥ë(Audio::Beep::Linux::Beep¤Î¤è¤¦¤Ê)¤«¤é¤â¤¿¤é¤µ¤ì¤Þ¤¹¡£

If you're lazy (as any good programmer should be) you can give a string as a player, like "Audio::Beep::Linux::PP" or even just "Linux::PP": the method will prepend the Audio::Beep namespace, require the module and call the new method on it for you. The new method will try to look up the best player on your platform if you don't specify one. So the following is all valid:

¤â¤·¡¢¤¢¤Ê¤¿¤¬ÂÕÂƤʤé(¤É¤ó¤Ê¤è¤¤¥×¥í¥°¥é¥Þ¤Ï¤½¤¦¤¢¤ë¤Ù¤­¤è¤¦¤Ë)¡¢player ¤È¤·¤Æ¡¢ "Audio::Beep::Linux::PP"¤«¡¢¤¿¤À¡¢"Linux::PP"¤Î¤è¤¦¤Êʸ»úÎó¤ò¤¢¤¿¤¨¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹: ¥á¥½¥Ã¥É¤Ï"Audio::Beep"̾Á°¶õ´Ö¤òÀèƬ¤ËÉÕ¤±²Ã¤¨(ÌõÃð¡§prepend)¤·¡¢ ¤½¤Î¥â¥¸¥å¡¼¥ë¤ò require ¤·¡¢new ¥á¥½¥Ã¥É¤ò¤½¤Î¾å¤Ç¸Æ¤Ó½Ð¤·¤Þ¤¹¡£

    use Audio::Beep;
    
    #¤È¤Æ¤âÂÕÂÆ (Ä̾Àµ¤·¤¤¤³¤È¤ò¹Ô¤¦¤Ù¤­¤Ç¤¹)
    my $beeper = Audio::Beep->new();
    
    #¤Þ¤ÀÂÕÂÆ¡£
    my $beeper2 = Audio::Beep->new(player => 'Linux::PP');

    #¤Ê¤«¤Ê¤«ÂÕÂÆ¡£
    my $beeper3 = Audio::Beep->new(
        player  => 'Audio::Beep::Win32::API'
    );

    #ÂÕÂƤ¸¤ã¤Ê¤¤¤¬¡¢¤è¤ê²ÄÊÑÀ­¤¬¤¢¤ë¡£
    require Audio::Beep::Linux::beep;
    my $beeper4 = Audio::Beep->new(
        player  => Audio::Beep::Linux::beep->new(
            path    =>  '/home/foo/bin/beep/'
        )
    );
rest => [ms]

Sets the rest in milliseconds between every sound played (and even pause). This is useful for users which computer beeper has problems and would just stick to the first sound played. For example on my PowerbookG3 i have to set this around 120 milliseconds. In that way i can still hear some music. Otherwise is just a long single beep.

±éÁÕ¤µ¤ì¤ë¥µ¥¦¥ó¥É(¤È¥Ý¡¼¥º)¤´¤È¤Ë¡¢¥ß¥êÉäεٷƤò¥»¥Ã¥È¤·¤Þ¤¹¡£ ¤³¤Î¤³¤È¤Ï¡¢ÌäÂê¤Î¤¢¤ë¥³¥ó¥Ô¥å¡¼¥¿¤Î·ÙÊ󵡤Υ桼¥¶ - ±éÁÕ¤µ¤ì¤ëºÇ½é¤Î²»¤òÆͤ­»É¤¹¤è¤¦¤Ê - ¤Ë¤È¤Ã¤Æ¡¢Í­±×¤Ç¤¹¡£ ¤¿¤È¤¨¤Ð¡¢»ä¤Î PowerbookGC¤Ç ¤Ï¡¢120¥ß¥êÉ䢤¿¤ê¤ò¥»¥Ã¥È¤·¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£ ¤³¤Î¤è¤¦¤Ë¤¹¤ì¤Ð¡¢¤Þ¤À¡¢²»³Ú¤òʹ¤¯¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£ ¤µ¤â¤Ê¤¯¤Ð¡¢Ä¹¤¤Ã±°ì¤Î¥Ó¡¼¥×¤Ë¤Ê¤ê¤Þ¤¹¡£

$beeper->play( $music )

Plays the "music" written in $music. The accepted format is a subset of lilypond.org syntax. The string is a space separated list of notes to play. See the NOTATION section below for more info.

$music ¤Ë¤«¤«¤ì¤¿"²»³Ú"¤ò±éÁÕ¤·¤Þ¤¹¡£ ¼õ¤±Æþ¤ì¤ë¥Õ¥©¡¼¥Þ¥Ã¥È¤Ï lilypond.org ¤Îʸˡ¤Î¥µ¥Ö¥»¥Ã¥È¤Ç¤¹¡£ ʸ»úÎó¤Ï¥¹¥Ú¡¼¥¹¤Çʬ³ä¤µ¤ì¤¿±éÁÕ¤¹¤ë²»Éä¤Î¥ê¥¹¥È¤Ç¤¹¡£ ¾Ü¤·¤¯¤Ï¡¢¸å½Ò¤Îµ­Ë¡¤Î¥»¥¯¥·¥ç¥ó¤ò¸«¤Æ²¼¤µ¤¤¡£

$beeper->player( [player] )

Sets the player object that will be used to play your music. See the player option above at the new method for more info. With no parameter it just gives you back the current player.

²»³Ú¤ò±éÁÕ¤¹¤ë¤Î¤Ë»È¤Ã¤¿±éÁÕ¥ª¥Ö¥¸¥§¥¯¥È¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£ ¾Ü¤·¤¯¤Ï¡¢¾å½Ò¤Înew¥á¥½¥Ã¥É¤Î player ¥ª¥×¥·¥ç¥ó¤ò¸«¤Æ²¼¤µ¤¤¡£ ¥Ñ¥é¥á¡¼¥¿¤ò¤¢¤¿¤¨¤Ê¤±¤ì¤Ð¡¢¸½ºß¤Î player ¤òÌᤷ¤Þ¤¹¡£

$beeper->rest( [ms] )

Sets the extra rest between each note. See the rest option above at the new method for more info. With no parameter it gives you back the current rest.

¤½¤ì¤¾¤ì¤Î²»Éä¤Î´Ö¤ËÆÃÊ̤εٷƤò¥»¥Ã¥È¤·¤Þ¤¹¡£ ¾Ü¤·¤¯¤Ï¡¢¾å½Ò¤Înew¥á¥½¥Ã¥É¤Î rest ¥ª¥×¥·¥ç¥ó¤ò¸«¤Æ²¼¤µ¤¤¡£ ¥Ñ¥é¥á¡¼¥¿¤ò¤¢¤¿¤¨¤Ê¤±¤ì¤Ð¡¢¸½ºß¤Î rest ¤òÌᤷ¤Þ¤¹¡£

µ­Ë¡ ^

The defaults at start are middle octave C and a quarter length. Standard notation is the relative notation. Here is an explanation from Lilypond documentation:

ºÇ½é¤Î¥Ç¥Õ¥©¥ë¥È¤Ï¡¢Ãæ´Ö¤Î¥ª¥¯¥¿¡¼¥Ö¤Î¥É¤Ç¡¢1/4ŤǤ¹¡£ ɸ½à¤Îµ­Ë¡¤ÏÁêÂÐŪ¤Êµ­Ë¡¤Ç¤¹¡£Lilypond ¥É¥­¥å¥á¥ó¥È¤Ë¤¢¤ëÀâÌÀ¤Ç¤¹¡¨

    If no octave changing marks are used, the basic interval between 
    this and the last note is always taken to be a fourth or less 
    (This distance is determined without regarding alterations; 
    a fisis following a ceses will be put above the ceses)

    ¤â¤·¡¢¥ª¥¯¥¿¡¼¥Ö¤òÊѹ¹¤¹¤ë¥Þ¡¼¥¯¤¬»È¤ï¤ì¤Ê¤±¤ì¤Ð¡¢
    ¤³¤ì¤ÈºÇ¸å¤Î²»Éä¤Î´Ö¤Î´ðËÜŪ¤Ê´Ö³Ö¤Ï¾ï¤Ë1/4¤«¤è¤ê¾¯¤Ê¤¯¤Ê¤ê¤Þ¤¹¡£
    (¤³¤Î´Ö³Ö¤ÏÊѹ¹¤ËÃí°Õ¤»¤º¤Ë·èÄꤵ¤ì¤Þ¤¹¡¨
    a fisis following a ceses will be put above the ceses)

    The octave changing marks ' and , can be added to raise or lower 
    the pitch by an extra octave.

    ¥ª¥¯¥¿¡¼¥Ö¤òÊѹ¹¤¹¤ë¥Þ¡¼¥¯¤Ï ' ¤Ç¡¢ÆÃÊ̤ʥª¥¯¥¿¡¼¥Ö¤Ç¥Ô¥Ã¥Á¤ò¤¢¤²¤¿¤ê²¼¤²¤¿¤ê
    ¤Ç¤­¤Þ¤¹¡£

You can switch from relative to non relative notation (in which you specify for every note the octave) using the \norel and \rel commands (see below)

\norel¤È¡¢\rel ¥³¥Þ¥ó¥É(¸å½Ò)¤ò»È¤Ã¤Æ¡¢ÁêÂФ«¤éÁêÂФǤʤ¤µ­Ë¡¤Ë¥¹¥¤¥Ã¥Á¤Ç¤­¤Þ¤¹ (²»É䤴¤È¤Ë¥ª¥¯¥¿¡¼¥Ö¤òÆÃÄꤷ¤Þ¤¹)¡£

²»Éä

Every note has the following structure:

Á´¤Æ¤Î²»Éä¤Ë¤Ï²¼µ­¤Î¹½Â¤¤¬¤¢¤ê¤Þ¤¹¡£

    [note][flat|sharp][octave][duration][dots]

    [²»Éä][¥Õ¥é¥Ã¥È|¥·¥ã¡¼¥×][¥ª¥¯¥¿¡¼¥Ö][Ťµ][¥É¥Ã¥È]

NB: previous note duration is used if omitted. "Flatness", "Sharpness" and "Dottiness" are reset after each note.

Ãí°Õ¡§¾Êά¤µ¤ì¤ë¤ÈÁ°¤Î²»Éä¤Î»ý³»þ´Ö¤¬»È¤ï¤ì¤Þ¤¹¡£ "Flatness"¤È¡¢"Sharpness"¤È¡¢"Dottiness" ¤Ï¡¢²»É䤴¤È¤Ë¥ê¥»¥Ã¥È¤µ¤ì¤Þ¤¹¡£

note

A note can be any of [c d e f g a b] or [r] for rest.

²»Éä¤Ï[c d e f g a b] ¤«¡¢µÙÉä¤Î[r] ¤Î¤É¤ì¤«¤Ç¤¹¡£

flat or sharp

A sharp note is produced postponing a "is" to the note itself (like "cis" for a C#).

¥·¥ã¡¼¥×¤Î²»Éä¤Ï¡¢"is"¤ò²»Éä¤Î¸å¤ËÃÖ¤¯¤³¤È¤Ç¡¢ºî¤ì¤Þ¤¹¡£ (C#¤Î¤¿¤á¤Ë¡¢"cis"¤Î¤è¤¦¤Ë¤·¤Þ¤¹)

A flat note is produced adding a "es" or "s" (so "aes" and "as" are both an A flat).

¥Õ¥é¥Ã¥È¤Î²»Éä¤Ï¡¢"es"¤«¡¢"s"¤ò²»Éä¤Î¸å¤ËÃÖ¤¯¤³¤È¤Ç¡¢ºî¤ì¤Þ¤¹¡£ ("aes"¤È¡¢"as"¤Ï¡¢¤É¤Á¤é¤âA¥Õ¥é¥Ã¥È¤Ç¤¹)

octave

A ' (apostrophe) raise one octave, while a , (comma) lower it.

'(¥¢¥Ý¥¹¥È¥í¥Õ¥£) ¤Ï¡¢¥ª¥¯¥¿¡¼¥Ö¤ò¤Ò¤È¤Ä¤¢¤²¤Þ¤¹¡£ °ìÊý¡¢,(¥«¥ó¥Þ)¤Ï¡¢¥ª¥¯¥¿¡¼¥Ö¤ò¤Ò¤È¤Ä²¼¤²¤Þ¤¹¡£

duration

A duration is expressed with a number. A 4 is a beat, a 1 is a whole 4/4 measure. Higher the number, shorter the note.

duration ¤Ï¡¢¿ô»ú¤Çɽ¤·¤Þ¤¹¡£ 4 ¤Ï¡¢¥Ó¡¼¥È¤Ç¡¢1 ¤Ï¡¢¤Þ¤Ã¤¿¤¯4/4¤ÎŤµ¤Ç¤¹¡£ ¿ô»ú¤¬¹â¤±¤ì¤Ð¹â¤¤¤Û¤É¡¢²»Éä¤Ïû¤¯¤Ê¤ê¤Þ¤¹¡£

dots

You can add dots after the duration number to add half its length. So a4. is an A note long 1/4 + 1/8 and gis2.. is a G# long 7/8 (1/2 + 1/4 + 1/8)

duration¤Î¿ô»ú¤Î¸å¤Ë¡¢¥É¥Ã¥È¤ò²Ã¤¨¤ë¤³¤È¤¬¤Ç¤­¡¢¤½¤ÎŤµ¤ÎȾʬ¤ò²Ã¤¨¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£ a4. ¤Ç¤·¤¿¤é¡¢¥é¤Î 1/4 + 1/8 ¤ÎŤµ¤Î²»Éä¤Ç¤¹¤·¡¢gis2 ¤Ï¡¢¥½# 8/7(1/2 + 1/4 + 1/8)¤ÎŤµ¤Ç¤¹¡£

Æõ­: "r"

A r note means a rest. You can still use duration and dots parameters.

r ²»Éä¤Ï¡¢µÙÉä¤ò°ÕÌ£¤·¤Þ¤¹¡£duration ¤È¡¢dots ¤Î¥Ñ¥é¥á¥¿¤ò»È¤¦¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£

ÆÃÊ̤ʥ³¥Þ¥ó¥É

Special commands always begin with a "\". They change the behavior of the parser or the music played. Unlike in the Lilypond original syntax, these commands are embedded between notes so they have a slightly different syntax.

ÆÃÊ̤ʥ³¥Þ¥ó¥É¤Ï¾ï¤Ë¡¢"\" ¤Ç»Ï¤Þ¤ê¤Þ¤¹¡£ ¥Ñ¡¼¥µ¤«¡¢±éÁÕ¤µ¤ì¤ë²»³Ú¤Î¿¶¤ëÉñ¤¤¤òÊѹ¹¤·¤Þ¤¹¡£Lilypond¤Î¥ª¥ê¥¸¥Ê¥ë¤Îʸˡ¤È¤Ï°ã¤Ã¤Æ¡¢ ¤³¤ì¤é¤Î¥³¥Þ¥ó¥É¤Ï²»Éä¤Î´Ö¤ËËä¤á¹þ¤Þ¤ì¤Þ¤¹¡£¤½¤ì¤Ç¡¢¾¯¡¹°ã¤Ã¤¿Ê¸Ë¡¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£

\bpm(\d+)

You can use this option to change the tempo of the music. The only parameter you can use is a number following the bpm string (like "bpm144"). BPM stands for Beats Per Minute. The default is 120 BPM. You can also invoke this command as \tempo

¤³¤Î¥ª¥×¥·¥ç¥ó¤ò»È¤Ã¤Æ¡¢²»³Ú¤Î¥Æ¥ó¥Ý¤òÊѹ¹¤Ç¤­¤Þ¤¹¡£ »È¤¦¥Ñ¥é¥á¥¿¤Ï¡¢bpm¤Î¸å¤Ë¿ô»ú¤¬Â³¤¯Ê¸»úÎó¤Ç¤¹("bpm144"¤Î¤è¤¦¤Ê)¡£ BPM ¤Ï¡¢Beats Per Minute ¤ò°ÕÌ£¤·¤Þ¤¹¡£¥Ç¥Õ¥©¥ë¥È¤Ï 120 BPM ¤Ç¤¹¡£ \tempo ¤Î¤è¤¦¤Ê¥³¥Þ¥ó¥É¤Ç¡¢¸Æ¤Ó½Ð¤¹¤³¤È¤â¤Ç¤­¤Þ¤¹¡£

\norel

Switches the relative mode off. From here afterward you have to always specify the octave where the note is.

ÁêÂХ⡼¥É¤ò¥ª¥Õ¤Ë¤¹¤ë¥¹¥¤¥Ã¥Á¤Ç¤¹¡£ ¤³¤³¤«¤é¸å¤Ï¡¢¤¤¤Ä¤â¡¢²»É䤬¤¢¤ë¾ì½ê¤Î¥ª¥¯¥¿¡¼¥Ö¤òÆÃÄꤹ¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£

\rel

Switches the relative mode on. This is the default.

ÁêÂХ⡼¥É¤ò¥ª¥ó¤Ë¤¹¤ë¥¹¥¤¥Ã¥Á¤Ç¤¹¡£¤³¤ì¤Ï¥Ç¥Õ¥©¥ë¥È¤Ç¤¹¡£

\transpose([',]+)

You can transpose all your music up or down some octave. ' (apostrophe) raise octave. , (comma) lowers it. This has effect just if you are in non-relative mode.

Á´¤Æ¤Î²»³Ú¤Î¥ª¥¯¥¿¡¼¥Ö¤ò¤¤¤¯¤Ä¤«¾å¤²¤ë¤«²¼¤²¤ë¤«ÃÖ¤­´¹¤¨¤Þ¤¹¡£ '(¥¢¥Ý¥¹¥È¥í¥Õ¥£)¤Ï¥ª¥¯¥¿¡¼¥Ö¤ò¾å¤²¤Þ¤¹¡£,(comma)¤Ï¥ª¥¯¥¿¡¼¥Ö¤ò²¼¤²¤Þ¤¹¡£ ÁêÂХ⡼¥É¤Ç¤Ê¤¤¥â¡¼¥É¤Ç¤À¤±¡¢¤³¤ì¤Ï¸ú²Ì¤¬¤¢¤ê¤Þ¤¹¡£

¥³¥á¥ó¥È

You can embed comments in your music the Perl way. Everything after a # will be ignored until end of file

²»³Ú¤ËPerl¤ÎÊýË¡¤Ç¥³¥á¥ó¥È¤òËä¤á¹þ¤á¤Þ¤¹¡£ ¥Õ¥¡¥¤¥ë¤ÎºÇ¸å¤Þ¤Ç¡¢#¤Î¸å¤ÎÁ´¤Æ¤Î¤â¤Î¤Ï̵»ë¤µ¤ì¤Þ¤¹¡£

²»³Ú¤ÎÎã

    my $scale = <<'EOS';
    \rel \bpm144
    c d e f g a b c2. r4    # a scale going up
    c b a g f e d c1        # and then down
    EOS

    my $music = <<'EOM'; # a Smashing Pumpkins tune
    \bpm90 \norel \transpose''
        d8 a, e a, d a, fis16 d a,8
        d  a, e a, d a, fis16 d a,8
    EOM

    my $love_will_tear_us_apart = <<'EOLOVE'; # a happier tune
    \bpm160
      d'8 
        e1      fis4 g8 fis4 e8 d4
        b2.. d8 a2..            d8
        e1      fis4 g8 fis4 e8 d4
        b2.. d8 a1
    EOLOVE

There should be extra examples in the "music" directory of this tarball.

tarball¤Î"music"¥Ç¥£¥ì¥¯¥È¥ê¤Ë¡¢ÆÃÊ̤ÊÎ㤬¤¢¤ë¤Ç¤·¤ç¤¦¡£

Îã ^

 #Â礭¤Ê¥Ó¡¼¥×
 perl -MAudio::Beep -ne 'print and beep(550, 1000) if /ERROR/i' logfile

 # PC¤ò¥Û¥Õ¥Þ¥ó¥â¡¼¥É¤Ë¤¹¤ë (courtesy of Thomas Klausner)
 perl -MAudio::Beep -e 'beep(21 + rand 1000, rand 300) while 1'

 #¤¢¤Ê¤¿¤Î¿·¤·¤¤¥ß¥å¡¼¥¸¥Ã¥¯¥×¥ì¥¤¥ä¡¼
 perl -mAudio::Beep -0777e 'Audio::Beep->new->play(<>)' musicfile

ɬÍ×¾ò·ï ^

Linux

Requires either the "beep" program by Johnathan Nightingale (you should find sources in this tarball) SUID root or you to be root (that's because we need writing access to the /dev/console device). If you don't have the "beep" program this library will also assume some kernel constants which may vary from kernel to kernel (or not, i'm no kernel expert). Anyway this was tested on a 2.4.20 kernel compiled for i386. With the same kernel i have problems on my PowerBook G3 (it plays a continous single beep). See the rest method if you'd like to play something anyway.

Johnathan Nightingale ¤Ë¤è¤ë¡¢"beep"¥×¥í¥°¥é¥à (tarball¤Î¥½¡¼¥¹¤Ç¸«¤Ä¤±¤ë¤Ï¤º¤Ç¤¹)¤òɬÍפȤ·¤Þ¤¹¡£ root¤ËSUID¤¹¤ë¤«¡¢root¤Ë¤Ê¤ëɬÍפ¬¤¢¤ê¤Þ¤¹ (/dev/console¥Ç¥Ð¥¤¥¹¤Ë½ñ¤­¹þ¤ß¥¢¥¯¥»¥¹¤¹¤ëɬÍפ¬¤¢¤ë¤«¤é¤Ç¤¹)¡£ "beep"¥×¥í¥°¥é¥à¤¬¤Ê¤±¤ì¤Ð¡¢¤³¤Î¥é¥¤¥Ö¥é¥ê¤Ï¡¢ kernel¤«¤ékernel¤ËÊѤ¨¤ë¤¤¤¯¤Ä¤«¤ÎkernelÄê¿ô¤òÁÛÄꤷ¤Þ¤¹ (°ã¤¦¤«¤â¤·¤ì¤Ê¤¤¡£»ä¤Ïkernel¥¨¥­¥¹¥Ñ¡¼¥È¤Ç¤Ï¤Ê¤¤¤Î¤Ç)¡£ ¤È¤Ë¤«¤¯¡¢¤³¤Î¥â¥¸¥å¡¼¥ë¤Ï¡¢i386ÍѤ˥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤¿2.4.20 kernel ¤Ç¥Æ¥¹¥È¤µ¤ì¤Æ¤¤¤Þ¤¹¡£ Ʊ¤¸kernel¤Ç»ä¤ÎPowerBook G3¤ËÌäÂ꤬¤¢¤ê¤Þ¤¹(ñ°ì¤Îbeep¤òϢ³¤·¤Æ±éÁÕ¤·¤Þ¤¹)¡£ ¤È¤Ë¤«¤¯¡¢²¿¤«¤ò±éÁÕ¤·¤¿¤¤¾ì¹ç¤Ï¡¢rest¥á¥½¥Ã¥É¤ò¸«¤Æ²¼¤µ¤¤¡£

Windows

Requires Windows NT, 2000 or XP and the Win32::API module. You can find sources on CPAN. Some PPM precompiled packages are at http://dada.perl.it/PPM/ No support is available for Windows 95, 98 and ME yet: that would require some assembler and an XS module.

Windows NT ¤« 2000 ¤« XP ¤È¡¢Win32::API¥â¥¸¥å¡¼¥ë¤òɬÍפȤ·¤Þ¤¹¡£ CPAN¤Ç¥½¡¼¥¹¤ò¸«ÉÕ¤±¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£ ¥×¥ê¥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤¿¥Ñ¥Ã¥±¡¼¥¸¤Ïhttp://data.perl.it/RPM/ ¤Ë¤¢¤ê¤Þ¤¹¡£ Window 95, 98, ME ¤Ï¡¢¤Þ¤À¡¢¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤»¤ó: ¤½¤ì¤Ï¥¢¥»¥ó¥Ö¥é¤È¡¢XS¥â¥¸¥å¡¼¥ë¤òɬÍפȤ·¤Þ¤¹¡£

¥Ð¥Ã¥¯¥¨¥ó¥É ^

If you are a developer interested in having Audio::Beep working on your platform, you should think about writing a backend module. A backend module for Beep should offer just a couple of methods:

Audio::Beep¤ò¼«Ê¬¤Î¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¤ÇÆ°¤«¤»¤ë¤Î¤Ë´Ø¿´¤Î¤¢¤ë³«È¯¼Ô¤Ê¤é¡¢ ¥Ð¥Ã¥¯¥¨¥ó¥É¥â¥¸¥å¡¼¥ë¤ò½ñ¤¯¤³¤È¤Ë¤Ä¤¤¤Æ¹Í¤¨¤ë¤Ù¤­¤Ç¤¹¡£ Beep¤Î¤¿¤á¤Î¡¢¥Ð¥Ã¥¯¥¨¥ó¥É¥â¥¸¥å¡¼¥ë¤Ï1ÁȤΥ᥽¥Ã¥É¤òÄ󶡤¹¤Ù¤­¤Ç¤¹:

NB: FREQUENCY is in Hertz. DURATION in milliseconds

Ãí°Õ:FREQUENCY ¤Ï¡¢¥Ø¥ë¥Ä¤Ç¤¢¤ê¡¢DURATION¤Ï¡¢¥ß¥êÉäǤ¹¡£

new([%options])

This is kinda obvious. Take in the options you like. Keep the hash fashion for parameters, thanks.

¤³¤ì¤Ï¤¢¤ëÄøÅÙ¼«ÌÀ¤Ç¤¹¡£¤ª¹¥¤ß¤Ê¤é¥ª¥×¥·¥ç¥ó¤òÆþ¤ì¤Æ²¼¤µ¤¤¡£ ¥Ñ¥é¥á¡¼¥¿¤Ï¥Ï¥Ã¥·¥å¤Î·Á¼°¤Ç¤¹¡£¤è¤í¤·¤¯¡£

play(FREQUENCY, DURATION)

Plays a single sound.

ñ°ì¤Î²»¤ò±éÁÕ¤·¤Þ¤¹¡£

rest(DURATION)

Rests a DURATION amount of time

DURATION¤Î»þ´Ö¡¢µÙ»ß¤µ¤»¤Þ¤¹¡£

TODO ^

This module works for me, but if someone wants to help here is some cool stuff to do:

¤³¤Î¥â¥¸¥å¡¼¥ë¤Ï¡¢»ä¤Î¤¿¤á¤ËƯ¤­¤Þ¤¹¡£¤Ç¤¹¤¬¡¢½õ¤±¤Æ¤¯¤À¤µ¤ë¤Ê¤é¡¢ ¤ä¤ë¤Ù¤­¡¢cool stuff ¤¬¤¢¤ê¤Þ¤¹:

- an XS backend

- an XS Windoze backend (look at the Prima project for some useful code)

- some work is needed on Windows Makefile part

¥Ð¥° ^

¤â¤Á¤í¤ó¡¢¤¤¤¯¤Ä¤«¤Ï¡£

Ãøºî¸¢ ^

(¸¶Ê¸¤Þ¤Þ)

Copyright 2003 Giulio Motta <giulienk@cpan.org>.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

ËÝÌõ¤Ë¤Ä¤¤¤Æ ^

ËÝÌõ¼Ô¡§²ÃÆ£ÆØ (atusi@pure.ne.jp)

Perl¥É¥­¥å¥á¥ó¥ÈÆüËܸìÌõ Project ¤Ë¤Æ¡¢ Perl¥â¥¸¥å¡¼¥ë¡¢¥É¥­¥å¥á¥ó¥È¤ÎËÝÌõ¤ò¹Ô¤Ã¤Æ¤ª¤ê¤Þ¤¹¡£

 http://perldocjp.sourceforge.jp
 http://sourceforge.jp/projects/perldocjp/
 http://freeml.com/ctrl/html/MLInfoForm/perldocjp@freeml.com
 http://www.perldoc.jp
syntax highlighting: