Advertisement
Guest User

tindj

a guest
Jan 23rd, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 50.45 KB | None | 0 0
  1. --real dj
  2. --tinfold
  3. --problem is there is multiple patterns with the same name. Solve by ids
  4. --
  5. math.randomseed(tick())
  6. plr=game:service'Players'.LocalPlayer
  7. ch,char=plr.Character,plr.Character
  8. hum=ch.Humanoid
  9. --tor,torso,rootpart,rj=ch.Torso,ch.Torso,ch.HumanoidRootPart,ch.HumanoidRootPart.RootJoint
  10. m,mouse=plr:GetMouse(),plr:GetMouse()
  11. cfn,ang,mr,int=CFrame.new,CFrame.Angles,math.rad,Instance.new
  12. bc=BrickColor.new
  13. head=ch.Head
  14. cam=workspace.CurrentCamera
  15. debris=game.Debris
  16. v3 = Vector3.new
  17. cn = CFrame.new
  18. ca2 = CFrame.Angles
  19. mf = math.floor
  20. mran = math.random rn=mran
  21. mrad = math.rad rd=mrad
  22. mdeg = math.deg dg=mdeg
  23. ca = function(x,y,z) return ca2(mrad(x),mrad(y),mrad(z)) end
  24. mran2 = function(a,b) return mran(a*1000,b*1000)/1000 end
  25. ud=UDim2.new
  26. bn = BrickColor.new
  27. c3 = Color3.new
  28.  
  29.  
  30. --gtables
  31. local piano={}
  32. local samples={}
  33. local patterns={}
  34. local tracks={}
  35. local soundtable={}
  36. local machinestable={}
  37. local nstepchannels={}
  38. local channels={}
  39.  
  40. --gbools
  41. local selected=false
  42. currentPattern=nil
  43.  
  44. --gvars
  45. local selection
  46. local origPattern={notes={},name='origPattern'}
  47. local anm=0
  48. local bpm=120
  49.  
  50. local dcs=(60000/bpm)*0.05--one half of a decisecond
  51. local full=(60000/bpm)*0.1--decisecond
  52.  
  53. local product=(full*4)*0.01
  54. local other=(full)*0.01
  55. local fourbar=(other*16)
  56.  
  57. local tim=0
  58. local tvstp=0
  59. local dispp
  60.  
  61. local done=false
  62. local plugid=0
  63.  
  64. local maxSounds=100
  65.  
  66. print('One bar length:' .. product)
  67. print('1 beat length: ' .. other)
  68. print('Four bar length:' .. fourbar)
  69.  
  70. getSound=function(id)
  71. game:service'ContentProvider':Preload('rbxassetid'..tostring(id))
  72. local s=int("Sound",ch.Head)
  73. s.SoundId='rbxassetid://' .. tostring(id)
  74. s.Volume=1
  75. table.insert(samples,s)
  76. return s
  77. end
  78.  
  79. --samples
  80. local box=getSound(150674644)
  81. box.Name='musicbox'
  82. local kick1=getSound(31173820)
  83. kick1.Name='kick1'
  84. local snare1=getSound(31173799)
  85. snare1.Name='snare1'
  86. local hihat1=getSound(31173735)
  87. local ride1=getSound(31173898)
  88. ride1.Name='ride1'
  89. local crash1=getSound(31173771)
  90. crash1.Name='crash1'
  91. local ticks=getSound(151715959)
  92. ticks.Name='ticks'
  93. local vvii=getSound(13032204)
  94. vvii.Name='vvii'
  95. local lowpizzi=getSound(130850227)
  96. lowpizzi.Name='lowpizzi'
  97. local midpizzi=getSound(130850183)
  98. midpizzi.Name='midpizzi'
  99. local sinewave=getSound(672376636)--129562240
  100. sinewave.Name='sinewave'
  101. local pianokey=getSound(584691395)
  102. pianokey.Name='pianokey'
  103. local kick2=getSound(347302817)
  104. kick2.Name='kick2'
  105. local kick3=getSound(222209381)
  106. kick3.Name='kick3'
  107. local snare2=getSound(222209994)
  108. snare2.Name='snare2'
  109. local hihat2=getSound(300636617)
  110. hihat2.Name='hihat2'
  111. local rolandhat=getSound(222208272)
  112. rolandhat.Name='rolandhat'
  113. local rolandkick=getSound(222268696)
  114. rolandkick.Name='rolandkick'
  115. local vox3=getSound(222212508)
  116. vox3.Name='vox3'
  117. local perc3=getSound(222209795)
  118. perc3.Name='perc3'
  119. local fx10=getSound(222208172)
  120. fx10.Name='fx10'
  121. local clap1=getSound(222174146)
  122. clap1.Name='clap1'
  123. local doublebass=getSound(392287871)
  124. doublebass.Name='doublebass'
  125. local electricbass=getSound(392287907)
  126. electricbass.Name='ElectricBass'
  127. local snare4=getSound(222210022)
  128. snare4.Name='snare4'
  129.  
  130. --pianosounds
  131. local piano1=getSound(136786442)
  132. piano1.Volume=10
  133. --392289045
  134. --258309534 long piano key
  135. --430020034 reverby piano
  136.  
  137.  
  138. for i=1,maxSounds do
  139. soundtable[i]={snd=Instance.new('Sound'),inUse=false,timeLeft=0}
  140. end
  141.  
  142. cp=function(parent,color,size,anchored,cancollide)
  143. local newp=Instance.new("Part",parent)
  144. newp.TopSurface='SmoothNoOutlines'
  145. newp.BottomSurface='SmoothNoOutlines'
  146. newp.FrontSurface='SmoothNoOutlines'
  147. newp.BackSurface='SmoothNoOutlines'
  148. newp.RightSurface='SmoothNoOutlines'
  149. newp.LeftSurface='SmoothNoOutlines'
  150. newp.FormFactor="Custom"
  151. newp.BrickColor=bc(color)
  152. newp.Size=size
  153. newp.Anchored=anchored
  154. newp.CanCollide=cancollide
  155. newp:BreakJoints()
  156. return newp
  157. end
  158.  
  159. addTrack=function(cf)
  160. local tracknum=#tracks+1
  161. local trackp=cp(script,'Really black',Vector3.new(0.5,5,1),true)
  162. trackp.CFrame=cf.CFrame*CFrame.new(4,6,tvstp)--*ang(0,mr(180),mr(180))
  163. tvstp=tvstp+1.1
  164. local tgui=int('SurfaceGui',trackp)
  165. tgui.Face='Left'
  166. tgui.Adornee=trackp
  167. local tf=int('Frame',tgui)
  168. tf.BackgroundColor3=BrickColor.new('Bright green').Color
  169. tf.Size=UDim2.new(0.5,0,0,0)
  170. local trackp2=cp(script,'Really black',Vector3.new(0.5,1,1),true)
  171. trackp2.CFrame=trackp.CFrame*CFrame.new(0,-3,0)
  172. local tgui2=int('SurfaceGui',trackp2)
  173. tgui2.Adornee=trackp2
  174. tgui2.Face='Left'
  175. local tf2=int('Frame',tgui2)
  176. tf2.BackgroundColor3=BrickColor.new('Really black').Color
  177. tf2.Size=UDim2.new(1,0,1,0)
  178. tf2.Position=UDim2.new(0,0,0,0)
  179. local con=int('TextButton',tf2)
  180. con.Text='cfg'
  181. con.TextScaled=true
  182. con.Size=UDim2.new(1,0,1,0)
  183. con.BackgroundColor=BrickColor.new('Bright red')
  184. con.TextColor3=BrickColor.new('White').Color
  185. tracks[tracknum]={trackp=trackp,tgui=tgui}
  186. end
  187.  
  188. --[[
  189. BPM to MS conversion example:
  190.  
  191. Say you have a song that is 80 Beats per Minute: 60,000 / 80 = 750MS per Beat.
  192.  
  193. There are 4 beats in a measure.
  194.  
  195. 750 * 4 = 3,000MS or 3 seconds.
  196.  
  197. So with this I can convert to deciseconds.
  198. ]]
  199. --keys
  200.  
  201. local availablePatterns={}
  202.  
  203. addPattern=function(name)
  204. -- local chan=origPattern.channels
  205. -- local nstepchan=origPattern.nstepchannels
  206. local testn=0
  207. for _,v in pairs(patterns) do
  208. testn=testn+1
  209. end
  210. --[[
  211. local actualchan=chan
  212. for _,v in pairs(actualchan) do
  213. if v.stepz then
  214. for a,b in pairs(v.stepz) do
  215. b.On.Value=false
  216. b.BrickColor=BrickColor.new('Really black')
  217. end
  218. else
  219. for a,b in pairs(v.configure) do
  220. if regkeys[b.Name] then
  221. b:Destroy()
  222. end
  223. end
  224. end
  225. end
  226. ]]
  227. patterns[name..tostring(testn+1)]={name=name..tostring(testn+1),barlength=1,patternid=testn+1,position=nil,notes={}}
  228. print(#patterns)
  229.  
  230. --print(testn)
  231. return patterns[name..tostring(testn+1)]
  232. end
  233.  
  234.  
  235. local machines={
  236. ['SineBass']={name='SineBass',func=function(prnt,snd)
  237. local sinwav=snd
  238. sinwav.SoundId=sinewave.SoundId
  239. sinwav.Volume=1
  240. -- local con=config
  241. -- sinwav.Parent=prnt
  242. return sinwav
  243. end};
  244. ['Pizzi']={name='Pizzi',func=function(prnt,snd)
  245. local pizzis=snd
  246. pizzis.SoundId=midpizzi.SoundId
  247. pizzis.Volume=1
  248. return pizzis
  249. end};
  250. ['Piano']={name='Piano',func=function(prnt,snd)
  251. local pianoz=snd
  252. pianoz.SoundId=piano1.SoundId
  253. pianoz.Volume=5
  254. return pianoz
  255. end};
  256. ['DoubleBass']={name='DoubleBass',func=function(prnt,snd)
  257. local dbass=snd
  258. dbass.SoundId=doublebass.SoundId
  259. dbass.Volume=1
  260. return dbass
  261. end};
  262. ['ElectricBass']={name='ElectricBass',func=function(prnt,snd)
  263. local dbass=snd
  264. dbass.SoundId=electricbass.SoundId
  265. dbass.Volume=1
  266. return dbass
  267. end};
  268. }
  269.  
  270. for _,v in pairs(machines) do
  271. machinestable[v.name]={basemachine=v,nestedmachines={},amount=0}
  272. end
  273.  
  274. addchannel=function(what,pattern,typec)
  275. if not typec or typec=='step' then
  276. local num=#channels
  277. if num==0 then
  278. num=1
  279. else
  280. num=num+1
  281. end
  282. local stepz={}
  283. local channelview=cp(script,'Really black',Vector3.new(1.2,0.5,2),true)
  284. channelview.CFrame=CFrame.new(10+anm,2,-4.4)*ang(0,mr(180),0)
  285. local channelgui=int('SurfaceGui',channelview)
  286. channelgui.Adornee=channelview
  287. channelgui.Face='Top'
  288. local channelframe=int('Frame',channelgui)
  289. channelframe.BackgroundTransparency=0
  290. channelframe.Size=UDim2.new(1,0,1,0)
  291. channelframe.BackgroundColor3=BrickColor.new('Bright red').Color
  292. local channelname=int('TextLabel',channelframe)
  293. channelname.Size=UDim2.new(1,0,1,0)
  294. channelname.BackgroundTransparency=1
  295. channelname.TextScaled=true
  296. channelname.TextColor3=BrickColor.new('White').Color
  297. channelname.Text=what.Name
  298. local con=channelview:clone()
  299. con.Size=Vector3.new(1.2,0.5,1)
  300. con.Parent=channelview.Parent
  301. local conb=con.SurfaceGui.Frame.TextLabel
  302. conb.Text='cfg'
  303. con.CFrame=channelview.CFrame*CFrame.new(0,0,1.7)
  304. local cond=int('ClickDetector',con)
  305. cond.MouseClick:connect(function(p)
  306. if p==plr then
  307. local congui=int('ScreenGui',plr.PlayerGui)
  308. local conguiframe=int('Frame',congui)
  309. conguiframe.Size=UDim2.new(0.4,0,0.55,0)
  310. conguiframe.BackgroundColor=BrickColor.new('Really black')
  311. conguiframe.BorderSizePixel=0
  312. conguiframe.Position=UDim2.new(0.3,0,0.225,0)
  313. conguiframe.Draggable=true
  314. local x=int('TextButton',conguiframe)
  315. x.Text='X'
  316. x.ZIndex=5
  317. x.Size=UDim2.new(0.05,0,0.05,0)
  318. x.Position=UDim2.new(0.95,0,0,0)
  319. x.BackgroundColor=BrickColor.new('Bright red')
  320. x.TextColor3=BrickColor.new('White').Color
  321. x.TextScaled=true
  322. x.MouseButton1Down:connect(function()
  323. congui:Destroy()
  324. end)
  325. local trackr=int('TextBox',conguiframe)
  326. trackr.Size=UDim2.new(0.5,0,0.2,0)
  327. trackr.Position=UDim2.new(0.25,0,0.4,0)
  328. trackr.Text='1'
  329. if channels[num] then
  330. trackr.Text=tostring(channels[num].track)
  331. end
  332. local trackb=int('TextButton',conguiframe)
  333. trackb.Text='Change track'
  334. trackb.Size=trackr.Size
  335. trackb.Position=UDim2.new(0.25,0,0.2,0)
  336. trackb.MouseButton1Down:connect(function()
  337. channels[num].track=tonumber(trackr.Text)
  338. end)
  339. local trackv=int('TextBox',conguiframe)
  340. trackv.Size=UDim2.new(0.5,0,0.2,0)
  341. trackv.Position=UDim2.new(0.25,0,0.8,0)
  342. trackv.Text='1'
  343. if channels[num] then
  344. trackv.Text=tostring(channels[num].volume)
  345. end
  346. local trackb2=int('TextButton',conguiframe)
  347. trackb2.Text='Change volume'
  348. trackb2.Size=trackr.Size
  349. trackb2.Position=UDim2.new(0.25,0,0.6,0)
  350. trackb2.MouseButton1Down:connect(function()
  351. channels[num].volume=tonumber(trackv.Text)
  352. end)
  353. end
  354. end)
  355. for i=1,16 do
  356. local stp=int('Part',script)
  357. stp.Anchored=true
  358. stp.BrickColor=BrickColor.new('Really black')
  359. stp.TopSurface='SmoothNoOutlines'
  360. stp.BottomSurface='SmoothNoOutlines'
  361. stp.LeftSurface='SmoothNoOutlines'
  362. stp.RightSurface='SmoothNoOutlines'
  363. stp.FrontSurface='SmoothNoOutlines'
  364. stp.BackSurface='SmoothNoOutlines'
  365. stp.Size=Vector3.new(1.1,0.4,1.1)
  366. stp.CFrame=CFrame.new(10+anm,2,(i*1.4)-3.4)
  367. stp.Material='SmoothPlastic'
  368. stp.Name='Step'
  369. local oval=int('BoolValue',stp)
  370. oval.Name='On'
  371. local ptrnon=int('BoolValue',oval)
  372. ptrnon.Name=pattern.name
  373. ptrnon.Value=false
  374. oval.Value=false
  375. local blo=int('BlockMesh',stp)
  376. local cd=int("ClickDetector",stp)
  377. cd.MaxActivationDistance=100
  378. cd.MouseClick:connect(function(p)
  379. if p==plr then
  380. --if oval.Value==false then
  381. if ptrnon.Name~=currentPattern and not oval:findFirstChild(currentPattern) then
  382. local npn=ptrnon:clone()
  383. npn.Parent=oval
  384. npn.Name=currentPattern
  385. npn.Value=true
  386. stp.BrickColor=bc('Bright red')
  387. stp.Material='Neon'
  388. else
  389. if oval:findFirstChild(currentPattern).Value==false then
  390. oval:findFirstChild(currentPattern).Value=true
  391. -- ptrnon.Value=true
  392. stp.BrickColor=bc('Bright red')
  393. stp.Material='Neon'
  394. else
  395. oval:findFirstChild(currentPattern).Value=false
  396. stp.BrickColor=bc('Really black')
  397. stp.Material='SmoothPlastic'
  398. end
  399. end
  400. -- else
  401. -- oval.Value=false
  402. -- ptrnon.Value=false
  403. -- stp.BrickColor=bc('Really black')
  404. -- stp.Material='SmoothPlastic'
  405. end
  406. -- end
  407. end)
  408. cd.MouseHoverEnter:connect(function(p)
  409. if p==plr then
  410. blo.Scale=Vector3.new(1.2,1.2,1.2)
  411. end
  412. end)
  413. cd.MouseHoverLeave:connect(function(p)
  414. if p==plr then
  415. blo.Scale=Vector3.new(1,1,1)
  416. end
  417. end)
  418. stepz[i]=stp
  419. end
  420. channels[num]={stepz=stepz,what=what,num=num,track=1,pattern=pattern,volume=1}
  421. --pattern.channels[num]=origPattern.channels[num]
  422. anm=anm-1.4
  423. return channels[num]
  424. end
  425. end
  426.  
  427.  
  428.  
  429.  
  430.  
  431. local lol=int('LocalScript',workspace)
  432. script.Parent=workspace
  433.  
  434. local testpat=addPattern('Pattern')
  435.  
  436. currentPattern=testpat.name
  437. realCurrentPattern=testpat
  438. print('Current pattern: ' .. currentPattern)
  439.  
  440. local dispp=cp(script,'White',Vector3.new(1,5,5),true)
  441. dispp.CFrame=CFrame.new(14,5,1.4)
  442. dispp.Transparency=1
  443.  
  444. for _,v in pairs(samples) do
  445. v.Parent=dispp
  446. end
  447.  
  448. local dispgui=int('SurfaceGui',dispp)
  449. dispgui.Adornee=dispp
  450. dispgui.Face='Left'
  451. local frm=int('Frame',dispgui)
  452. frm.Size=UDim2.new(1,0,1,0)
  453. frm.BackgroundColor3=BrickColor.new('Really black').Color
  454. local bpmc=int('TextLabel',frm)
  455. bpmc.TextColor3=BrickColor.new('White').Color
  456. bpmc.BackgroundTransparency=1
  457. bpmc.Size=UDim2.new(1,0,0.25,0)
  458. bpmc.Font='SourceSansLight'
  459. bpmc.TextScaled=true
  460. bpmc.Text=tostring('BPM: ' .. bpm)
  461.  
  462. local pat=int('TextLabel',frm)
  463. pat.TextColor3=BrickColor.new('White').Color
  464. pat.BackgroundTransparency=1
  465. pat.Size=UDim2.new(1,0,0.5,0)
  466. pat.Font='SourceSansLight'
  467. pat.TextScaled=true
  468. pat.Text=tostring('Pattern: ' .. currentPattern)
  469.  
  470. local trck=int('TextLabel',frm)
  471. trck.TextColor3=BrickColor.new('White').Color
  472. trck.BackgroundTransparency=1
  473. trck.Size=UDim2.new(1,0,0.75,0)
  474. trck.Font='SourceSansLight'
  475. trck.TextScaled=true
  476. trck.Text=tostring('channels: ' .. #channels)
  477.  
  478. local bcn=cp(script,'Really black',Vector3.new(0.5,3,3),true)
  479. bcn.Transparency=0
  480. bcn.CFrame=dispp.CFrame*CFrame.new(0,0,4.7)
  481. local cgui=int('SurfaceGui',dispp)
  482. cgui.Adornee=bcn
  483. cgui.Face='Left'
  484. local frm2=int('Frame',cgui)
  485. frm2.Size=UDim2.new(1,0,1,0)
  486. frm2.BackgroundColor3=BrickColor.new('Really black').Color
  487. local cnt=int('TextLabel',frm2)
  488. cnt.TextColor3=BrickColor.new('White').Color
  489. cnt.BackgroundTransparency=1
  490. cnt.Size=UDim2.new(1,0,1,0)
  491. cnt.TextScaled=true
  492. cnt.Text=1
  493.  
  494. local nonsq=cp(script,'Really black',Vector3.new(0.5,5,6),true)
  495. nonsq.CFrame=dispp.CFrame*CFrame.new(0,0,10)
  496. nonsq.Transparency=0
  497. local nonsqg=int('SurfaceGui',nonsq)
  498. nonsqg.Adornee=nonsq
  499. nonsqg.Face='Left'
  500. local nonsqf=int('ScrollingFrame',nonsqg)
  501. nonsqf.Size=UDim2.new(1,0,1,0)
  502. nonsqf.BackgroundColor3=BrickColor.new('Really black').Color
  503.  
  504. local can3=false
  505. local sampleguip=cp(script,'Really black',Vector3.new(0.5,6,6),true)
  506.  
  507. sampleguip.CFrame=dispp.CFrame*CFrame.new(0,0,-7)
  508. local samplegui=int('SurfaceGui',sampleguip)
  509. samplegui.Adornee=sampleguip
  510. samplegui.Face='Left'
  511. local cde3=int('ClickDetector',sampleguip)
  512. local sampleguiframe=int('ScrollingFrame',samplegui)
  513. sampleguiframe.Size=UDim2.new(1,0,1,0)
  514. sampleguiframe.BackgroundTransparency=1
  515. sampleguiframe.CanvasSize=UDim2.new(1,0,0.1*#samples,0)
  516.  
  517. local patternguip=sampleguip:clone()
  518. patternguip.Size=Vector3.new(1,4,4)
  519. patternguip.CFrame=dispp.CFrame*CFrame.new(0,0,23)
  520. local patterngui=patternguip.SurfaceGui
  521. local patternguiframe=patterngui.ScrollingFrame
  522. patternguiframe.CanvasSize=UDim2.new(1,0,1,0)
  523. patternguip.Parent=script
  524. local apn=0
  525.  
  526. local cde4=patternguip.ClickDetector
  527.  
  528. local can4=false
  529.  
  530. cde4.MouseHoverEnter:connect(function(p)
  531. if p==plr then
  532. can4=true
  533. end
  534. end)
  535.  
  536. cde4.MouseHoverLeave:connect(function(p)
  537. if p==plr then
  538. can4=false
  539. end
  540. end)
  541.  
  542. addPatternToGui=function(pattern)
  543. local newb=int('TextButton',patternguiframe)
  544. newb.Text=pattern.name
  545. newb.Size=UDim2.new(0.9,0,0.1,0)
  546. newb.BackgroundColor3=BrickColor.new('Bright red').Color
  547. newb.TextColor3=BrickColor.new('White').Color
  548. newb.ZIndex=3
  549. newb.TextScaled=true
  550. newb.Position=UDim2.new(0,0,apn/10,0)
  551. local con=newb:clone()
  552. con.Parent=patternguiframe
  553. con.Text='C'
  554. con.Position=UDim2.new(0.9,0,newb.Position.Y.Scale,0)
  555. con.MouseButton1Down:connect(function()
  556.  
  557. local congui=int('ScreenGui',plr.PlayerGui)
  558. local conguiframe=int('Frame',congui)
  559. conguiframe.Size=UDim2.new(0.4,0,0.55,0)
  560. conguiframe.BackgroundColor=BrickColor.new('Really black')
  561. conguiframe.BorderSizePixel=0
  562. conguiframe.Position=UDim2.new(0.3,0,0.225,0)
  563. local x=int('TextButton',conguiframe)
  564. x.Text='X'
  565. x.ZIndex=5
  566. x.Size=UDim2.new(0.05,0,0.05,0)
  567. x.Position=UDim2.new(0.95,0,0,0)
  568. x.BackgroundColor=BrickColor.new('Bright red')
  569. x.TextColor3=BrickColor.new('White').Color
  570. x.TextScaled=true
  571. x.MouseButton1Down:connect(function()
  572. congui:Destroy()
  573. end)
  574. local ren=int('TextBox',conguiframe)
  575. ren.Text=''
  576. ren.Size=UDim2.new(0.4,0,0.1,0)
  577. ren.Position=UDim2.new(0.3,0,0.6,0)
  578. local rb=int('TextButton',conguiframe)
  579. rb.Text='Rename'
  580. rb.Size=UDim2.new(0.2,0,0.1,0)
  581. rb.Position=UDim2.new(0.4,0,0.45,0)
  582. rb.MouseButton1Down:connect(function()
  583. local exists=false
  584. for _,v in pairs(patterns) do
  585. if v.name==ren.Text then
  586. exists=true
  587. break
  588. end
  589. end
  590. if not patterns[ren.Text] and not exists then
  591. local oldname=pattern.name
  592. pattern.name=ren.Text
  593. currentPattern=ren.Text
  594. for _,v in pairs(channels) do
  595. if v.configure then
  596. if v.configure:findFirstChild(oldname) then
  597. v.configure:findFirstChild(oldname).Name=pattern.name
  598. end
  599. end
  600. if v.stepz then
  601. for a,b in pairs(v.stepz) do
  602. if b.On and b.On:findFirstChild(oldname) then
  603. b.On:findFirstChild(oldname).Name=pattern.name
  604. end
  605. end
  606. end
  607. end
  608. newb.Text=pattern.name
  609. end
  610. end)
  611. end)
  612. newb.MouseButton1Down:connect(function()
  613. currentPattern=pattern.name
  614. realCurrentPattern=pattern
  615. count16=0
  616. pat.Text=tostring('Pattern: ' .. currentPattern)
  617. for _,v in pairs(channels) do
  618. if v.stepz then
  619. for a,b in pairs(v.stepz) do
  620. --b.On.Value=false
  621. b.BrickColor=BrickColor.new('Really black')
  622. b.Material='SmoothPlastic'
  623. end
  624. end
  625. local cnn=false
  626. if v.stepz then
  627. for a,b in pairs(v.stepz) do
  628. if b.On:findFirstChild(currentPattern) then
  629. cnn=true
  630. break
  631. end
  632. end
  633. end
  634. if v.configure and v.configure:findFirstChild(currentPattern) or cnn==true then
  635. if v.stepz then
  636. for a, b in pairs(v.stepz) do
  637. if b.On and b.On:findFirstChild(currentPattern) and b.On:findFirstChild(currentPattern).Value==true then
  638. b.BrickColor=BrickColor.new('Bright red')
  639. b.Material='Neon'
  640. end
  641. end
  642. end
  643. end
  644. end
  645. end)
  646. apn=apn+1
  647. print('asd'..newb.Parent.Name)
  648. end
  649.  
  650. for _,v in pairs(patterns) do
  651. if v.name~='origPattern' then
  652. addPatternToGui(v)
  653. end
  654. end
  655. local apbutton=cp(script,'Really black',Vector3.new(0.5,1,2),true)
  656. apbutton.CFrame=patternguip.CFrame*CFrame.new(0,3.5,0)
  657. local apg=int('SurfaceGui',apbutton)
  658. apg.Adornee=apbutton
  659. apg.Face='Left'
  660. local apf=int('Frame',apg)
  661. apf.Size=UDim2.new(1,0,1,0)
  662. local apbut=int('TextLabel',apf)
  663. apbut.Size=UDim2.new(1,0,1,0)
  664. apbut.Text='Add pattern'
  665. apbut.TextScaled=true
  666. apbut.TextColor3=BrickColor.new('White').Color
  667. apbut.BackgroundColor=BrickColor.new('Bright red')
  668.  
  669. local cdeb=int('ClickDetector',apbutton)
  670. cdeb.MouseClick:connect(function(p)
  671. if p==plr then
  672. local num=#patterns
  673. local tnum=num+1
  674. local newp=addPattern('Pattern')
  675. addPatternToGui(newp)
  676. end
  677. end)
  678.  
  679. cde3.MouseHoverEnter:connect(function(p)
  680. if p==plr then
  681. can3=true
  682. end
  683. end)
  684.  
  685. cde3.MouseHoverLeave:connect(function(p)
  686. if p==plr then
  687. can3=false
  688. end
  689. end)
  690.  
  691. local sguis=1
  692. for _,v in pairs(samples) do
  693. local repr=int('TextButton',sampleguiframe)
  694. repr.Text=v.Name
  695. repr.Font='SourceSansLight'
  696. repr.TextColor3=BrickColor.new('White').Color
  697. repr.TextScaled=true
  698. repr.BackgroundColor3=BrickColor.new('Bright red').Color
  699. repr.Size=UDim2.new(1,0,1/#samples,0)
  700. repr.Position=UDim2.new(0,0,1-(sguis/#samples),0)
  701. sguis=sguis+1
  702. repr.MouseButton1Down:connect(function()
  703. if can3 then
  704. addchannel(v,testpat)
  705. end
  706. end)
  707. end
  708.  
  709. local available=nonsq:clone()
  710. available.Parent=nonsq.Parent
  711. available.CFrame=nonsq.CFrame*CFrame.new(0,0,7)
  712. local avg=available.SurfaceGui
  713. local avf=avg.ScrollingFrame
  714. local avn=0
  715. local can2=false
  716. local cde2=int('ClickDetector',available)
  717.  
  718. cde2.MouseHoverEnter:connect(function(p)
  719. if p==plr then
  720. can2=true
  721. end
  722. end)
  723.  
  724. cde2.MouseHoverLeave:connect(function(p)
  725. if p==plr then
  726. can2=false
  727. end
  728. end)
  729.  
  730.  
  731. local song={}
  732. local songmode=false
  733. local song16=1
  734. local songbar=1
  735. local onebar=16
  736. local global16=1
  737.  
  738. local patternsPlaying={}
  739.  
  740.  
  741. local sb1=cp(script,'Really black',Vector3.new(0.5,2,4),true)
  742. sb1.CFrame=dispp.CFrame*CFrame.new(0,10,0)
  743. local sb1g=int('SurfaceGui',sb1)
  744. sb1g.Adornee=sb1
  745. sb1g.Face='Left'
  746. local sb1f=int('Frame',sb1g)
  747. sb1f.Size=UDim2.new(1,0,1,0)
  748. sb1f.BackgroundColor=BrickColor.new('Bright red')
  749. local sb1tl=int('TextLabel',sb1f)
  750. sb1tl.Size=UDim2.new(1,0,1,0)
  751. sb1tl.Text='Song'
  752. sb1tl.TextScaled=true
  753. sb1tl.TextColor3=BrickColor.new('White').Color
  754. sb1tl.BackgroundColor=sb1f.BackgroundColor
  755.  
  756. local sb2=sb1:clone()
  757. sb2g=sb2.SurfaceGui
  758. sb2.Parent=sb1.Parent
  759. sb2g.Frame.TextLabel.Text='Ptrn'
  760. sb2.CFrame=sb1.CFrame*CFrame.new(0,0,4)
  761.  
  762.  
  763. local sbc1=int('ClickDetector',sb1)
  764. sbc1.MouseClick:connect(function(p)
  765. songmode=true
  766. song16=1
  767. songbar=1
  768. end)
  769.  
  770. local sbc2=int('ClickDetector',sb2)
  771. sbc2.MouseClick:connect(function(p)
  772. songmode=false
  773. song16=1
  774. songbar=1
  775. end)
  776.  
  777. local patgui=int('ScreenGui',plr.PlayerGui)
  778. local patframe=int('ScrollingFrame',patgui)
  779. patframe.Size=UDim2.new(0.6,0,0.5,0)
  780. patframe.Position=UDim2.new(0.2,0,0.25,0)
  781.  
  782. local pathide=int('TextButton',patgui)
  783. pathide.Size=UDim2.new(0.1,0,0.05,0)
  784. pathide.Text='Hide song'
  785. pathide.Position=UDim2.new(0.9,0,0.8,0)
  786. pathide.MouseButton1Down:connect(function()
  787. if patframe.Visible==false then
  788. patframe.Visible=true
  789. else
  790. patframe.Visible=false
  791. end
  792. end)
  793.  
  794. local pii=0
  795. for i=1,10 do
  796. local long=int('Frame',patframe)
  797. long.Size=UDim2.new(1,0,0.1,0)
  798. long.Position=UDim2.new(0,0,pii/10,0)
  799. local pii2=0
  800. for o=1,16 do
  801. local barz=int('TextButton',long)
  802. barz.Size=UDim2.new(1/16,0,1,0)
  803. barz.Position=UDim2.new(pii2/16,0,0,0)
  804. barz.BackgroundColor3=bc('Really black').Color
  805. barz.TextColor3=bc('White').Color
  806. barz.Text=''
  807. pii2=pii2+1
  808. local n=#song+1
  809. barz.MouseButton1Down:connect(function()
  810. barz.BackgroundColor3=BrickColor.new('Bright red').Color
  811. barz.Text=currentPattern
  812. table.insert(song,{pattern=realCurrentPattern,pos={row=o,column=i},length=1})
  813. end)
  814. barz.MouseButton2Down:connect(function()
  815. barz.BackgroundColor3=BrickColor.new('Bright red').Color
  816. barz.Text=''
  817. table.remove(song,n)
  818. end)
  819. end
  820. pii=pii+1
  821. end
  822.  
  823. calculateBPM=function(desiredBPM)
  824. for i=1,2 do
  825. bpm=desiredBPM
  826. local ful=(60000/bpm)*0.1
  827. local ot=(full)*0.01
  828. local fb=(other*16)
  829. local prod=(full*4)*0.01
  830. full=ful
  831. other=ot
  832. fourbar=fb
  833. product=prod
  834. bpmc.Text=tostring('BPM: ' .. bpm)
  835. end
  836. end
  837.  
  838. for _,v in pairs(machines) do
  839. local but=int('TextButton',avf)
  840. but.Size=UDim2.new(1,0,0.1,0)
  841. but.Position=UDim2.new(0,0,avn,0)
  842. but.Text=v.name
  843. but.Font='SourceSansLight'
  844. but.TextScaled=true
  845. but.BackgroundColor3=BrickColor.new('Bright red').Color
  846. but.TextColor3=BrickColor.new('White').Color
  847. but.MouseButton1Down:connect(function()
  848. if can2 then
  849. local a=addNonStepChannel(machines[v.name],testpat)
  850. refreshNonStepChannels(testpat,1)
  851. end
  852. end)
  853. avn=avn+0.1
  854. end
  855.  
  856. local cde=int('ClickDetector',nonsq)
  857. cde.MaxActivationDistance=100
  858. local can=false
  859.  
  860. cde.MouseHoverEnter:connect(function(p)
  861. if p==plr then
  862. can=true
  863. end
  864. end)
  865.  
  866. cde.MouseHoverLeave:connect(function(p)
  867. if p==plr then
  868. can=false
  869. end
  870. end)
  871.  
  872. for i=1,6 do
  873. addTrack(dispp)
  874. end
  875.  
  876. local count=1
  877. local count16=1
  878.  
  879. local regkeys={
  880. ['C']='C';
  881. ['C#']='C#';
  882. ['D']='D';
  883. ['D#']='D#';
  884. ['E']='E';
  885. ['F']='F';
  886. ['F#']='F#';
  887. ['G']='G';
  888. ['G#']='G#';
  889. ['A']='A';
  890. ['A#']='A#';
  891. ['B']='B';
  892. }
  893.  
  894. local numkeys={
  895. [1]='C';
  896. [2]='C#';
  897. [3]='D';
  898. [4]='D#';
  899. [5]='E';
  900. [6]='F';
  901. [7]='F#';
  902. [8]='G';
  903. [9]='G#';
  904. [10]='A';
  905. [11]='A#';
  906. [12]='B';
  907. }
  908.  
  909. local pitches={
  910. ['C5']=1;--1.2
  911. ['C#5']=1+(1/12);--1.26
  912. ['D5']=1+(1/12)*2;--1.3
  913. ['D#5']=1+(1/12)*3;--1.4
  914. ['E5']=1+(1/12)*4;--1.5
  915. ['F5']=1+(1/12)*5;--1.6
  916. ['F#5']=1+(1/12)*6;--1.7
  917. ['G5']=1+(1/12)*7;--1.8
  918. ['G#5']=1+(1/12)*8;--1.9
  919. ['A5']=1+(1/12)*9;--2
  920. ['A#5']=1+(1/12)*10;--2.1
  921. ['B5']=1+(1/12)*11;--2.2
  922. }
  923.  
  924. tuneTable={
  925. ['piano']=1;
  926. ['sine']=1.2;
  927. }
  928.  
  929. pitchCalc=function(c)
  930. local cs=c+.06
  931. local d=c+0.1
  932. end
  933.  
  934. local chatcon=plr.Chatted:connect(function(chat)
  935. if chat=='rem' then
  936. done=true
  937. script:Destroy()
  938. script.Disabled=true
  939. end
  940. if string.sub(chat,1,4)=='tune' then
  941. local brk1=1
  942. for i=1,string.len(chat)-6 do
  943. if string.sub(chat,6+i,6+i)==' ' then
  944. brk1=6+i
  945. break
  946. end
  947. end
  948. local key=string.sub(chat,6,brk1-1)
  949. print('Key tuned: ' .. key)
  950. local pc=string.sub(chat,brk1+1)
  951. local up=string.upper(key)
  952. pitches[up]=tonumber(pc)
  953. elseif string.sub(chat,1,3)=='bpm' then
  954. local bpc=string.sub(chat,5)
  955. calculateBPM(tonumber(bpc))
  956. end
  957. end)
  958.  
  959. for _,v in pairs(regkeys) do
  960. pitches[v..4]=pitches[v..5]/2
  961. end
  962.  
  963. for _,v in pairs(regkeys) do
  964. pitches[v..3]=pitches[v..4]/2
  965. end
  966.  
  967. for _,v in pairs(regkeys) do
  968. pitches[v..2]=pitches[v..3]/2
  969. end
  970.  
  971. for _,v in pairs(regkeys) do
  972. pitches[v..1]=pitches[v..2]/2
  973. end
  974.  
  975.  
  976. for _,v in pairs(regkeys) do
  977. pitches[v..6]=pitches[v..5]*2
  978. end
  979.  
  980. for _,v in pairs(regkeys) do
  981. pitches[v..7]=pitches[v..6]*2
  982. end
  983.  
  984. local octaves=7
  985. local tn=-1
  986.  
  987. local currentpiano
  988. local currentchannel
  989.  
  990. local prollgui=int('ScreenGui',plr.PlayerGui)
  991. local prf=int('ScrollingFrame',prollgui)
  992. prf.Visible=false
  993. prf.Size=UDim2.new(0.7,0,0.7,0)
  994. prf.Position=UDim2.new(0.2,0,0.2,0)
  995. prf.CanvasSize=UDim2.new(1,0,0.5*octaves,0)
  996. local hb=int('TextButton',prollgui)
  997. hb.Text='Hide'
  998. hb.BackgroundColor=bc('Bright red')
  999. hb.TextColor3=bc('White').Color
  1000. hb.TextScaled=true
  1001. hb.Font='SourceSansLight'
  1002. hb.Size=UDim2.new(0.1,0,0.1,0)
  1003. hb.Position=UDim2.new(0.9,0,0.5,0)
  1004.  
  1005. hb.MouseButton1Down:connect(function()
  1006. if prf.Visible==false then
  1007. prf.Visible=true
  1008. else
  1009. prf.Visible=false
  1010. end
  1011. end)
  1012.  
  1013. local lfc=int('Configuration',script)
  1014. lfc.Name='Piano Roll'
  1015.  
  1016. local cfig
  1017. local sqfnum=0
  1018.  
  1019. refreshNonStepChannels=function(pattern)
  1020. sqfnum=0
  1021. nonsqf:ClearAllChildren()
  1022. for _,v in pairs(channels) do
  1023. if v.configure then
  1024. local machine=v.what
  1025. local ncfg=v.configure
  1026. local nb=int('TextButton',nonsqf)
  1027. nb.Text=machine.name
  1028. nb.Font='SourceSansLight'
  1029. nb.TextScaled=true
  1030. nb.BackgroundColor3=BrickColor.new('Bright red').Color
  1031. nb.TextColor3=BrickColor.new('White').Color
  1032. nb.Size=UDim2.new(0.8,0,0.1,0)
  1033. nb.Position=UDim2.new(0,0,sqfnum,0)
  1034. local p=int('TextButton',nonsqf)
  1035. p.Text='P'
  1036. p.FontSize='Size24'
  1037. p.BackgroundColor3=BrickColor.new('Bright red').Color
  1038. p.TextColor3=BrickColor.new('White').Color
  1039. p.Size=UDim2.new(0.1,0,0.1,0)
  1040. p.Position=UDim2.new(0.9,0,sqfnum,0)
  1041. local d=p:clone()
  1042. d.Parent=p.Parent
  1043. d.Text='D'
  1044. d.Position=UDim2.new(0.8,0,sqfnum,0)
  1045. --d.Parent=p.Parent
  1046. d.MouseButton1Down:connect(function()
  1047. if can then
  1048. channels[_]=nil
  1049. nb:Destroy()
  1050. p:Destroy()
  1051. d:Destroy()
  1052. refreshNonStepChannels(pattern,nm)
  1053. end
  1054. end)
  1055. p.MouseButton1Down:connect(function()
  1056. if can then
  1057. currentpiano=machine
  1058. currentchannel=v
  1059. cfig=ncfg
  1060. showPianoRoll()
  1061. print(#channels)
  1062. end
  1063. end)
  1064. sqfnum=sqfnum+0.1
  1065. end
  1066. end
  1067. end
  1068.  
  1069.  
  1070. addNonStepChannel=function(machine,pattern)
  1071. if type(machine) and type(machine)=='table' then
  1072. local num=#channels
  1073. refreshNonStepChannels(pattern,num+1)
  1074. local amt=#machinestable[machine.name].nestedmachines
  1075. machinestable[machine.name].amount=machinestable[machine.name].amount+1
  1076. 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}
  1077. print(machinestable[machine.name].amount)
  1078. local ncfg=int('Part',script)
  1079. ncfg.Anchored=true
  1080. ncfg.Size=Vector3.new(1,1,1)
  1081. ncfg.Transparency=1
  1082. ncfg.CFrame=dispp.CFrame
  1083. ncfg.Name=machine.name..tostring(machinestable[machine.name].amount)
  1084. local bm=int('StringValue',ncfg)
  1085. bm.Name='BaseMachine'
  1086. bm.Value=machine.name
  1087. -- origPattern.channels[num+1]={what=machinestable[machine.name].nestedmachines[machine.name..tostring(machinestable[machine.name].amount)],configure=ncfg,track=1,id=plugid,notes={}}
  1088. 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]
  1089. plugid=plugid+1
  1090. sqfnum=sqfnum+0.1
  1091. return channels[num+1],plugid
  1092. end
  1093. end
  1094.  
  1095. mouse.KeyDown:connect(function(key)
  1096. if key=='l' then
  1097. -- print('#Channels=' .. #origPattern.channels)
  1098. print('#Children=' .. #script:GetChildren())
  1099. end
  1100. end)
  1101.  
  1102.  
  1103. showPianoRoll=function()
  1104. prf:ClearAllChildren()
  1105. local ind=0
  1106. local octave=1
  1107. for x=1,octaves do
  1108. for i=1,#numkeys do
  1109. if not string.sub(numkeys[i],1,2):match('#') then
  1110. ind=ind+1
  1111. else
  1112. ind=ind+1
  1113. end
  1114. local reg=int('TextButton',prf)
  1115. reg.Size=UDim2.new(0.1,0,(1/#numkeys)/octaves,0)
  1116. reg.Text=numkeys[i] .. octave
  1117. reg.BackgroundColor3=BrickColor.new('White').Color
  1118. reg.Position=UDim2.new(0,0,1-(ind/#numkeys)/octaves,0)
  1119. if string.sub(numkeys[i],1,2):match('#') then
  1120. reg.ZIndex=3
  1121. reg.TextColor3=BrickColor.new('White').Color
  1122. reg.BackgroundColor3=BrickColor.new('Really black').Color
  1123. end
  1124. local divides=16
  1125. local lm=0
  1126. for i=1,divides do
  1127. if not piano[reg.Text] then
  1128. piano[reg.Text]={}
  1129. end
  1130. local on=false
  1131. local lfram=int('TextButton',prf)
  1132. lfram.BackgroundColor3=bc('Really black').Color
  1133. lfram.Text=''
  1134. --local npm=#piano+1
  1135. local lframval
  1136. local steppos
  1137. lfram.Size=UDim2.new((1-reg.Size.X.Scale)/divides,0,(1/#numkeys)/octaves,0)
  1138. lfram.Position=UDim2.new(reg.Position.X.Scale+reg.Size.X.Scale+((i-1)*lfram.Size.X.Scale),0,reg.Position.Y.Scale,0)
  1139. steppos=int('NumberValue',lfram)
  1140. steppos.Name='StepPos'
  1141. steppos.Value=i
  1142. if cfig:findFirstChild(currentPattern) then
  1143. for _,v in pairs(cfig[currentPattern]:GetChildren()) do
  1144. if reg.Text==v.Name then
  1145. print'hasname'
  1146. if v.Value==i then
  1147. if v.NoteSize.Value==1 then
  1148. lfram.BackgroundColor3=BrickColor.new('Bright red').Color
  1149. on=true
  1150. lframval=v
  1151. else
  1152. lframval=v
  1153. local ff=lfram:clone()
  1154. ff.Parent=lfram.Parent
  1155. ff.Name='Fake'
  1156. ff.Position=lfram.Position
  1157. ff.ZIndex=lfram.ZIndex+2
  1158. ff.BackgroundColor3=BrickColor.new('Bright red').Color
  1159. print(lfram.Position)
  1160. --print(0.05+(1/16))
  1161. local dist=(v.NoteSize.Value*lfram.Size.X.Scale)---lfram.Position.X.Scale
  1162. print(dist)
  1163. ff.Size=UDim2.new(dist,0,lfram.Size.Y.Scale,0)
  1164. -- selection.val.NoteSize.Value=lfram.StepPos.Value-(selection.frm.StepPos.Value-1)
  1165. -- print(selection.val.NoteSize.Value)
  1166. -- selection.fakefrm.ZIndex=10
  1167. -- print'did'
  1168. ff.MouseButton2Down:connect(function()
  1169. ff.Size=UDim2.new(0,0,0,0)
  1170. lfram.BackgroundColor3=BrickColor.new('Really black').Color
  1171. lframval:Destroy()
  1172. selected=false
  1173. selection=nil
  1174. on=false
  1175. ff:Destroy()
  1176. end)
  1177. ff.MouseButton1Down:connect(function()
  1178. if selected then
  1179. ff.BackgroundColor3=BrickColor.new('Bright red').Color
  1180. selected=false
  1181. selection=nil
  1182. else
  1183. ff.BackgroundColor3=BrickColor.new('Bright blue').Color
  1184. selection={frm=lfram,val=lframval,fakefrm=ff}
  1185. selected=true
  1186. end
  1187. end)
  1188. end
  1189. end
  1190. end
  1191. end
  1192. end
  1193. lfram.MouseButton2Down:connect(function()
  1194. if on==true then
  1195. lfram.BackgroundColor3=BrickColor.new('Really black').Color
  1196. lfram:clearAllChildren()
  1197. lframval:Destroy()
  1198. on=false
  1199. end
  1200. end)
  1201. lfram.MouseButton1Down:connect(function()
  1202. if on==false and not selected then
  1203. lfram.BackgroundColor3=BrickColor.new('Bright red').Color
  1204. local pval
  1205. if cfig:findFirstChild(currentPattern) then
  1206. pval=cfig[currentPattern]
  1207. else
  1208. pval=int('StringValue',cfig)
  1209. pval.Name=currentPattern
  1210. pval.Value=currentPattern
  1211. end
  1212. lframval=int('NumberValue',pval)
  1213. lframval.Name=reg.Text
  1214. lframval.Value=i
  1215. local size=lframval:clone()
  1216. size.Parent=lframval
  1217. size.Name='NoteSize'
  1218. size.Value=1
  1219. on=true
  1220. else
  1221. if not selected and not selection then
  1222. lfram.BackgroundColor3=BrickColor.new('Bright red').Color
  1223. local ff=lfram:clone()
  1224. ff.Parent=lfram.Parent
  1225. ff.Name='Fake'
  1226. ff.Position=lfram.Position
  1227. ff.BackgroundColor3=BrickColor.new('Bright blue').Color
  1228. selected=true
  1229. ff.MouseButton2Down:connect(function()
  1230. ff.Size=UDim2.new(0,0,0,0)
  1231. lfram.BackgroundColor3=BrickColor.new('Really black').Color
  1232. lframval:Destroy()
  1233. selected=false
  1234. selection=nil
  1235. on=false
  1236. ff:Destroy()
  1237. end)
  1238. ff.MouseButton1Down:connect(function()
  1239. if selected then
  1240. ff.BackgroundColor3=BrickColor.new('Bright red').Color
  1241. selected=false
  1242. selection=nil
  1243. else
  1244. ff.BackgroundColor3=BrickColor.new('Bright blue').Color
  1245. selection={frm=lfram,val=lframval,fakefrm=ff}
  1246. selected=true
  1247. end
  1248. end)
  1249. selection={frm=lfram,val=lframval,fakefrm=ff}
  1250. end
  1251. if selected and selection.frm~=lfram then
  1252. print(lfram.Position)
  1253. --print(0.05+(1/16))
  1254. local dist=lfram.Position.X.Scale-selection.frm.Position.X.Scale
  1255. print(dist)
  1256. selection.fakefrm.Size=UDim2.new(dist+(1-reg.Size.X.Scale)/divides,0,selection.frm.Size.Y.Scale,0)
  1257. selection.val.NoteSize.Value=lfram.StepPos.Value-(selection.frm.StepPos.Value-1)
  1258. print(selection.val.NoteSize.Value)
  1259. selection.fakefrm.ZIndex=10
  1260. end
  1261. end
  1262. end)
  1263. end
  1264. local sop
  1265. reg.MouseButton1Down:connect(function()
  1266. if currentpiano then
  1267.  
  1268. local snd
  1269. for x,z in pairs(soundtable) do
  1270. if not z.inUse then
  1271. snd=z.snd
  1272. z.inUse=true
  1273. z.timeLeft=((other/4)*3)
  1274. break
  1275. end
  1276. end
  1277. --local sgroup=int('SoundGroup',game:GetService'SoundService')
  1278. local sound=currentpiano.func(cfig,snd)
  1279. sop=sound
  1280. -- print(sound)
  1281. --game.Debris:AddItem(sound,sound.TimeLength)
  1282. sound.PlaybackSpeed=pitches[reg.Text]
  1283. sound:Play()
  1284. end
  1285. end)
  1286. reg.MouseButton1Up:connect(function()
  1287. if sop then
  1288. sop:Stop()
  1289. end
  1290. end)
  1291. tn=tn+1
  1292. end
  1293. octave=octave+1
  1294. end
  1295. end
  1296.  
  1297. --loudness manager
  1298. spawn(function()
  1299. while wait() do
  1300. --for _,v in pairs(patterns) do
  1301. for i=1,#tracks do
  1302. local totalloudness=0
  1303. for c,z in pairs(channels) do
  1304. if i==z.track then
  1305. if not z.configure then
  1306. -- tracks[b.track].tgui.Frame.Size=UDim2.new(1,0,b.what.PlaybackLoudness/1000,0)
  1307. totalloudness=totalloudness+z.what.PlaybackLoudness
  1308. else
  1309.  
  1310. local avl=0
  1311. local nmb=0
  1312. for n,m in pairs(z.configure:GetChildren()) do
  1313. if m.className=='Sound' and m.PlaybackLoudness>0 then
  1314. avl=avl+m.PlaybackLoudness
  1315. nmb=nmb+1
  1316. end
  1317. end
  1318. totalloudness=totalloudness+(avl/nmb)
  1319. end
  1320. end
  1321. end
  1322. tracks[i].tgui.Frame.Size=UDim2.new(1,0,totalloudness/1000,0)
  1323. tracks[i].tgui.Frame.Position=UDim2.new(0,0,1-(totalloudness/1000),0)
  1324. end
  1325. --end
  1326. end
  1327. end)
  1328.  
  1329.  
  1330. while wait(other/4) do --0.03
  1331. if songmode==true then
  1332. if songbar==onebar then
  1333. songbar=1
  1334. end
  1335. for _,v in pairs(song) do
  1336. if v.pos.row==songbar then
  1337. if not patternsPlaying[v.pattern.name] then
  1338. patternsPlaying[v.pattern.name]={name=v.pattern.name,pattern=v.pattern,prog=1}
  1339. print'patternplaying'
  1340. local c16=1
  1341. end
  1342. else
  1343. -- if patternsPlaying[v.pattern.name] then
  1344. -- patternsPlaying[v.pattern.name]=nil
  1345. -- end
  1346. end
  1347. end
  1348. --print('playing: ' .. #patternsPlaying)
  1349. --print(songbar)
  1350. --song16=song16+1
  1351. for n,m in pairs(patternsPlaying) do
  1352. for _,v in pairs(channels) do
  1353. if not v.configure then
  1354. 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
  1355. v.what:Play()
  1356. --m.prog=m.prog+1
  1357. end
  1358. else
  1359. local lfc=v.configure
  1360. if #lfc:GetChildren()>0 then
  1361. for a,b in pairs(lfc:GetChildren()) do
  1362. if b.Name==m.name then
  1363. --print('its there')
  1364. for _,v in pairs(b:GetChildren()) do
  1365. if v.className~='Sound' then
  1366. if v.Value==m.prog then
  1367. local snd
  1368. for x,z in pairs(soundtable) do
  1369. if not z.inUse then
  1370. snd=z.snd
  1371. z.inUse=true
  1372. z.timeLeft=((other/4)*v.NoteSize.Value)---(other/4)
  1373. break
  1374. end
  1375. end
  1376. --local sgroup=int('SoundGroup',game:GetService'SoundService')
  1377. if snd then
  1378. local sinwave=machinestable[lfc.BaseMachine.Value].nestedmachines[lfc.Name].func(dispp,snd)
  1379. if sinwave.Parent~=lfc then
  1380. sinwave.Parent=lfc
  1381. end
  1382. --sinwave.SoundGroup=sgroup
  1383. --sinwave.Parent=sinewave.Parent
  1384. sinwave.PlaybackSpeed=pitches[v.Name]
  1385. sinwave:Play()
  1386. --print'played'
  1387. end
  1388. end
  1389. end
  1390. end
  1391. end
  1392. end
  1393. end
  1394. end
  1395. end
  1396. end
  1397. end
  1398.  
  1399.  
  1400. if songmode==true then
  1401. global16=global16+1
  1402. if song16>=16 then
  1403. songbar=songbar+1
  1404. song16=1
  1405. else
  1406. song16=song16+1
  1407. end
  1408. for _,v in pairs(patternsPlaying) do
  1409. if v.prog<16 then
  1410. v.prog=v.prog+1
  1411. else
  1412. patternsPlaying[v.name]=nil
  1413. end
  1414. end
  1415. end
  1416. for _,v in pairs(soundtable) do
  1417. if v.timeLeft>0 then
  1418. v.timeLeft=v.timeLeft-(other/4)
  1419. else
  1420. if v.inUse then
  1421. v.inUse=false
  1422. v.snd:Stop()
  1423. end
  1424. end
  1425. end
  1426. if not done then
  1427. if not songmode then
  1428. -- for _,v in pairs(patterns) do
  1429. for _,v in pairs(channels) do
  1430. if not v.configure then
  1431. if v.stepz[count16] and v.stepz[count16].On:findFirstChild(currentPattern) and v.stepz[count16].On:findFirstChild(currentPattern).Value==true then
  1432. v.what.Volume=v.volume
  1433. v.what:Play()
  1434. end
  1435. else
  1436. local lfc=v.configure
  1437. if #lfc:GetChildren()>0 then
  1438. for a,b in pairs(lfc:GetChildren()) do
  1439. if b.Name==currentPattern then
  1440. --print('its there')
  1441. for _,v in pairs(b:GetChildren()) do
  1442. if v.className~='Sound' then
  1443. if v.Value==count16 then
  1444. local snd
  1445. for x,z in pairs(soundtable) do
  1446. if not z.inUse then
  1447. snd=z.snd
  1448. z.inUse=true
  1449. z.timeLeft=((other/4)*v.NoteSize.Value)-(other/4)
  1450. break
  1451. end
  1452. end
  1453. --local sgroup=int('SoundGroup',game:GetService'SoundService')
  1454. if snd then
  1455. local sinwave=machinestable[lfc.BaseMachine.Value].nestedmachines[lfc.Name].func(dispp,snd)
  1456. if sinwave.Parent~=lfc then
  1457. sinwave.Parent=lfc
  1458. end
  1459. --sinwave.SoundGroup=sgroup
  1460. --sinwave.Parent=sinewave.Parent
  1461. sinwave.PlaybackSpeed=pitches[v.Name]
  1462. sinwave:Play()
  1463. --print'played'
  1464. end
  1465. end
  1466. end
  1467. end
  1468. end
  1469. end
  1470. end
  1471. end
  1472. end
  1473. --end
  1474. if count16/4==1 or count16/4==2 or count16/4==3 or count16/4==4 then
  1475. if count<4 then
  1476. count=count+1
  1477. else
  1478. count=1
  1479. end
  1480. cnt.Text=tostring(count)
  1481. end
  1482. if count16<16 then
  1483. count16=count16+1
  1484. else
  1485. count16=1
  1486. end
  1487. end
  1488. else
  1489. chatcon:Disconnect()
  1490. break
  1491. end
  1492. end
  1493. --hl/https://httpget-inumeration.c9.io/tindj.lua
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement