加速度センサを利用したサンプル
- 加速度センサと画面上のトラックパッドと呼ばれる領域を使ったサンプル。
- androidスマホを振ると音がする。
- このCSDファイルをDropBoxなど経由で本体に転送し、Openメニュでファイルを読み込み、Startボタンで動作開始させる。
動作環境
- Android4.0.4
- GALAXY Tab SC-01E
コード
; ; use acceleration sensor and TrackPad ; ; ; description: ; when sqrt(ax*ax+ay*ay+az*az) > threshhold, try to make sound which ; is reverberated. Reverberation parameter is controled through ; trackpad.x and trackpad.y. ; freeverb is used. ; look up the URL http://www.csounds.com/manual/html/freeverb.html ; for the parameter details. ; ; the chain of the instrument is described below. ; inst GetAccel ; -duration is controld. as ; ; (maxdur) 1.0 ********* ; * ; * ; 0.1 ****** ; ----------+-----+---(click) ; 500 5000 ; ->inst MixSignal ; -sends the signal to the mix ; ->inst SignalOut ; -reberbation and sends the signal to the outputs ; ->inst ClearMix ; - necessary for the mixing. ; <CsoundSynthesizer> <CsOptions>
- odac -d ; -+rtaudio=null