Quartz Composerで音を鳴らすメモ
Quartz Composer単体では音をならすことができないそうです。
「quartz composer 音」でぐぐった結果を見た時には愕然としました(w
が、外部パッチをインストールすることで
・別途用意してあるオーディオファイルを
・指定したトリガのタイミングで再生させる
ことは可能そうだったので、今回は以下のようにしてみました。
まず試したのはQuartz Composerで音、iTunesをコントロールするプラグイン!!に掲載されていたSoundというパッチをインストールすること。
http://www.qcplugins.com/のサイトにパッチがあるので、.dmgファイルをダウンロードしてインストール。インストールは簡単で、展開された後のフォルダにあるmpkgをダブルクリックするだけ。
これでSoundパッチが使えるだろうと思って、同じページにあるサンプル.qtzをダウンロードして実行してみたところ、iTunesもSoundも以下のようなエラー画面が出てしまって動かない。。。
色々とGoogle検索して情報を集めるも、なかなか原因が分からなかった。
最終的に「インストーラーによってインストールされるパッチのディレクトリが違う」という結論になり、Leopard版のQuartz Composerの正しいパッチ格納場所
/Library/Graphics/Quartz Composer Patches
にqcplugin.patchを移動させてみたけど、それでもサンプルは動かない・・・。 orz
ちなみにここまでで試したQuartz Composerのバージョンは3.1。
qcplugin自体がそんなに新しいものでもなさそうなので、もう少し古いバージョンのQuartz Composerであれば問題なく動くのかもしれない。
次に試したのがコチラのページで公開されているAudioToolsというもの。こちらの配布形式は圧縮ファイルで、インストーラーがないので自分で
/Library/Graphics/Quartz Composer Patches
に展開したファイルを配置した。
そしたら問題なくQuartz Composerからパッチを選択できるようになりましたヨ!
サウンドファイルを鳴らすのに必要なパッチはAudio File Playerパッチ。
Audio File Player
The Kineme Audio File Player Patch asynchronously plays the specified audio file (anything that QuickTime supports) on the specified output device, on the rising edge of the Trig input.Use the Kineme Audio Device Info to enumerate available output devices, and then feed the UID of your preferred device to the Kineme Audio File Player Patch's Device UID input. If the Device UID is empty, the system default output device is used.
You can optionally specify the way the audio file's channels are mapped to device output channels, by entering a comma-separated list in the Kineme Audio File Player Patch's Channel Mapping input. For example, if you have a stereo audio file, and are playing on a device with four outputs, and want to output the stereo file to the last two channels of the device, enter "2,3" (i.e., "Map the first audio file channel to device channel 2, Map the second audio file channel to device channel 3").
http://kineme.net/
Kineme Audio File Playerパッチは指定されたオーディオファイル(QuickTimeがサポートするオーディオファイルなら何でも)を、指定した出力デバイスに、指定したTrig値のタイミングに合わせて再生するパッチです。
利用可能な出力装置のリストはKineme Audio Device Infoを使えばデバイスのUID情報を取得できるので、明示的に指定する場合はUID inputにそのUIDを指定して下さい。何も指定が無い場合はシステムのデフォルト出力デバイスを使います。
(中略)
細かい使い方は http://kineme.net/QuartzComposerPatches/AudioTools/0.4 のページにあるサンプルファイル(http://kineme.net/files/AudioTools-SampleCompositions.tar_0.bz2)を見ればだいたい分かる。
ということでTwYM(改造版)ではこんな感じでサウンドの再生を実現している。
(1) Conditionalパッチを追加し、First valueにremain seqのResulting Valueを接続
(2) 残り1分を切ったら音をならす、なのでConditionalパッチの設定はこんな感じ
(3) ConditionalパッチのResult(真偽値)をKineme Audio File PlayerのTrigに接続
対象のオーディオファイル(1.wmv)は.qtzと同じディレクトリに配置しておけばOKみたい。
(4) 残り時間がなくなった時にも音をならす、なので同様の手順でConditionalパッチ→Audio File Playerパッチをもう一つ作成
これで完成!
お遊び的な要素として、隠しコマンドみたいなものを用意しておくと面白いかもね。IRCに特定のコマンドを打ち込むとサウンドが鳴るとか。
例えば「88888(パチパチパチ)」が書き込まれると拍手の音が出るとか。
つまらない発表の途中で「boo!」とか書くとのど自慢の鐘がカーンとなるとか。
・・・発表者いじめですねw。すいまそん。
コメント
BlogPetの(,,゚Д゚)
yzが追加したの?