Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --real dj
- --tinfold
- --problem is there is multiple patterns with the same name. Solve by ids
- --
- math.randomseed(tick())
- plr=game:service'Players'.LocalPlayer
- ch,char=plr.Character,plr.Character
- hum=ch.Humanoid
- --tor,torso,rootpart,rj=ch.Torso,ch.Torso,ch.HumanoidRootPart,ch.HumanoidRootPart.RootJoint
- m,mouse=plr:GetMouse(),plr:GetMouse()
- cfn,ang,mr,int=CFrame.new,CFrame.Angles,math.rad,Instance.new
- bc=BrickColor.new
- head=ch.Head
- cam=workspace.CurrentCamera
- debris=game.Debris
- v3 = Vector3.new
- cn = CFrame.new
- ca2 = CFrame.Angles
- mf = math.floor
- mran = math.random rn=mran
- mrad = math.rad rd=mrad
- mdeg = math.deg dg=mdeg
- ca = function(x,y,z) return ca2(mrad(x),mrad(y),mrad(z)) end
- mran2 = function(a,b) return mran(a*1000,b*1000)/1000 end
- ud=UDim2.new
- bn = BrickColor.new
- c3 = Color3.new
- --gtables
- local piano={}
- local samples={}
- local patterns={}
- local tracks={}
- local soundtable={}
- local machinestable={}
- local nstepchannels={}
- local channels={}
- --gbools
- local selected=false
- currentPattern=nil
- --gvars
- local selection
- local origPattern={notes={},name='origPattern'}
- local anm=0
- local bpm=120
- local dcs=(60000/bpm)*0.05--one half of a decisecond
- local full=(60000/bpm)*0.1--decisecond
- local product=(full*4)*0.01
- local other=(full)*0.01
- local fourbar=(other*16)
- local tim=0
- local tvstp=0
- local dispp
- local done=false
- local plugid=0
- local maxSounds=100
- print('One bar length:' .. product)
- print('1 beat length: ' .. other)
- print('Four bar length:' .. fourbar)
- getSound=function(id)
- game:service'ContentProvider':Preload('rbxassetid'..tostring(id))
- local s=int("Sound",ch.Head)
- s.SoundId='rbxassetid://' .. tostring(id)
- s.Volume=1
- table.insert(samples,s)
- return s
- end
- --samples
- local box=getSound(150674644)
- box.Name='musicbox'
- local kick1=getSound(31173820)
- kick1.Name='kick1'
- local snare1=getSound(31173799)
- snare1.Name='snare1'
- local hihat1=getSound(31173735)
- local ride1=getSound(31173898)
- ride1.Name='ride1'
- local crash1=getSound(31173771)
- crash1.Name='crash1'
- local ticks=getSound(151715959)
- ticks.Name='ticks'
- local vvii=getSound(13032204)
- vvii.Name='vvii'
- local lowpizzi=getSound(130850227)
- lowpizzi.Name='lowpizzi'
- local midpizzi=getSound(130850183)
- midpizzi.Name='midpizzi'
- local sinewave=getSound(672376636)--129562240
- sinewave.Name='sinewave'
- local pianokey=getSound(584691395)
- pianokey.Name='pianokey'
- local kick2=getSound(347302817)
- kick2.Name='kick2'
- local kick3=getSound(222209381)
- kick3.Name='kick3'
- local snare2=getSound(222209994)
- snare2.Name='snare2'
- local hihat2=getSound(300636617)
- hihat2.Name='hihat2'
- local rolandhat=getSound(222208272)
- rolandhat.Name='rolandhat'
- local rolandkick=getSound(222268696)
- rolandkick.Name='rolandkick'
- local vox3=getSound(222212508)
- vox3.Name='vox3'
- local perc3=getSound(222209795)
- perc3.Name='perc3'
- local fx10=getSound(222208172)
- fx10.Name='fx10'
- local clap1=getSound(222174146)
- clap1.Name='clap1'
- local doublebass=getSound(392287871)
- doublebass.Name='doublebass'
- local electricbass=getSound(392287907)
- electricbass.Name='ElectricBass'
- local snare4=getSound(222210022)
- snare4.Name='snare4'
- --pianosounds
- local piano1=getSound(136786442)
- piano1.Volume=10
- --392289045
- --258309534 long piano key
- --430020034 reverby piano
- for i=1,maxSounds do
- soundtable[i]={snd=Instance.new('Sound'),inUse=false,timeLeft=0}
- end
- cp=function(parent,color,size,anchored,cancollide)
- local newp=Instance.new("Part",parent)
- newp.TopSurface='SmoothNoOutlines'
- newp.BottomSurface='SmoothNoOutlines'
- newp.FrontSurface='SmoothNoOutlines'
- newp.BackSurface='SmoothNoOutlines'
- newp.RightSurface='SmoothNoOutlines'
- newp.LeftSurface='SmoothNoOutlines'
- newp.FormFactor="Custom"
- newp.BrickColor=bc(color)
- newp.Size=size
- newp.Anchored=anchored
- newp.CanCollide=cancollide
- newp:BreakJoints()
- return newp
- end
- addTrack=function(cf)
- local tracknum=#tracks+1
- local trackp=cp(script,'Really black',Vector3.new(0.5,5,1),true)
- trackp.CFrame=cf.CFrame*CFrame.new(4,6,tvstp)--*ang(0,mr(180),mr(180))
- tvstp=tvstp+1.1
- local tgui=int('SurfaceGui',trackp)
- tgui.Face='Left'
- tgui.Adornee=trackp
- local tf=int('Frame',tgui)
- tf.BackgroundColor3=BrickColor.new('Bright green').Color
- tf.Size=UDim2.new(0.5,0,0,0)
- local trackp2=cp(script,'Really black',Vector3.new(0.5,1,1),true)
- trackp2.CFrame=trackp.CFrame*CFrame.new(0,-3,0)
- local tgui2=int('SurfaceGui',trackp2)
- tgui2.Adornee=trackp2
- tgui2.Face='Left'
- local tf2=int('Frame',tgui2)
- tf2.BackgroundColor3=BrickColor.new('Really black').Color
- tf2.Size=UDim2.new(1,0,1,0)
- tf2.Position=UDim2.new(0,0,0,0)
- local con=int('TextButton',tf2)
- con.Text='cfg'
- con.TextScaled=true
- con.Size=UDim2.new(1,0,1,0)
- con.BackgroundColor=BrickColor.new('Bright red')
- con.TextColor3=BrickColor.new('White').Color
- tracks[tracknum]={trackp=trackp,tgui=tgui}
- end
- --[[
- BPM to MS conversion example:
- Say you have a song that is 80 Beats per Minute: 60,000 / 80 = 750MS per Beat.
- There are 4 beats in a measure.
- 750 * 4 = 3,000MS or 3 seconds.
- So with this I can convert to deciseconds.
- ]]
- --keys
- local availablePatterns={}
- addPattern=function(name)
- -- local chan=origPattern.channels
- -- local nstepchan=origPattern.nstepchannels
- local testn=0
- for _,v in pairs(patterns) do
- testn=testn+1
- end
- --[[
- local actualchan=chan
- for _,v in pairs(actualchan) do
- if v.stepz then
- for a,b in pairs(v.stepz) do
- b.On.Value=false
- b.BrickColor=BrickColor.new('Really black')
- end
- else
- for a,b in pairs(v.configure) do
- if regkeys[b.Name] then
- b:Destroy()
- end
- end
- end
- end
- ]]
- patterns[name..tostring(testn+1)]={name=name..tostring(testn+1),barlength=1,patternid=testn+1,position=nil,notes={}}
- print(#patterns)
- --print(testn)
- return patterns[name..tostring(testn+1)]
- end
- local machines={
- ['SineBass']={name='SineBass',func=function(prnt,snd)
- local sinwav=snd
- sinwav.SoundId=sinewave.SoundId
- sinwav.Volume=1
- -- local con=config
- -- sinwav.Parent=prnt
- return sinwav
- end};
- ['Pizzi']={name='Pizzi',func=function(prnt,snd)
- local pizzis=snd
- pizzis.SoundId=midpizzi.SoundId
- pizzis.Volume=1
- return pizzis
- end};
- ['Piano']={name='Piano',func=function(prnt,snd)
- local pianoz=snd
- pianoz.SoundId=piano1.SoundId
- pianoz.Volume=5
- return pianoz
- end};
- ['DoubleBass']={name='DoubleBass',func=function(prnt,snd)
- local dbass=snd
- dbass.SoundId=doublebass.SoundId
- dbass.Volume=1
- return dbass
- end};
- ['ElectricBass']={name='ElectricBass',func=function(prnt,snd)
- local dbass=snd
- dbass.SoundId=electricbass.SoundId
- dbass.Volume=1
- return dbass
- end};
- }
- for _,v in pairs(machines) do
- machinestable[v.name]={basemachine=v,nestedmachines={},amount=0}
- end
- addchannel=function(what,pattern,typec)
- if not typec or typec=='step' then
- local num=#channels
- if num==0 then
- num=1
- else
- num=num+1
- end
- local stepz={}
- local channelview=cp(script,'Really black',Vector3.new(1.2,0.5,2),true)
- channelview.CFrame=CFrame.new(10+anm,2,-4.4)*ang(0,mr(180),0)
- local channelgui=int('SurfaceGui',channelview)
- channelgui.Adornee=channelview
- channelgui.Face='Top'
- local channelframe=int('Frame',channelgui)
- channelframe.BackgroundTransparency=0
- channelframe.Size=UDim2.new(1,0,1,0)
- channelframe.BackgroundColor3=BrickColor.new('Bright red').Color
- local channelname=int('TextLabel',channelframe)
- channelname.Size=UDim2.new(1,0,1,0)
- channelname.BackgroundTransparency=1
- channelname.TextScaled=true
- channelname.TextColor3=BrickColor.new('White').Color
- channelname.Text=what.Name
- local con=channelview:clone()
- con.Size=Vector3.new(1.2,0.5,1)
- con.Parent=channelview.Parent
- local conb=con.SurfaceGui.Frame.TextLabel
- conb.Text='cfg'
- con.CFrame=channelview.CFrame*CFrame.new(0,0,1.7)
- local cond=int('ClickDetector',con)
- cond.MouseClick:connect(function(p)
- if p==plr then
- local congui=int('ScreenGui',plr.PlayerGui)
- local conguiframe=int('Frame',congui)
- conguiframe.Size=UDim2.new(0.4,0,0.55,0)
- conguiframe.BackgroundColor=BrickColor.new('Really black')
- conguiframe.BorderSizePixel=0
- conguiframe.Position=UDim2.new(0.3,0,0.225,0)
- conguiframe.Draggable=true
- local x=int('TextButton',conguiframe)
- x.Text='X'
- x.ZIndex=5
- x.Size=UDim2.new(0.05,0,0.05,0)
- x.Position=UDim2.new(0.95,0,0,0)
- x.BackgroundColor=BrickColor.new('Bright red')
- x.TextColor3=BrickColor.new('White').Color
- x.TextScaled=true
- x.MouseButton1Down:connect(function()
- congui:Destroy()
- end)
- local trackr=int('TextBox',conguiframe)
- trackr.Size=UDim2.new(0.5,0,0.2,0)
- trackr.Position=UDim2.new(0.25,0,0.4,0)
- trackr.Text='1'
- if channels[num] then
- trackr.Text=tostring(channels[num].track)
- end
- local trackb=int('TextButton',conguiframe)
- trackb.Text='Change track'
- trackb.Size=trackr.Size
- trackb.Position=UDim2.new(0.25,0,0.2,0)
- trackb.MouseButton1Down:connect(function()
- channels[num].track=tonumber(trackr.Text)
- end)
- local trackv=int('TextBox',conguiframe)
- trackv.Size=UDim2.new(0.5,0,0.2,0)
- trackv.Position=UDim2.new(0.25,0,0.8,0)
- trackv.Text='1'
- if channels[num] then
- trackv.Text=tostring(channels[num].volume)
- end
- local trackb2=int('TextButton',conguiframe)
- trackb2.Text='Change volume'
- trackb2.Size=trackr.Size
- trackb2.Position=UDim2.new(0.25,0,0.6,0)
- trackb2.MouseButton1Down:connect(function()
- channels[num].volume=tonumber(trackv.Text)
- end)
- end
- end)
- for i=1,16 do
- local stp=int('Part',script)
- stp.Anchored=true
- stp.BrickColor=BrickColor.new('Really black')
- stp.TopSurface='SmoothNoOutlines'
- stp.BottomSurface='SmoothNoOutlines'
- stp.LeftSurface='SmoothNoOutlines'
- stp.RightSurface='SmoothNoOutlines'
- stp.FrontSurface='SmoothNoOutlines'
- stp.BackSurface='SmoothNoOutlines'
- stp.Size=Vector3.new(1.1,0.4,1.1)
- stp.CFrame=CFrame.new(10+anm,2,(i*1.4)-3.4)
- stp.Material='SmoothPlastic'
- stp.Name='Step'
- local oval=int('BoolValue',stp)
- oval.Name='On'
- local ptrnon=int('BoolValue',oval)
- ptrnon.Name=pattern.name
- ptrnon.Value=false
- oval.Value=false
- local blo=int('BlockMesh',stp)
- local cd=int("ClickDetector",stp)
- cd.MaxActivationDistance=100
- cd.MouseClick:connect(function(p)
- if p==plr then
- --if oval.Value==false then
- if ptrnon.Name~=currentPattern and not oval:findFirstChild(currentPattern) then
- local npn=ptrnon:clone()
- npn.Parent=oval
- npn.Name=currentPattern
- npn.Value=true
- stp.BrickColor=bc('Bright red')
- stp.Material='Neon'
- else
- if oval:findFirstChild(currentPattern).Value==false then
- oval:findFirstChild(currentPattern).Value=true
- -- ptrnon.Value=true
- stp.BrickColor=bc('Bright red')
- stp.Material='Neon'
- else
- oval:findFirstChild(currentPattern).Value=false
- stp.BrickColor=bc('Really black')
- stp.Material='SmoothPlastic'
- end
- end
- -- else
- -- oval.Value=false
- -- ptrnon.Value=false
- -- stp.BrickColor=bc('Really black')
- -- stp.Material='SmoothPlastic'
- end
- -- end
- end)
- cd.MouseHoverEnter:connect(function(p)
- if p==plr then
- blo.Scale=Vector3.new(1.2,1.2,1.2)
- end
- end)
- cd.MouseHoverLeave:connect(function(p)
- if p==plr then
- blo.Scale=Vector3.new(1,1,1)
- end
- end)
- stepz[i]=stp
- end
- channels[num]={stepz=stepz,what=what,num=num,track=1,pattern=pattern,volume=1}
- --pattern.channels[num]=origPattern.channels[num]
- anm=anm-1.4
- return channels[num]
- end
- end
- local lol=int('LocalScript',workspace)
- script.Parent=workspace
- local testpat=addPattern('Pattern')
- currentPattern=testpat.name
- realCurrentPattern=testpat
- print('Current pattern: ' .. currentPattern)
- local dispp=cp(script,'White',Vector3.new(1,5,5),true)
- dispp.CFrame=CFrame.new(14,5,1.4)
- dispp.Transparency=1
- for _,v in pairs(samples) do
- v.Parent=dispp
- end
- local dispgui=int('SurfaceGui',dispp)
- dispgui.Adornee=dispp
- dispgui.Face='Left'
- local frm=int('Frame',dispgui)
- frm.Size=UDim2.new(1,0,1,0)
- frm.BackgroundColor3=BrickColor.new('Really black').Color
- local bpmc=int('TextLabel',frm)
- bpmc.TextColor3=BrickColor.new('White').Color
- bpmc.BackgroundTransparency=1
- bpmc.Size=UDim2.new(1,0,0.25,0)
- bpmc.Font='SourceSansLight'
- bpmc.TextScaled=true
- bpmc.Text=tostring('BPM: ' .. bpm)
- local pat=int('TextLabel',frm)
- pat.TextColor3=BrickColor.new('White').Color
- pat.BackgroundTransparency=1
- pat.Size=UDim2.new(1,0,0.5,0)
- pat.Font='SourceSansLight'
- pat.TextScaled=true
- pat.Text=tostring('Pattern: ' .. currentPattern)
- local trck=int('TextLabel',frm)
- trck.TextColor3=BrickColor.new('White').Color
- trck.BackgroundTransparency=1
- trck.Size=UDim2.new(1,0,0.75,0)
- trck.Font='SourceSansLight'
- trck.TextScaled=true
- trck.Text=tostring('channels: ' .. #channels)
- local bcn=cp(script,'Really black',Vector3.new(0.5,3,3),true)
- bcn.Transparency=0
- bcn.CFrame=dispp.CFrame*CFrame.new(0,0,4.7)
- local cgui=int('SurfaceGui',dispp)
- cgui.Adornee=bcn
- cgui.Face='Left'
- local frm2=int('Frame',cgui)
- frm2.Size=UDim2.new(1,0,1,0)
- frm2.BackgroundColor3=BrickColor.new('Really black').Color
- local cnt=int('TextLabel',frm2)
- cnt.TextColor3=BrickColor.new('White').Color
- cnt.BackgroundTransparency=1
- cnt.Size=UDim2.new(1,0,1,0)
- cnt.TextScaled=true
- cnt.Text=1
- local nonsq=cp(script,'Really black',Vector3.new(0.5,5,6),true)
- nonsq.CFrame=dispp.CFrame*CFrame.new(0,0,10)
- nonsq.Transparency=0
- local nonsqg=int('SurfaceGui',nonsq)
- nonsqg.Adornee=nonsq
- nonsqg.Face='Left'
- local nonsqf=int('ScrollingFrame',nonsqg)
- nonsqf.Size=UDim2.new(1,0,1,0)
- nonsqf.BackgroundColor3=BrickColor.new('Really black').Color
- local can3=false
- local sampleguip=cp(script,'Really black',Vector3.new(0.5,6,6),true)
- sampleguip.CFrame=dispp.CFrame*CFrame.new(0,0,-7)
- local samplegui=int('SurfaceGui',sampleguip)
- samplegui.Adornee=sampleguip
- samplegui.Face='Left'
- local cde3=int('ClickDetector',sampleguip)
- local sampleguiframe=int('ScrollingFrame',samplegui)
- sampleguiframe.Size=UDim2.new(1,0,1,0)
- sampleguiframe.BackgroundTransparency=1
- sampleguiframe.CanvasSize=UDim2.new(1,0,0.1*#samples,0)
- local patternguip=sampleguip:clone()
- patternguip.Size=Vector3.new(1,4,4)
- patternguip.CFrame=dispp.CFrame*CFrame.new(0,0,23)
- local patterngui=patternguip.SurfaceGui
- local patternguiframe=patterngui.ScrollingFrame
- patternguiframe.CanvasSize=UDim2.new(1,0,1,0)
- patternguip.Parent=script
- local apn=0
- local cde4=patternguip.ClickDetector
- local can4=false
- cde4.MouseHoverEnter:connect(function(p)
- if p==plr then
- can4=true
- end
- end)
- cde4.MouseHoverLeave:connect(function(p)
- if p==plr then
- can4=false
- end
- end)
- addPatternToGui=function(pattern)
- local newb=int('TextButton',patternguiframe)
- newb.Text=pattern.name
- newb.Size=UDim2.new(0.9,0,0.1,0)
- newb.BackgroundColor3=BrickColor.new('Bright red').Color
- newb.TextColor3=BrickColor.new('White').Color
- newb.ZIndex=3
- newb.TextScaled=true
- newb.Position=UDim2.new(0,0,apn/10,0)
- local con=newb:clone()
- con.Parent=patternguiframe
- con.Text='C'
- con.Position=UDim2.new(0.9,0,newb.Position.Y.Scale,0)
- con.MouseButton1Down:connect(function()
- local congui=int('ScreenGui',plr.PlayerGui)
- local conguiframe=int('Frame',congui)
- conguiframe.Size=UDim2.new(0.4,0,0.55,0)
- conguiframe.BackgroundColor=BrickColor.new('Really black')
- conguiframe.BorderSizePixel=0
- conguiframe.Position=UDim2.new(0.3,0,0.225,0)
- local x=int('TextButton',conguiframe)
- x.Text='X'
- x.ZIndex=5
- x.Size=UDim2.new(0.05,0,0.05,0)
- x.Position=UDim2.new(0.95,0,0,0)
- x.BackgroundColor=BrickColor.new('Bright red')
- x.TextColor3=BrickColor.new('White').Color
- x.TextScaled=true
- x.MouseButton1Down:connect(function()
- congui:Destroy()
- end)
- local ren=int('TextBox',conguiframe)
- ren.Text=''
- ren.Size=UDim2.new(0.4,0,0.1,0)
- ren.Position=UDim2.new(0.3,0,0.6,0)
- local rb=int('TextButton',conguiframe)
- rb.Text='Rename'
- rb.Size=UDim2.new(0.2,0,0.1,0)
- rb.Position=UDim2.new(0.4,0,0.45,0)
- rb.MouseButton1Down:connect(function()
- local exists=false
- for _,v in pairs(patterns) do
- if v.name==ren.Text then
- exists=true
- break
- end
- end
- if not patterns[ren.Text] and not exists then
- local oldname=pattern.name
- pattern.name=ren.Text
- currentPattern=ren.Text
- for _,v in pairs(channels) do
- if v.configure then
- if v.configure:findFirstChild(oldname) then
- v.configure:findFirstChild(oldname).Name=pattern.name
- end
- end
- if v.stepz then
- for a,b in pairs(v.stepz) do
- if b.On and b.On:findFirstChild(oldname) then
- b.On:findFirstChild(oldname).Name=pattern.name
- end
- end
- end
- end
- newb.Text=pattern.name
- end
- end)
- end)
- newb.MouseButton1Down:connect(function()
- currentPattern=pattern.name
- realCurrentPattern=pattern
- count16=0
- pat.Text=tostring('Pattern: ' .. currentPattern)
- for _,v in pairs(channels) do
- if v.stepz then
- for a,b in pairs(v.stepz) do
- --b.On.Value=false
- b.BrickColor=BrickColor.new('Really black')
- b.Material='SmoothPlastic'
- end
- end
- local cnn=false
- if v.stepz then
- for a,b in pairs(v.stepz) do
- if b.On:findFirstChild(currentPattern) then
- cnn=true
- break
- end
- end
- end
- if v.configure and v.configure:findFirstChild(currentPattern) or cnn==true then
- if v.stepz then
- for a, b in pairs(v.stepz) do
- if b.On and b.On:findFirstChild(currentPattern) and b.On:findFirstChild(currentPattern).Value==true then
- b.BrickColor=BrickColor.new('Bright red')
- b.Material='Neon'
- end
- end
- end
- end
- end
- end)
- apn=apn+1
- print('asd'..newb.Parent.Name)
- end
- for _,v in pairs(patterns) do
- if v.name~='origPattern' then
- addPatternToGui(v)
- end
- end
- local apbutton=cp(script,'Really black',Vector3.new(0.5,1,2),true)
- apbutton.CFrame=patternguip.CFrame*CFrame.new(0,3.5,0)
- local apg=int('SurfaceGui',apbutton)
- apg.Adornee=apbutton
- apg.Face='Left'
- local apf=int('Frame',apg)
- apf.Size=UDim2.new(1,0,1,0)
- local apbut=int('TextLabel',apf)
- apbut.Size=UDim2.new(1,0,1,0)
- apbut.Text='Add pattern'
- apbut.TextScaled=true
- apbut.TextColor3=BrickColor.new('White').Color
- apbut.BackgroundColor=BrickColor.new('Bright red')
- local cdeb=int('ClickDetector',apbutton)
- cdeb.MouseClick:connect(function(p)
- if p==plr then
- local num=#patterns
- local tnum=num+1
- local newp=addPattern('Pattern')
- addPatternToGui(newp)
- end
- end)
- cde3.MouseHoverEnter:connect(function(p)
- if p==plr then
- can3=true
- end
- end)
- cde3.MouseHoverLeave:connect(function(p)
- if p==plr then
- can3=false
- end
- end)
- local sguis=1
- for _,v in pairs(samples) do
- local repr=int('TextButton',sampleguiframe)
- repr.Text=v.Name
- repr.Font='SourceSansLight'
- repr.TextColor3=BrickColor.new('White').Color
- repr.TextScaled=true
- repr.BackgroundColor3=BrickColor.new('Bright red').Color
- repr.Size=UDim2.new(1,0,1/#samples,0)
- repr.Position=UDim2.new(0,0,1-(sguis/#samples),0)
- sguis=sguis+1
- repr.MouseButton1Down:connect(function()
- if can3 then
- addchannel(v,testpat)
- end
- end)
- end
- local available=nonsq:clone()
- available.Parent=nonsq.Parent
- available.CFrame=nonsq.CFrame*CFrame.new(0,0,7)
- local avg=available.SurfaceGui
- local avf=avg.ScrollingFrame
- local avn=0
- local can2=false
- local cde2=int('ClickDetector',available)
- cde2.MouseHoverEnter:connect(function(p)
- if p==plr then
- can2=true
- end
- end)
- cde2.MouseHoverLeave:connect(function(p)
- if p==plr then
- can2=false
- end
- end)
- local song={}
- local songmode=false
- local song16=1
- local songbar=1
- local onebar=16
- local global16=1
- local patternsPlaying={}
- local sb1=cp(script,'Really black',Vector3.new(0.5,2,4),true)
- sb1.CFrame=dispp.CFrame*CFrame.new(0,10,0)
- local sb1g=int('SurfaceGui',sb1)
- sb1g.Adornee=sb1
- sb1g.Face='Left'
- local sb1f=int('Frame',sb1g)
- sb1f.Size=UDim2.new(1,0,1,0)
- sb1f.BackgroundColor=BrickColor.new('Bright red')
- local sb1tl=int('TextLabel',sb1f)
- sb1tl.Size=UDim2.new(1,0,1,0)
- sb1tl.Text='Song'
- sb1tl.TextScaled=true
- sb1tl.TextColor3=BrickColor.new('White').Color
- sb1tl.BackgroundColor=sb1f.BackgroundColor
- local sb2=sb1:clone()
- sb2g=sb2.SurfaceGui
- sb2.Parent=sb1.Parent
- sb2g.Frame.TextLabel.Text='Ptrn'
- sb2.CFrame=sb1.CFrame*CFrame.new(0,0,4)
- local sbc1=int('ClickDetector',sb1)
- sbc1.MouseClick:connect(function(p)
- songmode=true
- song16=1
- songbar=1
- end)
- local sbc2=int('ClickDetector',sb2)
- sbc2.MouseClick:connect(function(p)
- songmode=false
- song16=1
- songbar=1
- end)
- local patgui=int('ScreenGui',plr.PlayerGui)
- local patframe=int('ScrollingFrame',patgui)
- patframe.Size=UDim2.new(0.6,0,0.5,0)
- patframe.Position=UDim2.new(0.2,0,0.25,0)
- local pathide=int('TextButton',patgui)
- pathide.Size=UDim2.new(0.1,0,0.05,0)
- pathide.Text='Hide song'
- pathide.Position=UDim2.new(0.9,0,0.8,0)
- pathide.MouseButton1Down:connect(function()
- if patframe.Visible==false then
- patframe.Visible=true
- else
- patframe.Visible=false
- end
- end)
- local pii=0
- for i=1,10 do
- local long=int('Frame',patframe)
- long.Size=UDim2.new(1,0,0.1,0)
- long.Position=UDim2.new(0,0,pii/10,0)
- local pii2=0
- for o=1,16 do
- local barz=int('TextButton',long)
- barz.Size=UDim2.new(1/16,0,1,0)
- barz.Position=UDim2.new(pii2/16,0,0,0)
- barz.BackgroundColor3=bc('Really black').Color
- barz.TextColor3=bc('White').Color
- barz.Text=''
- pii2=pii2+1
- local n=#song+1
- barz.MouseButton1Down:connect(function()
- barz.BackgroundColor3=BrickColor.new('Bright red').Color
- barz.Text=currentPattern
- table.insert(song,{pattern=realCurrentPattern,pos={row=o,column=i},length=1})
- end)
- barz.MouseButton2Down:connect(function()
- barz.BackgroundColor3=BrickColor.new('Bright red').Color
- barz.Text=''
- table.remove(song,n)
- end)
- end
- pii=pii+1
- end
- calculateBPM=function(desiredBPM)
- for i=1,2 do
- bpm=desiredBPM
- local ful=(60000/bpm)*0.1
- local ot=(full)*0.01
- local fb=(other*16)
- local prod=(full*4)*0.01
- full=ful
- other=ot
- fourbar=fb
- product=prod
- bpmc.Text=tostring('BPM: ' .. bpm)
- end
- end
- for _,v in pairs(machines) do
- local but=int('TextButton',avf)
- but.Size=UDim2.new(1,0,0.1,0)
- but.Position=UDim2.new(0,0,avn,0)
- but.Text=v.name
- but.Font='SourceSansLight'
- but.TextScaled=true
- but.BackgroundColor3=BrickColor.new('Bright red').Color
- but.TextColor3=BrickColor.new('White').Color
- but.MouseButton1Down:connect(function()
- if can2 then
- local a=addNonStepChannel(machines[v.name],testpat)
- refreshNonStepChannels(testpat,1)
- end
- end)
- avn=avn+0.1
- end
- local cde=int('ClickDetector',nonsq)
- cde.MaxActivationDistance=100
- local can=false
- cde.MouseHoverEnter:connect(function(p)
- if p==plr then
- can=true
- end
- end)
- cde.MouseHoverLeave:connect(function(p)
- if p==plr then
- can=false
- end
- end)
- for i=1,6 do
- addTrack(dispp)
- end
- local count=1
- local count16=1
- local regkeys={
- ['C']='C';
- ['C#']='C#';
- ['D']='D';
- ['D#']='D#';
- ['E']='E';
- ['F']='F';
- ['F#']='F#';
- ['G']='G';
- ['G#']='G#';
- ['A']='A';
- ['A#']='A#';
- ['B']='B';
- }
- local numkeys={
- [1]='C';
- [2]='C#';
- [3]='D';
- [4]='D#';
- [5]='E';
- [6]='F';
- [7]='F#';
- [8]='G';
- [9]='G#';
- [10]='A';
- [11]='A#';
- [12]='B';
- }
- local pitches={
- ['C5']=1;--1.2
- ['C#5']=1+(1/12);--1.26
- ['D5']=1+(1/12)*2;--1.3
- ['D#5']=1+(1/12)*3;--1.4
- ['E5']=1+(1/12)*4;--1.5
- ['F5']=1+(1/12)*5;--1.6
- ['F#5']=1+(1/12)*6;--1.7
- ['G5']=1+(1/12)*7;--1.8
- ['G#5']=1+(1/12)*8;--1.9
- ['A5']=1+(1/12)*9;--2
- ['A#5']=1+(1/12)*10;--2.1
- ['B5']=1+(1/12)*11;--2.2
- }
- tuneTable={
- ['piano']=1;
- ['sine']=1.2;
- }
- pitchCalc=function(c)
- local cs=c+.06
- local d=c+0.1
- end
- local chatcon=plr.Chatted:connect(function(chat)
- if chat=='rem' then
- done=true
- script:Destroy()
- script.Disabled=true
- end
- if string.sub(chat,1,4)=='tune' then
- local brk1=1
- for i=1,string.len(chat)-6 do
- if string.sub(chat,6+i,6+i)==' ' then
- brk1=6+i
- break
- end
- end
- local key=string.sub(chat,6,brk1-1)
- print('Key tuned: ' .. key)
- local pc=string.sub(chat,brk1+1)
- local up=string.upper(key)
- pitches[up]=tonumber(pc)
- elseif string.sub(chat,1,3)=='bpm' then
- local bpc=string.sub(chat,5)
- calculateBPM(tonumber(bpc))
- end
- end)
- for _,v in pairs(regkeys) do
- pitches[v..4]=pitches[v..5]/2
- end
- for _,v in pairs(regkeys) do
- pitches[v..3]=pitches[v..4]/2
- end
- for _,v in pairs(regkeys) do
- pitches[v..2]=pitches[v..3]/2
- end
- for _,v in pairs(regkeys) do
- pitches[v..1]=pitches[v..2]/2
- end
- for _,v in pairs(regkeys) do
- pitches[v..6]=pitches[v..5]*2
- end
- for _,v in pairs(regkeys) do
- pitches[v..7]=pitches[v..6]*2
- end
- local octaves=7
- local tn=-1
- local currentpiano
- local currentchannel
- local prollgui=int('ScreenGui',plr.PlayerGui)
- local prf=int('ScrollingFrame',prollgui)
- prf.Visible=false
- prf.Size=UDim2.new(0.7,0,0.7,0)
- prf.Position=UDim2.new(0.2,0,0.2,0)
- prf.CanvasSize=UDim2.new(1,0,0.5*octaves,0)
- local hb=int('TextButton',prollgui)
- hb.Text='Hide'
- hb.BackgroundColor=bc('Bright red')
- hb.TextColor3=bc('White').Color
- hb.TextScaled=true
- hb.Font='SourceSansLight'
- hb.Size=UDim2.new(0.1,0,0.1,0)
- hb.Position=UDim2.new(0.9,0,0.5,0)
- hb.MouseButton1Down:connect(function()
- if prf.Visible==false then
- prf.Visible=true
- else
- prf.Visible=false
- end
- end)
- local lfc=int('Configuration',script)
- lfc.Name='Piano Roll'
- local cfig
- local sqfnum=0
- refreshNonStepChannels=function(pattern)
- sqfnum=0
- nonsqf:ClearAllChildren()
- for _,v in pairs(channels) do
- if v.configure then
- local machine=v.what
- local ncfg=v.configure
- local nb=int('TextButton',nonsqf)
- nb.Text=machine.name
- nb.Font='SourceSansLight'
- nb.TextScaled=true
- nb.BackgroundColor3=BrickColor.new('Bright red').Color
- nb.TextColor3=BrickColor.new('White').Color
- nb.Size=UDim2.new(0.8,0,0.1,0)
- nb.Position=UDim2.new(0,0,sqfnum,0)
- local p=int('TextButton',nonsqf)
- p.Text='P'
- p.FontSize='Size24'
- p.BackgroundColor3=BrickColor.new('Bright red').Color
- p.TextColor3=BrickColor.new('White').Color
- p.Size=UDim2.new(0.1,0,0.1,0)
- p.Position=UDim2.new(0.9,0,sqfnum,0)
- local d=p:clone()
- d.Parent=p.Parent
- d.Text='D'
- d.Position=UDim2.new(0.8,0,sqfnum,0)
- --d.Parent=p.Parent
- d.MouseButton1Down:connect(function()
- if can then
- channels[_]=nil
- nb:Destroy()
- p:Destroy()
- d:Destroy()
- refreshNonStepChannels(pattern,nm)
- end
- end)
- p.MouseButton1Down:connect(function()
- if can then
- currentpiano=machine
- currentchannel=v
- cfig=ncfg
- showPianoRoll()
- print(#channels)
- end
- end)
- sqfnum=sqfnum+0.1
- end
- end
- end
- addNonStepChannel=function(machine,pattern)
- if type(machine) and type(machine)=='table' then
- local num=#channels
- refreshNonStepChannels(pattern,num+1)
- local amt=#machinestable[machine.name].nestedmachines
- machinestable[machine.name].amount=machinestable[machine.name].amount+1
- machinestable[machine.name].nestedmachines[machine.name..tostring(machinestable[machine.name].amount)]={name=machine.name..tostring(machinestable[machine.name].amount),machineid=amt+1,basemachine=machine.name,func=machine.func}
- print(machinestable[machine.name].amount)
- local ncfg=int('Part',script)
- ncfg.Anchored=true
- ncfg.Size=Vector3.new(1,1,1)
- ncfg.Transparency=1
- ncfg.CFrame=dispp.CFrame
- ncfg.Name=machine.name..tostring(machinestable[machine.name].amount)
- local bm=int('StringValue',ncfg)
- bm.Name='BaseMachine'
- bm.Value=machine.name
- -- origPattern.channels[num+1]={what=machinestable[machine.name].nestedmachines[machine.name..tostring(machinestable[machine.name].amount)],configure=ncfg,track=1,id=plugid,notes={}}
- channels[num+1]={what=machinestable[machine.name].nestedmachines[machine.name..tostring(machinestable[machine.name].amount)],configure=ncfg,track=1,id=plugid,pattern=pattern}--origPattern.channels[num+1]
- plugid=plugid+1
- sqfnum=sqfnum+0.1
- return channels[num+1],plugid
- end
- end
- mouse.KeyDown:connect(function(key)
- if key=='l' then
- -- print('#Channels=' .. #origPattern.channels)
- print('#Children=' .. #script:GetChildren())
- end
- end)
- showPianoRoll=function()
- prf:ClearAllChildren()
- local ind=0
- local octave=1
- for x=1,octaves do
- for i=1,#numkeys do
- if not string.sub(numkeys[i],1,2):match('#') then
- ind=ind+1
- else
- ind=ind+1
- end
- local reg=int('TextButton',prf)
- reg.Size=UDim2.new(0.1,0,(1/#numkeys)/octaves,0)
- reg.Text=numkeys[i] .. octave
- reg.BackgroundColor3=BrickColor.new('White').Color
- reg.Position=UDim2.new(0,0,1-(ind/#numkeys)/octaves,0)
- if string.sub(numkeys[i],1,2):match('#') then
- reg.ZIndex=3
- reg.TextColor3=BrickColor.new('White').Color
- reg.BackgroundColor3=BrickColor.new('Really black').Color
- end
- local divides=16
- local lm=0
- for i=1,divides do
- if not piano[reg.Text] then
- piano[reg.Text]={}
- end
- local on=false
- local lfram=int('TextButton',prf)
- lfram.BackgroundColor3=bc('Really black').Color
- lfram.Text=''
- --local npm=#piano+1
- local lframval
- local steppos
- lfram.Size=UDim2.new((1-reg.Size.X.Scale)/divides,0,(1/#numkeys)/octaves,0)
- lfram.Position=UDim2.new(reg.Position.X.Scale+reg.Size.X.Scale+((i-1)*lfram.Size.X.Scale),0,reg.Position.Y.Scale,0)
- steppos=int('NumberValue',lfram)
- steppos.Name='StepPos'
- steppos.Value=i
- if cfig:findFirstChild(currentPattern) then
- for _,v in pairs(cfig[currentPattern]:GetChildren()) do
- if reg.Text==v.Name then
- print'hasname'
- if v.Value==i then
- if v.NoteSize.Value==1 then
- lfram.BackgroundColor3=BrickColor.new('Bright red').Color
- on=true
- lframval=v
- else
- lframval=v
- local ff=lfram:clone()
- ff.Parent=lfram.Parent
- ff.Name='Fake'
- ff.Position=lfram.Position
- ff.ZIndex=lfram.ZIndex+2
- ff.BackgroundColor3=BrickColor.new('Bright red').Color
- print(lfram.Position)
- --print(0.05+(1/16))
- local dist=(v.NoteSize.Value*lfram.Size.X.Scale)---lfram.Position.X.Scale
- print(dist)
- ff.Size=UDim2.new(dist,0,lfram.Size.Y.Scale,0)
- -- selection.val.NoteSize.Value=lfram.StepPos.Value-(selection.frm.StepPos.Value-1)
- -- print(selection.val.NoteSize.Value)
- -- selection.fakefrm.ZIndex=10
- -- print'did'
- ff.MouseButton2Down:connect(function()
- ff.Size=UDim2.new(0,0,0,0)
- lfram.BackgroundColor3=BrickColor.new('Really black').Color
- lframval:Destroy()
- selected=false
- selection=nil
- on=false
- ff:Destroy()
- end)
- ff.MouseButton1Down:connect(function()
- if selected then
- ff.BackgroundColor3=BrickColor.new('Bright red').Color
- selected=false
- selection=nil
- else
- ff.BackgroundColor3=BrickColor.new('Bright blue').Color
- selection={frm=lfram,val=lframval,fakefrm=ff}
- selected=true
- end
- end)
- end
- end
- end
- end
- end
- lfram.MouseButton2Down:connect(function()
- if on==true then
- lfram.BackgroundColor3=BrickColor.new('Really black').Color
- lfram:clearAllChildren()
- lframval:Destroy()
- on=false
- end
- end)
- lfram.MouseButton1Down:connect(function()
- if on==false and not selected then
- lfram.BackgroundColor3=BrickColor.new('Bright red').Color
- local pval
- if cfig:findFirstChild(currentPattern) then
- pval=cfig[currentPattern]
- else
- pval=int('StringValue',cfig)
- pval.Name=currentPattern
- pval.Value=currentPattern
- end
- lframval=int('NumberValue',pval)
- lframval.Name=reg.Text
- lframval.Value=i
- local size=lframval:clone()
- size.Parent=lframval
- size.Name='NoteSize'
- size.Value=1
- on=true
- else
- if not selected and not selection then
- lfram.BackgroundColor3=BrickColor.new('Bright red').Color
- local ff=lfram:clone()
- ff.Parent=lfram.Parent
- ff.Name='Fake'
- ff.Position=lfram.Position
- ff.BackgroundColor3=BrickColor.new('Bright blue').Color
- selected=true
- ff.MouseButton2Down:connect(function()
- ff.Size=UDim2.new(0,0,0,0)
- lfram.BackgroundColor3=BrickColor.new('Really black').Color
- lframval:Destroy()
- selected=false
- selection=nil
- on=false
- ff:Destroy()
- end)
- ff.MouseButton1Down:connect(function()
- if selected then
- ff.BackgroundColor3=BrickColor.new('Bright red').Color
- selected=false
- selection=nil
- else
- ff.BackgroundColor3=BrickColor.new('Bright blue').Color
- selection={frm=lfram,val=lframval,fakefrm=ff}
- selected=true
- end
- end)
- selection={frm=lfram,val=lframval,fakefrm=ff}
- end
- if selected and selection.frm~=lfram then
- print(lfram.Position)
- --print(0.05+(1/16))
- local dist=lfram.Position.X.Scale-selection.frm.Position.X.Scale
- print(dist)
- selection.fakefrm.Size=UDim2.new(dist+(1-reg.Size.X.Scale)/divides,0,selection.frm.Size.Y.Scale,0)
- selection.val.NoteSize.Value=lfram.StepPos.Value-(selection.frm.StepPos.Value-1)
- print(selection.val.NoteSize.Value)
- selection.fakefrm.ZIndex=10
- end
- end
- end)
- end
- local sop
- reg.MouseButton1Down:connect(function()
- if currentpiano then
- local snd
- for x,z in pairs(soundtable) do
- if not z.inUse then
- snd=z.snd
- z.inUse=true
- z.timeLeft=((other/4)*3)
- break
- end
- end
- --local sgroup=int('SoundGroup',game:GetService'SoundService')
- local sound=currentpiano.func(cfig,snd)
- sop=sound
- -- print(sound)
- --game.Debris:AddItem(sound,sound.TimeLength)
- sound.PlaybackSpeed=pitches[reg.Text]
- sound:Play()
- end
- end)
- reg.MouseButton1Up:connect(function()
- if sop then
- sop:Stop()
- end
- end)
- tn=tn+1
- end
- octave=octave+1
- end
- end
- --loudness manager
- spawn(function()
- while wait() do
- --for _,v in pairs(patterns) do
- for i=1,#tracks do
- local totalloudness=0
- for c,z in pairs(channels) do
- if i==z.track then
- if not z.configure then
- -- tracks[b.track].tgui.Frame.Size=UDim2.new(1,0,b.what.PlaybackLoudness/1000,0)
- totalloudness=totalloudness+z.what.PlaybackLoudness
- else
- local avl=0
- local nmb=0
- for n,m in pairs(z.configure:GetChildren()) do
- if m.className=='Sound' and m.PlaybackLoudness>0 then
- avl=avl+m.PlaybackLoudness
- nmb=nmb+1
- end
- end
- totalloudness=totalloudness+(avl/nmb)
- end
- end
- end
- tracks[i].tgui.Frame.Size=UDim2.new(1,0,totalloudness/1000,0)
- tracks[i].tgui.Frame.Position=UDim2.new(0,0,1-(totalloudness/1000),0)
- end
- --end
- end
- end)
- while wait(other/4) do --0.03
- if songmode==true then
- if songbar==onebar then
- songbar=1
- end
- for _,v in pairs(song) do
- if v.pos.row==songbar then
- if not patternsPlaying[v.pattern.name] then
- patternsPlaying[v.pattern.name]={name=v.pattern.name,pattern=v.pattern,prog=1}
- print'patternplaying'
- local c16=1
- end
- else
- -- if patternsPlaying[v.pattern.name] then
- -- patternsPlaying[v.pattern.name]=nil
- -- end
- end
- end
- --print('playing: ' .. #patternsPlaying)
- --print(songbar)
- --song16=song16+1
- for n,m in pairs(patternsPlaying) do
- for _,v in pairs(channels) do
- if not v.configure then
- if v.stepz[m.prog] and v.stepz[m.prog].On:findFirstChild(m.name) and v.stepz[m.prog].On:findFirstChild(m.name).Value==true then
- v.what:Play()
- --m.prog=m.prog+1
- end
- else
- local lfc=v.configure
- if #lfc:GetChildren()>0 then
- for a,b in pairs(lfc:GetChildren()) do
- if b.Name==m.name then
- --print('its there')
- for _,v in pairs(b:GetChildren()) do
- if v.className~='Sound' then
- if v.Value==m.prog then
- local snd
- for x,z in pairs(soundtable) do
- if not z.inUse then
- snd=z.snd
- z.inUse=true
- z.timeLeft=((other/4)*v.NoteSize.Value)---(other/4)
- break
- end
- end
- --local sgroup=int('SoundGroup',game:GetService'SoundService')
- if snd then
- local sinwave=machinestable[lfc.BaseMachine.Value].nestedmachines[lfc.Name].func(dispp,snd)
- if sinwave.Parent~=lfc then
- sinwave.Parent=lfc
- end
- --sinwave.SoundGroup=sgroup
- --sinwave.Parent=sinewave.Parent
- sinwave.PlaybackSpeed=pitches[v.Name]
- sinwave:Play()
- --print'played'
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- if songmode==true then
- global16=global16+1
- if song16>=16 then
- songbar=songbar+1
- song16=1
- else
- song16=song16+1
- end
- for _,v in pairs(patternsPlaying) do
- if v.prog<16 then
- v.prog=v.prog+1
- else
- patternsPlaying[v.name]=nil
- end
- end
- end
- for _,v in pairs(soundtable) do
- if v.timeLeft>0 then
- v.timeLeft=v.timeLeft-(other/4)
- else
- if v.inUse then
- v.inUse=false
- v.snd:Stop()
- end
- end
- end
- if not done then
- if not songmode then
- -- for _,v in pairs(patterns) do
- for _,v in pairs(channels) do
- if not v.configure then
- if v.stepz[count16] and v.stepz[count16].On:findFirstChild(currentPattern) and v.stepz[count16].On:findFirstChild(currentPattern).Value==true then
- v.what.Volume=v.volume
- v.what:Play()
- end
- else
- local lfc=v.configure
- if #lfc:GetChildren()>0 then
- for a,b in pairs(lfc:GetChildren()) do
- if b.Name==currentPattern then
- --print('its there')
- for _,v in pairs(b:GetChildren()) do
- if v.className~='Sound' then
- if v.Value==count16 then
- local snd
- for x,z in pairs(soundtable) do
- if not z.inUse then
- snd=z.snd
- z.inUse=true
- z.timeLeft=((other/4)*v.NoteSize.Value)-(other/4)
- break
- end
- end
- --local sgroup=int('SoundGroup',game:GetService'SoundService')
- if snd then
- local sinwave=machinestable[lfc.BaseMachine.Value].nestedmachines[lfc.Name].func(dispp,snd)
- if sinwave.Parent~=lfc then
- sinwave.Parent=lfc
- end
- --sinwave.SoundGroup=sgroup
- --sinwave.Parent=sinewave.Parent
- sinwave.PlaybackSpeed=pitches[v.Name]
- sinwave:Play()
- --print'played'
- end
- end
- end
- end
- end
- end
- end
- end
- end
- --end
- if count16/4==1 or count16/4==2 or count16/4==3 or count16/4==4 then
- if count<4 then
- count=count+1
- else
- count=1
- end
- cnt.Text=tostring(count)
- end
- if count16<16 then
- count16=count16+1
- else
- count16=1
- end
- end
- else
- chatcon:Disconnect()
- break
- end
- end
- --hl/https://httpget-inumeration.c9.io/tindj.lua
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement