[SML 7108] クラスライブラリに耳を傾ける

NISHIHARA Satoshi nishis @ zephyr.dti.ne.jp
2005年 7月 20日 (水) 09:50:04 JST


なんて偉そうなサブジェクトですが,とりあえずクラスからなんぞ3つの要素を
取り出すことができれば音を鳴らせるんでやってみました.

ピッチはルート・クラスからの隔たりで半音間隔です,
長さはそのクラスのサイズです.
音量は,最初クラスの人気度 (リファレンス数) にしようと思ってたんですが,
半端じゃない時間 (CD 2 枚分以上?) が掛かるんで,適当にセレクタ数で妥協
しました.

ほとんどのクラスはサイズも小さくて,セレクタ数もそんなに突飛な数には鳴っ
てない,ごく一部のクラスがデカくてセレクタもいっぱいというのが聴いて判り
ます (笑).

最初に鳴り出すドローンはいわゆるスクリャービンの神秘和音で,これはクラス
関連とは全く無関係,単なる伴奏です.全体の演奏 (?) 約 7'50" ほど掛かり
ます.

ついでに四重奏版も添付します.何かフリーっぽく聴こえて,けっこう笑えます.


  | spaceUsedMax allSuperclassesMax selectorsMax collection basePitch instruments chromaticScale soundCollection totalDuration offsetSecond droneVolume droneMakeBlock droneL1 droneR1 droneL2 droneR2 droneL3 droneR3 score aMixedSound |
  spaceUsedMax := 0.
  allSuperclassesMax := 0.
  selectorsMax := 0.
  collection := OrderedCollection new: Metaclass allInstances size.
  Cursor execute
    showWhile: [SystemNavigation default
        allBehaviorsDo: [:aClass | aClass isMeta
            ifFalse: [| spaceUsed allSuperclasses selectors |
              spaceUsed := aClass spaceUsed + aClass class spaceUsed.
              allSuperclasses := aClass allSuperclasses size.
              selectors := aClass selectors size + aClass class selectors size.
              spaceUsedMax < spaceUsed
                ifTrue: [spaceUsedMax := spaceUsed].
              allSuperclassesMax < allSuperclasses
                ifTrue: [allSuperclassesMax := allSuperclasses].
              selectorsMax < selectors
                ifTrue: [selectorsMax := selectors].
              collection
                add: (Array
                    with: aClass name
                    with: spaceUsed
                    with: allSuperclasses
                    with: selectors)]]].
  basePitch := 'c4'.
  instruments := (FMSound class organization listAtCategoryNamed: #instruments)
        select: [:each | (each beginsWith: #random) not].
  chromaticScale := ((AbstractSound chromaticPitchesFrom: basePitch)
        copyFrom: 1
        to: 13) reverse.
  soundCollection := OrderedCollection new: collection size.
  totalDuration := 0.
  Cursor execute
    showWhile: [collection
        do: [:each |
          | pitch duration loudness aSound |
          pitch := chromaticScale at: (each at: 3)
                  + 1.
          duration := (each at: 2)
                / spaceUsedMax * 15 max: 0.15.
          totalDuration := totalDuration + duration.
          loudness := (each at: 4)
                / selectorsMax max: 0.346.
          aSound := FMSound perform: instruments atRandom.
          soundCollection
            add: (aSound
                soundForPitch: pitch
                dur: duration
                loudness: loudness)]].
  offsetSecond := 12.
  droneVolume := 268.
  droneMakeBlock := [:restDuration :dronePitch :droneDuration :droneLoudness | Array
        with: (Array with: #rest with: restDuration)
        with: (Array
            with: dronePitch
            with: droneDuration
            with: droneLoudness)].
  droneL1 := FMSound
        noteSequenceOn: FMSound organ1
        from: (droneMakeBlock
            value: 0
            value: #c3
            value: totalDuration + offsetSecond
            value: droneVolume).
  droneR1 := FMSound
        noteSequenceOn: FMSound organ1
        from: (droneMakeBlock
            value: offsetSecond / 6
            value: #'f#3'
            value: totalDuration + offsetSecond
            value: droneVolume).
  droneL2 := FMSound
        noteSequenceOn: FMSound organ1
        from: (droneMakeBlock
            value: offsetSecond / 6 * 2
            value: #bf3
            value: totalDuration + offsetSecond
            value: droneVolume).
  droneR2 := FMSound
        noteSequenceOn: FMSound organ1
        from: (droneMakeBlock
            value: offsetSecond / 6 * 3
            value: #e4
            value: totalDuration + offsetSecond
            value: droneVolume).
  droneL3 := FMSound
        noteSequenceOn: FMSound organ1
        from: (droneMakeBlock
            value: offsetSecond / 6 * 4
            value: #a4
            value: totalDuration + offsetSecond
            value: droneVolume).
  droneR3 := FMSound
        noteSequenceOn: FMSound organ1
        from: (droneMakeBlock
            value: offsetSecond / 6 * 5
            value: #d5
            value: totalDuration + offsetSecond
            value: droneVolume).
  soundCollection
    addFirst: (RestSound dur: offsetSecond).
  score := SequentialSound new.
  soundCollection
    do: [:each | score add: each].
  aMixedSound := MixedSound new add: droneL1 pan: 0.1;
         add: droneL2 pan: 0.25;
         add: droneL3 pan: 0.4;
         add: droneR3 pan: 0.6;
         add: droneR2 pan: 0.75;
         add: droneR1 pan: 0.9;
         add: score pan: 0.5.
  aMixedSound play.
  ^ {score. soundCollection. collection. spaceUsedMax. allSuperclassesMax. selectorsMax}

-- 
--------------------------------------------
西原聡士 (NISHIHARA Satoshi)
e-mail: mailto:nishis @ zephyr.dti.ne.jp
URL:    http://www.zephyr.dti.ne.jp/~nishis/
--------------------------------------------
-------------- next part --------------
文字コード指定の無い添付文書を保管しました...
名前: playClassLibraryQuartet.st
URL:  http://www.akademia.co.jp/pipermail/sml/attachments/20050720/feec3f04/playClassLibraryQuartet.ksh


SML メーリングリストの案内