Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @周波数分析
- --track0:1フレーム横サイズ,1,100,3,1
- --track1:1周波数縦サイズ,1,100,10,1
- --track2:カラー閾値,1,10000,2000,1
- --track3:フォーカス周波数,1,256,1,1
- --file:
- function split(str, delim)
- if string.find(str,delim)==nil then
- return { str }
- end
- local result = {}
- local pat="(.-)"..delim.."()"
- local lastPos
- for part, pos in string.gfind(str,pat) do
- table.insert(result,part)
- lastPos=pos
- end
- table.insert(result,string.sub(str,lastPos))
- return result
- end
- datas = {}
- f=io.open(file)
- i = 1
- for line in f:lines() do
- datas[i] = split(line,",")
- i = i + 1
- end
- f:close()
- obj.setoption("drawtarget","tempbuffer",obj.screen_w,obj.screen_h)
- obj.load("figure","四角形",0xff0000,2)
- obj.drawpoly(0, -obj.screen_h/2, 0
- ,0, obj.screen_h/2, 0
- ,obj.track0, obj.screen_h/2, 0
- ,obj.track0, -obj.screen_h/2, 0
- ,0,0 ,1,0 ,1,1 ,0,1, 0.6)
- obj.load("figure","四角形",0x0000ff,2)
- obj.drawpoly(-obj.screen_w/2 ,obj.screen_h/2-obj.track1 * (obj.track3-0), 0
- ,-obj.screen_w/2 ,obj.screen_h/2-obj.track1 * (obj.track3-1), 0
- , obj.screen_w/2 ,obj.screen_h/2-obj.track1 * (obj.track3-1), 0
- , obj.screen_w/2 ,obj.screen_h/2-obj.track1 * (obj.track3-0), 0
- ,0,0 ,1,0 ,1,1 ,0,1, 0.6)
- scroll=-obj.frame*obj.track0
- for i,v in ipairs(datas) do
- if i * obj.track0 + scroll > -obj.screen_w/2 then
- for j,x in ipairs(v) do
- if tonumber(x) > obj.track2 then
- clr = HSV(100-(tonumber(x) - obj.track2)/20,100,100)
- else
- clr = HSV(0,0,tonumber(x)/obj.track2*70)
- end
- obj.load("figure","円",clr)
- obj.drawpoly( scroll + i * obj.track0 , obj.screen_h/2 - (j-1) * obj.track1 ,0
- , scroll + i * obj.track0 , obj.screen_h/2 - j * obj.track1 ,0
- , scroll + ( i - 1) * obj.track0, obj.screen_h/2 - j * obj.track1 ,0
- , scroll + ( i - 1) * obj.track0, obj.screen_h/2 - (j-1) * obj.track1 ,0)
- end
- end
- if i * obj.track0 + scroll > obj.screen_w/2 then
- break
- end
- end
- obj.load("tempbuffer")
- obj.setoption("drawtarget","framebuffer")
- obj.draw()
- @音声読み込み
- --track0:周波数,1,1024,1,1
- --track1:オフセット,-1000000,1000000,0,1
- --track2:閾値,0,10000,2000,1
- --file:
- ff = obj.track0
- offset = obj.track1
- function split(str, delim)
- if string.find(str,delim)==nil then
- return { str }
- end
- local result = {}
- local pat="(.-)"..delim.."()"
- local lastPos
- for part, pos in string.gfind(str,pat) do
- table.insert(result,part)
- lastPos=pos
- end
- table.insert(result,string.sub(str,lastPos))
- return result
- end
- f=io.open(file)
- timedatas = split(f:read("*a"),"\n")
- f:close()
- if timedatas[obj.frame+obj.track1-1] then
- oldline = split(timedatas[obj.frame+obj.track1-1],",")[ff]
- end
- if timedatas[obj.frame+obj.track1] then
- nowline = split(timedatas[obj.frame+obj.track1],",")[ff]
- end
- flag = false
- if tonumber(oldline) < obj.track2 and tonumber(nowline) > obj.track2 then
- flag = true
- end
- @山なり制御(拡大)
- --track0:底値,0,4000,100,0.01
- --track1:山値,0,4000,200,0.01
- --track2:ピークポイント,0,100,50,0.1
- --track3:継続フレーム,0,6000,15,1
- if not yamaz then
- yamaz = {}
- end
- if flag then
- spPoint = math.floor(obj.track3*obj.track2/100.0)
- for i=1,spPoint,1 do
- lvl = math.pow(i/spPoint,2)
- if not yamaz[i] or yamaz[i] < lvl then
- yamaz[i] = lvl
- end
- end
- for i=spPoint,obj.track3,1 do
- lvl = math.pow( (obj.track3-i)/(obj.track3-spPoint) ,2)
- if not yamaz[i] or yamaz[i] < lvl then
- yamaz[i] = lvl
- end
- end
- end
- if #yamaz > 0 then
- obj.zoom = (yamaz[1]*obj.track1 + (1-yamaz[1])*obj.track0)/100
- table.remove(yamaz,1)
- else
- obj.zoom = obj.track0/100
- end
- @山なり制御(回転)
- --track0:底値,-4000,4000,0,0.01
- --track1:山値,-4000,4000,90,0.01
- --track2:ピークポイント,0,1000,50,0.1
- --track3:継続フレーム,0,6000,15,1
- if not yamar then
- yamar = {}
- end
- if flag then
- spPoint = math.floor(obj.track3*obj.track2/100.0)
- for i=1,spPoint,1 do
- lvl = math.pow(i/spPoint,2)
- if not yamar[i] or yamar[i] < lvl then
- yamar[i] = lvl
- end
- end
- for i=spPoint,obj.track3,1 do
- lvl = math.pow( (obj.track3-i)/(obj.track3-spPoint) ,2)
- if not yamar[i] or yamar[i] < lvl then
- yamar[i] = lvl
- end
- end
- end
- if #yamar > 0 then
- obj.rz = (yamar[1]*obj.track1 + (1-yamar[1])*obj.track0)
- table.remove(yamar,1)
- else
- obj.rz = obj.track0
- end
- @スイッチ制御(回転)
- --track0:値1,-4000,4000,0,0.01
- --track1:値2,-4000,4000,90,0.01
- --track2:継続フレーム,0,6000,15,1
- if not swr then
- swr = {}
- end
- if flag then
- if swRollSide then
- for i=1,obj.track2,1 do
- lvl = i/obj.track2
- if not swr[i] or swr[i] < lvl then
- swr[i] = lvl
- end
- end
- swRollSide = false
- else
- for i=1,obj.track2,1 do
- lvl = 1-i/obj.track2
- if not swr[i] or swr[i] > lvl then
- swr[i] = lvl
- end
- end
- swRollSide = true
- end
- end
- if #swr > 0 then
- obj.rz = swr[1]*obj.track1 + (1-swr[1])*obj.track0
- if #swr > 1 then
- table.remove(swr,1)
- end
- end
- @スイッチ制御(拡大)
- --track0:値1,-4000,4000,100,0.01
- --track1:値2,-4000,4000,200,0.01
- --track2:継続フレーム,0,6000,15,1
- if not swz then
- swz = {}
- end
- if flag then
- if swZoomSide then
- for i=1,obj.track2,1 do
- lvl = i/obj.track2
- if not swz[i] or swz[i] < lvl then
- swz[i] = lvl
- end
- end
- swZoomSide = false
- else
- for i=1,obj.track2,1 do
- lvl = 1-i/obj.track2
- if not swz[i] or swz[i] > lvl then
- swz[i] = lvl
- end
- end
- swZoomSide = true
- end
- end
- if #swz > 0 then
- obj.zoom = (swz[1]*obj.track1 + (1-swz[1])*obj.track0)/100
- if #swz > 1 then
- table.remove(swz,1)
- end
- end
- @山なり制御(透明)
- --track0:底値,0,100,0,0.01
- --track1:山値,0,100,100,0.01
- --track2:ピークポイント,0,1000,50,0.1
- --track3:継続フレーム,0,6000,15,1
- if not yamaAl then
- yamaAl = {}
- end
- if flag then
- spPoint = math.floor(obj.track3*obj.track2/100.0)
- for i=1,spPoint,1 do
- lvl = math.pow(i/spPoint,2)
- if not yamaAl[i] or yamaAl[i] < lvl then
- yamaAl[i] = lvl
- end
- end
- for i=spPoint,obj.track3,1 do
- lvl = math.pow( (obj.track3-i)/(obj.track3-spPoint) ,2)
- if not yamaAl[i] or yamaAl[i] < lvl then
- yamaAl[i] = lvl
- end
- end
- end
- if #yamaAl > 0 then
- obj.alpha = (yamaAl[1]*obj.track1 + (1-yamaAl[1])*obj.track0)/100
- table.remove(yamaAl,1)
- else
- obj.alpha = obj.track0/100
- end
- @スイッチ制御(透明)
- --track0:値1,0,100,0,0.01
- --track1:値2,0,100,100,0.01
- --track2:継続フレーム,0,6000,15,1
- if not swAl then
- swAl = {}
- end
- if flag then
- if swRollSide then
- for i=1,obj.track2,1 do
- lvl = i/obj.track2
- if not swAl[i] or swAl[i] < lvl then
- swAl[i] = lvl
- end
- end
- swRollSide = false
- else
- for i=1,obj.track2,1 do
- lvl = 1-i/obj.track2
- if not swAl[i] or swAl[i] > lvl then
- swAl[i] = lvl
- end
- end
- swRollSide = true
- end
- end
- if #swAl > 0 then
- obj.alpha = (swAl[1]*obj.track1 + (1-swAl[1])*obj.track0)/100
- if #swAl > 1 then
- table.remove(swAl,1)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement