=encoding euc-jp =head1 NAME =begin original MIDI::Score - MIDI scores =end original MIDI::Score - MIDIスコア =head1 概要 # 話せば長くなるので、下をみよ。 =head1 説明 =begin original This module provides functions to do with with MIDI scores. It is used as the basis for all the functions in MIDI::Simple. (Incidentally, MIDI::Opus's draw() method also uses some of the functions in here.) =end original このモジュールはMIDIスコアを扱うための機能を提供する。 MIDI::Simpleの全ての機能の基として利用されている。 ちなみに、MIDI::Opusのdraw()メソッドもこのモジュールの機能の 一部を利用している。 =begin original Whereas the events in a MIDI event structure are items whose timing is expressed in delta-times, the timing of items in a score is expressed as an absolute number of ticks from the track's start time. Moreover, pairs of 'note_on' and 'note_off' events in an event structure are abstracted into a single 'note' item in a score structure. =end original MIDIイベント構造体の中に入っている各イベントは、デルタタイムで表される 時間間隔を持った要素である。これに対してスコアの中の要素が持つ時間間隔は、 そのトラックの開始時間から計ったティックの絶対値として表現される。 さらに、イベント構造内で対になっているノートオン('note_on')と ノートオフ('note_off')は、スコアの中では単体のノート('note')へと 抽象化される。 =begin original 'note' takes the following form: =end original ノート('note')は次の形式をとる: ('note', I, I, I, I, I) =begin original The problem that score structures are meant to solve is that 1) people definitely don't think in delta-times -- they think in absolute times or in structures based on that (like 'time from start of measure'); 2) people think in notes, not note_on and note_off events. =end original スコア構造体によって次の問題が解決する。 (1)人々は明らかにデルタタイムでは考えない。絶対時間か、上に述べた ような構造(スタートからの時間)でもって考える。 (2)人々はノート(音符)で考えるのであって、ノートオンやノートオフで ではない。 =begin original So, given this event structure: =end original そこで、次のようなイベント構造体があるとする: ['text_event', 0, 'www.ely.anglican.org/parishes/camgsm/chimes.html'], ['text_event', 0, 'Lord through this hour/ be Thou our guide'], ['text_event', 0, 'so, by Thy power/ no foot shall slide'], ['patch_change', 0, 1, 8], ['note_on', 0, 1, 25, 96], ['note_off', 96, 0, 1, 0], ['note_on', 0, 1, 29, 96], ['note_off', 96, 0, 1, 0], ['note_on', 0, 1, 27, 96], ['note_off', 96, 0, 1, 0], ['note_on', 0, 1, 20, 96], ['note_off', 192, 0, 1, 0], ['note_on', 0, 1, 25, 96], ['note_off', 96, 0, 1, 0], ['note_on', 0, 1, 27, 96], ['note_off', 96, 0, 1, 0], ['note_on', 0, 1, 29, 96], ['note_off', 96, 0, 1, 0], ['note_on', 0, 1, 25, 96], ['note_off', 192, 0, 1, 0], ['note_on', 0, 1, 29, 96], ['note_off', 96, 0, 1, 0], ['note_on', 0, 1, 25, 96], ['note_off', 96, 0, 1, 0], ['note_on', 0, 1, 27, 96], ['note_off', 96, 0, 1, 0], ['note_on', 0, 1, 20, 96], ['note_off', 192, 0, 1, 0], ['note_on', 0, 1, 20, 96], ['note_off', 96, 0, 1, 0], ['note_on', 0, 1, 27, 96], ['note_off', 96, 0, 1, 0], ['note_on', 0, 1, 29, 96], ['note_off', 96, 0, 1, 0], ['note_on', 0, 1, 25, 96], ['note_off', 192, 0, 1, 0], =begin original here is the corresponding score sctructure: =end original これに対応するスコア構造体は: ['text_event', 0, 'www.ely.anglican.org/parishes/camgsm/chimes.html'], ['text_event', 0, 'Lord through this hour/ be Thou our guide'], ['text_event', 0, 'so, by Thy power/ no foot shall slide'], ['patch_change', 0, 1, 8], ['note', 0, 96, 1, 25, 96], ['note', 96, 96, 1, 29, 96], ['note', 192, 96, 1, 27, 96], ['note', 288, 192, 1, 20, 96], ['note', 480, 96, 1, 25, 96], ['note', 576, 96, 1, 27, 96], ['note', 672, 96, 1, 29, 96], ['note', 768, 192, 1, 25, 96], ['note', 960, 96, 1, 29, 96], ['note', 1056, 96, 1, 25, 96], ['note', 1152, 96, 1, 27, 96], ['note', 1248, 192, 1, 20, 96], ['note', 1440, 96, 1, 20, 96], ['note', 1536, 96, 1, 27, 96], ['note', 1632, 96, 1, 29, 96], ['note', 1728, 192, 1, 25, 96] =begin original Note also that scores aren't crucially ordered. So this: =end original スコアは厳密に順番に並んでいるわけではない。だから: ['note', 768, 192, 1, 25, 96], ['note', 960, 96, 1, 29, 96], ['note', 1056, 96, 1, 25, 96], =begin original means the same thing as: =end original これは次のものと同じだ: ['note', 960, 96, 1, 29, 96], ['note', 768, 192, 1, 25, 96], ['note', 1056, 96, 1, 25, 96], =begin original The only exception to this is in the case of things like: =end original この唯一の例外は、次のようなケースの時だ: ['patch_change', 200, 2, 15], ['note', 200, 96, 2, 25, 96], =begin original where two (or more) score items happen I and where one affects the meaning of the other. =end original 二つ以上のスコア要素が同時に発生し、かつ、一つが他方の意味に 影響を与える場合。 =head1 スコアの中に何があるのか =begin original Besides the new score structure item C (covered above), the possible contents of a score structure can be summarized thus: Whatever can appear in an event structure can appear in a score structure, save that its second parameter denotes not a delta-time in ticks, but instead denotes the absolute number of ticks from the start of the track. =end original (先に述べた)C以外に、スコア構造体が持ちうる構成要素をもとめると: イベント構造体に現れるものは何でもスコア構造体に現れうるということだ。 要素が保持する第二パラメータはティックで表現されるデルタタイムではなく、 トラック開始からの絶対的なティックの数を意味している。 =begin original To avoid the long periphrase "items in a score structure", I will occasionally refer to items in a score structure as "notes", whether or not they are actually C commands. This leaves "event" to unambiguously denote items in an event structure. =end original 「スコア構造体の要素」などという回りくどい言い方は避けたいので、 私はしばしばこれをノート("notes")と呼ぶ。それが本当にCコマンド なのかどうかとは関係ない。"event"の方は、明確にイベント構造体の要素を 意味するよう、そのままにしておく。 =begin original These, below, are all the items that can appear in a score. This is basically just a repetition of the table in L, with starttime substituting for dtime -- so refer to L for an explanation of what the data types (like "velocity" or "pitch_wheel"). As far as order, the first items are generally the most important: =end original 以下はスコアに登場する全項目である。 基本的にLにあった表の繰り返しでしかない。デルタタイムの 代わりにスタート時からのタイムに置き換わってはいるが。だから、 データタイプ("velocity"や"pitch_wheel"など)の説明はLを 参照して欲しい。順番に限っていえば、一般的に最初のほうに出てくるものが 最も重要である。 =over =item ('note', I, I, I, I, I) =item ('key_after_touch', I, I, I, I) =item ('control_change', I, I, I, I) =item ('patch_change', I, I, I) =item ('channel_after_touch', I, I, I) =item ('pitch_wheel_change', I, I, I) =item ('set_sequence_number', I, I) =item ('text_event', I, I) =item ('copyright_text_event', I, I) =item ('track_name', I, I) =item ('instrument_name', I, I) =item ('lyric', I, I) =item ('marker', I, I) =item ('cue_point', I, I) =item ('text_event_08', I, I) =item ('text_event_09', I, I) =item ('text_event_0a', I, I) =item ('text_event_0b', I, I) =item ('text_event_0c', I, I) =item ('text_event_0d', I, I) =item ('text_event_0e', I, I) =item ('text_event_0f', I, I) =item ('end_track', I) =item ('set_tempo', I, I) =item ('smpte_offset', I, I
, I, I, I, I) =item ('time_signature', I, I, I
, I, I) =item ('key_signature', I, I, I) =item ('sequencer_specific', I, I) =item ('raw_meta_event', I, I(0-255), I) =item ('sysex_f0', I, I) =item ('sysex_f7', I, I) =item ('song_position', I) =item ('song_select', I, I) =item ('tune_request', I) =item ('raw_data', I, I) =back =head1 関数 =begin original This module provides these functions: =end original このモジュールは以下の関数を提供する: =over =item $score2_r = MIDI::Score::copy_structure($score_r) =begin original This takes a I to a score structure, and returns a I to a copy of it. Example usage: =end original この関数はスコア構造体へのリファレンスを引数にとり、そのコピーへの リファレンスを返す。例えば: @new_score = @{ MIDI::Score::copy_structure( \@old_score ) }; =item $events_r = MIDI::Score::score_r_to_events_r( $score_r ) =item ($events_r, $ticks) = MIDI::Score::score_r_to_events_r( $score_r ) =begin original This takes a I to a score structure, and converts it to an event structure, which it returns a I to. In list context, also returns a second value, a count of the number of ticks that structure takes to play (i.e., the end-time of the temporally last item). =end original この関数はスコア構造体へのリファレンスを引数にとってイベント構造体に 変換し、そのリファレンスを返す。リストコンテキストでは、二つ目の値も 返す。これはその構造体が演奏に要するティックの総数(時間的に最後の 項目の終了時間)である。 =item $score2_r = MIDI::Score::sort_score_r( $score_r) =begin original This takes a I to a score structure, and returns a I to a sorted (by time) copy of it. Example usage: =end original この関数はスコア構造体へのリファレンスを引数にとり、(時間によって) ソートされたコピーへのリファレンスを返す。例えば: @sorted_score = @{ MIDI::Score::sort_score_r( \@old_score ) }; =item $score_r = MIDI::Score::events_r_to_score_r( $events_r ) =item ($score_r, $ticks) = MIDI::Score::events_r_to_score_r( $events_r ) =begin original This takes a I to an event structure, converts it to a score structure, which it returns a I to. If called in list context, also returns a count of the number of ticks that structure takes to play (i.e., the end-time of the temporally last item). =end original この関数はイベント構造体へのリファレンスを引数にとってスコア構造体に 変換し、そのリファレンスを返す。リストコンテキストでこの関数を 呼び出すと、その構造体が演奏に要するティックの総数(時間的に最後の項目の 終了時間)を返す。 =item $ticks = MIDI::Score::score_r_time( $score_r ) =begin original This takes a I to a score structure, and returns a count of the number of ticks that structure takes to play (i.e., the end-time of the temporally last item). =end original この関数はスコア構造体へのリファレンスを引数にとり、その構造体が 演奏に要するティックの総数(時間的に最後の項目の終了時間)を返す。 =item MIDI::Score::dump_score( $score_r ) =begin original This dumps (via C) a text representation of the contents of the event structure you pass a reference to. =end original この関数は(Cを通じて)リファレンス先のイベント構造体 [訳補足:スコア構造体の間違い?]の中身をテキスト表記でダンプする。 =back =head1 著作権 Copyright (c) 1998-2002 Sean M. Burke. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 作者 Sean M. Burke C