チェンジセット 649
- コミット日時:
- 2008/06/17 17:43:27 (4 年前)
- ファイル:
-
- as3/sazameki/branches/fp10/sazamekiFP10.as3proj (追加)
- as3/sazameki/branches/fp10/src/Example.as (更新) (1 diff)
- as3/sazameki/branches/fp10/src/LICENSE.txt (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/core/AudioSamples.as (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/core/Sample.as (更新) (1 diff)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/core/SampleBuffer.as (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/ctrlEvent (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/ctrlEvent/CtrlEventList.as (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/ctrlEvent/events (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/ctrlEvent/events/CtrlEvent.as (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/ctrlEvent/events/ICtrlEvent.as (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/ctrlEvent/events/NoteOff.as (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/ctrlEvent/events/NoteOn.as (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/engine/MultiSamplePlayer (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/engine/MultiSamplePlayer/Instrument.as (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/engine/MultiSamplePlayer/MultiSamplePlayer.as (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/engine/MultiSamplePlayer/NoteRange.as (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/engine/MultiSamplePlayer/ProcessData.as (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/engine/MultiSamplePlayer/SynthInfo.as (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/engine/MultiSamplePlayer/Voice.as (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/format/IAudioFormat.as (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/format/Wav.as (削除)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/format/riff (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/format/riff/Chunk.as (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/format/riff/LIST.as (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/format/riff/RIFF.as (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/format/wav (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/format/wav/Wav.as (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/format/wav/chunk (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/format/wav/chunk/WavdataChunk.as (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/format/wav/chunk/WavfmtChunk.as (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/processor/AudioProcessor.as (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/processor/IAudioProcessor.as (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/processor/effects/Delay.as (更新) (1 diff)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/processor/oscillator/Oscillator.as (更新) (5 diffs)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/utils/Converter.as (更新) (1 diff)
- as3/sazameki/branches/fp10/src/org/sazameki/audio/utils/FrequencyUtil.as (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/events (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/events/NoteEvent.as (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/ui (追加)
- as3/sazameki/branches/fp10/src/org/sazameki/ui/KeyboardKeyboard.as (追加)
- as3/sazameki/branches/fp10/src/samples (追加)
- as3/sazameki/branches/fp10/src/samples/SamplerSample.as (追加)
- as3/sazameki/branches/fp10/src/samples/asset (追加)
- as3/sazameki/branches/fp10/src/samples/asset/Clap.wav (追加)
- as3/sazameki/branches/fp10/src/samples/asset/Hat.wav (追加)
- as3/sazameki/branches/fp10/src/samples/asset/Kick.wav (追加)
- as3/sazameki/branches/fp10/src/samples/asset/Snare.wav (追加)
- as3/sazameki/branches/fp10/src/samples/asset/bass_c2_9836_10510.wav (追加)
- as3/sazameki/branches/fp10/src/samples/asset/synth.png (追加)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
as3/sazameki/branches/fp10/src/Example.as
r364 r649 1 /* 2 * -------------------------------------- 3 * sazameki -- audio manipulating library 4 * http://sazameki.org/ 5 * -------------------------------------- 6 * 7 * - developed by Takaaki Yamazaki 8 * http://www.zkdesign.jp/ 9 * - supported by Spark project 10 * http://www.libspark.org/ 11 */ 12 13 /* 14 * Licensed under the MIT License 15 * 16 * Copyright (c) 2008 Takaaki Yamazaki 17 * 18 * Permission is hereby granted, free of charge, to any person obtaining a copy 19 * of this software and associated documentation files (the "Software"), to deal 20 * in the Software without restriction, including without limitation the rights 21 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22 * copies of the Software, and to permit persons to whom the Software is 23 * furnished to do so, subject to the following conditions: 24 * 25 * The above copyright notice and this permission notice shall be included in 26 * all copies or substantial portions of the Software. 27 * 28 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 29 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 31 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 32 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 33 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 34 * THE SOFTWARE. 35 */ 36 37 package { 1 package { 38 2 import flash.display.Sprite; 39 3 import flash.media.Sound; as3/sazameki/branches/fp10/src/org/sazameki/audio/core/Sample.as
r364 r649 42 42 */ 43 43 public class Sample { 44 /* 45 public var left:Vector.<Number>; 46 public var right:Vector.<Number>; 44 47 45 public var left:Number; 46 public var right:Number; 47 48 public function Sample(left:Number=0.0,right:Number=0.0) { 48 public function Sample(length:uint, setting:AudioSetting = null ) { 49 49 this.left=left; 50 50 this.right=right; 51 51 } 52 52 53 */ 54 55 public var left:Number; 56 public var right:Number; 57 public function Sample(left:Number=0, right:Number = 0) 58 { 59 this.left = left; 60 this.right = right; 61 62 } 53 63 public function toString():String{ 54 64 return('[l:'+left+',r:'+right+']'); as3/sazameki/branches/fp10/src/org/sazameki/audio/processor/effects/Delay.as
r364 r649 38 38 import org.sazameki.audio.core.Sample; 39 39 import org.sazameki.audio.engine.ssGenerator.SsAudioSetting; 40 import org.sazameki.audio.processor.AudioProcessor; 40 41 import org.sazameki.audio.processor.SsAudioProcessor; 41 42 import org.sazameki.data.RingArray; 42 43 43 public class Delay extends SsAudioProcessor { 44 public class Delay extends AudioProcessor 45 { 44 46 45 47 private var _buffer:RingArray; as3/sazameki/branches/fp10/src/org/sazameki/audio/processor/oscillator/Oscillator.as
r364 r649 37 37 import org.sazameki.audio.core.Sample; 38 38 import org.sazameki.audio.core.AudioSetting; 39 import org.sazameki.audio.core.SampleBuffer; 39 40 import org.sazameki.audio.engine.ssGenerator.SsAudioSetting; 41 import org.sazameki.audio.processor.AudioProcessor; 40 42 import org.sazameki.audio.processor.envelope.IEnvelope; 41 43 import org.sazameki.audio.processor.SsAudioProcessor; 42 44 import org.sazameki.audio.utils.Converter; 43 45 44 public class Oscillator extends SsAudioProcessor{46 public class Oscillator extends AudioProcessor{ 45 47 46 48 47 protected var minFreq:Number;48 protected var maxFreq:Number;49 protected var _minFreq:Number=440; 50 protected var _maxFreq:Number=440; 49 51 protected var diffFreq:Number; 50 52 protected var phase:Number; 51 protected var freq:Number;53 protected var _freq:Number; 52 54 protected var phaseModCoeff:Number; 53 55 … … 64 66 } 65 67 66 override public function initialize(setting:SsAudioSetting,params:Array=null,additionalProcessors:Object=null):void{ 68 public function set minFreq(value:Number):void 69 { 70 _minFreq = value; 71 72 } 73 74 public function set freq(value:Number):void 75 { 76 _minFreq = value; 77 _maxFreq = value; 78 } 79 80 override public function initialize(setting:AudioSetting,params:Array=null,additionalProcessors:Object=null):void{ 67 81 super.initialize(setting,params); 68 82 phase=0; 69 83 70 84 //params:ピッチの設定(min,max) 71 72 minFreq=getFreq(params[0]); 73 if(params[1]){ 74 maxFreq=getFreq(params[1]); 75 }else{ 76 maxFreq=minFreq; 85 if(params){ 86 _minFreq=getFreq(params[0]); 87 if(params[1]){ 88 _maxFreq=getFreq(params[1]); 89 }else{ 90 _maxFreq=_minFreq; 91 } 92 freq=_minFreq; 93 diffFreq=_maxFreq-_minFreq; 94 95 //phase modulationする? 96 if(params[2]){ 97 phaseModCoeff=params[2]; 98 } 77 99 } 78 freq=minFreq;79 diffFreq=maxFreq-minFreq;80 81 //phase modulationする?82 if(params[2]){83 phaseModCoeff=params[2];84 }85 86 100 87 101 //pitch envelope … … 130 144 131 145 132 override public function processAudio(samples: Array):void{146 override public function processAudio(samples:SampleBuffer):void{ 133 147 134 148 //サンプル生成 135 var len:int=samples.length; 136 var sample:Sample; 149 var len:int = samples.length; 150 151 152 var bufferL:Vector.<Number> = samples.left; 153 var bufferR:Vector.<Number> = samples.right; 154 var hasRight:Boolean = Boolean(bufferR); 137 155 var sig:Number; 138 156 var c:Number=Math.PI*2/_setting.sampleRate; … … 140 158 141 159 for(var i:int=0;i<len;i++){ 142 sample=samples[i];143 input =sample.left;160 161 input = bufferL[i]; 144 162 sig=generate(phase); 145 163 … … 150 168 151 169 //波形とボリュームのエンベロープ適用 152 sample.left=sample.right=sig; 170 bufferL[i] = sig; 171 if(hasRight){ bufferR[i] = sig } 153 172 154 173 //ピッチエンベロープ取得して今のピッチ設定 155 174 if(pitchEnvelope){ 156 freq=minFreq+(diffFreq*pitchEnvelope.getEnvAt(_idx));175 _freq=_minFreq+(diffFreq*pitchEnvelope.getEnvAt(_idx)); 157 176 }else{ 158 freq=minFreq;177 _freq=_minFreq; 159 178 } 160 179 161 180 //phase modulation 162 181 if(phaseModCoeff){ 163 freq+=input*phaseModCoeff;182 _freq+=input*phaseModCoeff; 164 183 } 165 184 166 185 167 186 //phaseの加算 168 phase+=c* freq;187 phase+=c*_freq; 169 188 170 189 _idx++; as3/sazameki/branches/fp10/src/org/sazameki/audio/utils/Converter.as
r364 r649 1 /* 2 * -------------------------------------- 3 * sazameki -- audio manipulating library 4 * http://sazameki.org/ 5 * -------------------------------------- 6 * 7 * - developed by Takaaki Yamazaki 8 * http://www.zkdesign.jp/ 9 * - supported by Spark project 10 * http://www.libspark.org/ 11 */ 12 13 /* 14 * Licensed under the MIT License 15 * 16 * Copyright (c) 2008 Takaaki Yamazaki 17 * 18 * Permission is hereby granted, free of charge, to any person obtaining a copy 19 * of this software and associated documentation files (the "Software"), to deal 20 * in the Software without restriction, including without limitation the rights 21 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22 * copies of the Software, and to permit persons to whom the Software is 23 * furnished to do so, subject to the following conditions: 24 * 25 * The above copyright notice and this permission notice shall be included in 26 * all copies or substantial portions of the Software. 27 * 28 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 29 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 31 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 32 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 33 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 34 * THE SOFTWARE. 35 */ 36 37 38 39 40 package org.sazameki.audio.utils { 1 package org.sazameki.audio.utils { 41 2 /** 42 3 * Converter for converting MIDI note number to frequency.

