Advertisement
robthesnowman

Midi Player

Aug 12th, 2016
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 46.09 KB | None | 0 0
  1. --do not sell,trade,give away this to anyone
  2.  
  3. local function UD(a,b)
  4. return UDim2.new(a,0,b,0)
  5. end
  6. --Type in your username here vv
  7. user = "RobTheSnowman"
  8.  
  9.  
  10. local Max_SLength = 9e99999--131070
  11.  
  12. local neon=false
  13.  
  14. local admunz={"firespine10","RobTheSnowman","oxcool1",'ClassyUmadbro2bad','MakerModelLua','Nexure','Diitto',user}
  15.  
  16. local songlist={'AOT','Apple','Awoken','Bard','Bats','Can','Carnival','Cave','CaveStory','Cordy','Cotn','Discord','Dragonborn','Earth','FONR','Fire','Force','Georgia','Good','Haunt','Jack','Killla','Lob','Mario','Necro','OneP','Pirate','Rainbow','Smil','Storms','Stronger','Tetris','Times','Viva','Waltz','RadioG','BSwing','CatG','ANight'}
  17.  
  18. local cmdlist={'!fixs','!list','!cmds','!song> ID','!link> ID','!stop','!songb> ByteCode','!rvb> num or name','!goto> name','!tmp> num','!adds> name','!3d> on/off'}
  19.  
  20. local songvol = 50
  21.  
  22. local fme= user-- starter following person
  23.  
  24. local mid = ""
  25.  
  26. local store = ""
  27.  
  28. local guis={}
  29.  
  30. local playDebounce = false
  31.  
  32. local xnum = 2
  33.  
  34. local ynum = 3
  35.  
  36. local znum = 0
  37.  
  38. local bars = false
  39.  
  40. local soundscape = {}
  41.  
  42. function FindPlayer(name,Speaker)
  43. local found,rand = {},math.random(1,game.Players.NumPlayers)
  44. for word in name:gmatch("%S+")do
  45. for i,player in pairs(Game.Players:GetPlayers())do
  46. if player.Name:lower():find(word:lower())== 1
  47. or word:lower()== "all"
  48. or word:lower()== "everyone"
  49. or word:lower()== "everybody"
  50. or word:lower()== "everypony"
  51. or word:lower()== "local" and player == Speaker
  52. or word:lower()== "me" and player == Speaker
  53. or word:lower()== "others" and player ~= Speaker
  54. or word:lower()== "random" and i == rand then
  55. table.insert(found,player)
  56. end
  57. end
  58. end
  59. return found
  60. end
  61.  
  62. function lerp(a,b,c)
  63. return a+(b-a)*c
  64. end
  65.  
  66.  
  67. function addSS()
  68. local p = Instance.new("Part",workspace)
  69. p.Anchored = true
  70. p.FormFactor = "Custom"
  71. if neon then
  72. p.Material="Neon"
  73. end
  74. p:BreakJoints()
  75. p.TopSurface,p.BottomSurface = 0,0
  76. p.CanCollide = false
  77. p.Size = Vector3.new(1,1,1)
  78. p.Locked = true
  79. p.CFrame = getMiddleCFrame()
  80. local PL=Instance.new("PointLight",p)
  81. PL.Color= BrickColor.new("Royal purple").Color
  82. PL.Brightness=0
  83. local SM = Instance.new("SpecialMesh",p)
  84. SM.MeshId = "http://www.roblox.com/Asset/?id=9856898"
  85. SM.TextureId = "rbxassetid://3319251"
  86. SM.VertexColor = Vector3.new(0,0,0)
  87. SM.Scale = Vector3.new()
  88. table.insert(soundscape,p)
  89. return p
  90. end
  91. local oc = oc or function(func)
  92. return function(...)
  93. local ___a,___b = ypcall(func,...)
  94. if ____a == false then
  95. Notify(___b)
  96. end
  97. end
  98. end
  99. local acNotify = Notify
  100. function Notify(...)
  101. local t = ""
  102. for i = 1,select("#",...) do
  103. t = t..tostring(select(i,...) or "nil").."\t"
  104. end
  105. local plrs=game.Players:GetPlayers()
  106. local pnum=#plrs/10+.1
  107. local gnum=#guis/10
  108. if #guis < 1 then
  109. movenum=0
  110. else
  111. movenum=gnum-pnum
  112. end
  113. for _,Player in pairs(game.Players:GetPlayers()) do
  114. if Player:findFirstChild("PlayerGui") then
  115. local pgui = Player.PlayerGui
  116. local sg = Instance.new("ScreenGui",pgui)
  117. sg.Name = "Message"
  118. local frm = Instance.new("Frame",sg)
  119. frm.Size = UD(.1,0.075)
  120. frm.BackgroundColor = BrickColor.new("Really black")
  121. frm.BackgroundTransparency = 0.5
  122. frm.Style="DropShadow"
  123. frm.ZIndex = 6
  124. frm.Position = UD(1.1,0.85)
  125. table.insert(guis,frm)
  126. local msg = Instance.new("TextLabel",frm)
  127. msg.Name = "msg"
  128. msg.TextScaled=true
  129. msg.Text = tostring(t)
  130. msg.Font = "ArialBold"
  131. msg.FontSize = "Size18"
  132. msg.TextColor = BrickColor.new("White")
  133. msg.Size = UD(1,1)
  134. msg.Position = UD(0,0)
  135. msg.BackgroundTransparency = 1
  136. msg.TextXAlignment = "Center"
  137. msg.ZIndex = 6
  138. frm:TweenPosition(UD(.9,0.85+movenum), "Out", "Quad", 2.5)
  139. Spawn(function() wait(4)
  140. for i=1,#guis do
  141. if guis[i]==frm then
  142. table.remove(guis,i)
  143. end
  144. end
  145. frm:TweenPosition(UD(1.1,0.85), "Out", "Quad", 2.5)
  146. wait(4)
  147. sg:Destroy()
  148. end)
  149. --game.Debris:AddItem(sg,3)
  150. end
  151. end
  152. end
  153.  
  154. function strhex(str)
  155. local res='';
  156. local hnt=Instance.new('Hint',workspace)
  157. hnt.Text='Decoding'
  158. for port in str:gmatch'.'do
  159. res=res..string.format('%02x',port:byte());
  160. end;
  161. hnt:Destroy()
  162. return(res);
  163. end;
  164.  
  165. function GetSongList(persn)
  166. local listtime=20
  167. local plr=persn
  168. local pgui = plr.PlayerGui
  169. local sg = Instance.new("ScreenGui",pgui)
  170. sg.Name = "Message"
  171. local frm = Instance.new("Frame",sg)
  172. frm.Size = UD(.1,0.2)
  173. frm.BackgroundColor = BrickColor.new("Really black")
  174. frm.BackgroundTransparency = 0.5
  175. frm.Style="DropShadow"
  176. frm.ZIndex = 6
  177. frm.Position = UD(1.1,0.85)
  178. msg = Instance.new("TextLabel",frm)
  179. msg.Name = "msg"
  180. msg.TextScaled=true
  181. msg.Font = "ArialBold"
  182. msg.Text=""
  183. msg.FontSize = "Size18"
  184. msg.TextColor = BrickColor.new("White")
  185. msg.Size = UD(1,1)
  186. msg.Position = UD(0,0)
  187. msg.BackgroundTransparency = 1
  188. msg.TextXAlignment = "Center"
  189. msg.ZIndex = 6
  190. frm:TweenPosition(UD(.9,0.6), "Out", "Quad", 2.5)
  191. for i=1,#songlist do
  192. if i==#songlist then
  193. msg.Text=msg.Text..songlist[i]
  194. elseif i<#songlist then
  195. msg.Text=msg.Text..songlist[i]..', '
  196. end
  197. end
  198. Spawn(function()
  199. local tellr=msg
  200. local text=msg.Text
  201. for i=1,listtime do
  202. tellr.Text="Song list "..listtime..": "..text
  203. wait(1)
  204. listtime=listtime-1
  205. end
  206. frm:TweenPosition(UD(1.1,0.85), "Out", "Quad", 2.5)
  207. wait(4)
  208. sg:Destroy()
  209. end)
  210. --game.Debris:AddItem(sg,3)
  211. end
  212.  
  213. function GetCmdList(persn)
  214. local listtime=20
  215. local plr=persn
  216. local pgui = plr.PlayerGui
  217. local sg = Instance.new("ScreenGui",pgui)
  218. sg.Name = "Message"
  219. local frm = Instance.new("Frame",sg)
  220. frm.Size = UD(.1,0.2)
  221. frm.BackgroundColor = BrickColor.new("Really black")
  222. frm.BackgroundTransparency = 0.5
  223. frm.Style="DropShadow"
  224. frm.ZIndex = 6
  225. frm.Position = UD(1.1,0.85)
  226. msg = Instance.new("TextLabel",frm)
  227. msg.Name = "msg"
  228. msg.TextScaled=true
  229. msg.Font = "ArialBold"
  230. msg.Text=""
  231. msg.FontSize = "Size18"
  232. msg.TextColor = BrickColor.new("White")
  233. msg.Size = UD(1,1)
  234. msg.Position = UD(0,0)
  235. msg.BackgroundTransparency = 1
  236. msg.TextXAlignment = "Center"
  237. msg.ZIndex = 6
  238. frm:TweenPosition(UD(.9,0.6), "Out", "Quad", 2.5)
  239. for i=1,#cmdlist do
  240. if i==#cmdlist then
  241. msg.Text=msg.Text..cmdlist[i]
  242. elseif i<#cmdlist then
  243. msg.Text=msg.Text..cmdlist[i]..', '
  244. end
  245. end
  246. Spawn(function()
  247. local tellr=msg
  248. local text=msg.Text
  249. for i=1,listtime do
  250. tellr.Text="Song list "..listtime..": "..text
  251. wait(1)
  252. listtime=listtime-1
  253. end
  254. frm:TweenPosition(UD(1.1,0.85), "Out", "Quad", 2.5)
  255. wait(4)
  256. sg:Destroy()
  257. end)
  258. --game.Debris:AddItem(sg,3)
  259. end
  260.  
  261. local debris = game:GetService("Debris")
  262. function newSS(am)
  263. for i,v in pairs(soundscape) do for _,x in pairs(v:GetChildren()) do debris:AddItem(x,0) end debris:AddItem(v,.05) end
  264. soundscape = {}
  265. for i=1,am do
  266. addSS()
  267. end
  268. end
  269.  
  270. function ClrLerp(Mesh,Clr2,Step)
  271. Clr1 = Mesh.VertexColor
  272. Mesh.VertexColor = Vector3.new(lerp(Clr1.X,Clr2.X,Step),lerp(Clr1.Y,Clr2.Y,Step),lerp(Clr1.Z,Clr2.Z,Step))
  273. end
  274.  
  275. function getMiddleCFrame()
  276. if bars==true then
  277. cf = workspace:FindFirstChild(fme) and workspace[fme]:FindFirstChild("Torso") and workspace[fme].Torso:IsA("Part") and workspace[fme].Torso.CFrame - Vector3.new(0,3,0) or CFrame.new(0,0,0)
  278. else
  279. cf = workspace:FindFirstChild(fme) and workspace[fme]:FindFirstChild("Torso") and workspace[fme].Torso:IsA("Part") and workspace[fme].Torso.CFrame + Vector3.new(0,3,0) or CFrame.new(0,10,0)
  280. end
  281. return CFrame.new(cf.p)
  282. end
  283.  
  284. do
  285. local function QuaternionFromCFrame(cf) local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components() local trace = m00 + m11 + m22 if trace > 0 then local s = math.sqrt(1 + trace) local recip = 0.5/s return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5 else local i = 0 if m11 > m00 then i = 1 end if m22 > (i == 0 and m00 or m11) then i = 2 end if i == 0 then local s = math.sqrt(m00-m11-m22+1) local recip = 0.5/s return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip elseif i == 1 then local s = math.sqrt(m11-m22-m00+1) local recip = 0.5/s return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip elseif i == 2 then local s = math.sqrt(m22-m00-m11+1) local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip end end end
  286.  
  287. local function QuaternionToCFrame(px, py, pz, x, y, z, w) local xs, ys, zs = x + x, y + y, z + z local wx, wy, wz = w*xs, w*ys, w*zs local xx = x*xs local xy = x*ys local xz = x*zs local yy = y*ys local yz = y*zs local zz = z*zs return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy)) end
  288.  
  289. local function QuaternionSlerp(a, b, t) local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4] local startInterp, finishInterp; if cosTheta >= 0.0001 then if (1 - cosTheta) > 0.0001 then local theta = math.acos(cosTheta) local invSinTheta = 1/math.sin(theta) startInterp = math.sin((1-t)*theta)*invSinTheta finishInterp = math.sin(t*theta)*invSinTheta else startInterp = 1-t finishInterp = t end else if (1+cosTheta) > 0.0001 then local theta = math.acos(-cosTheta) local invSinTheta = 1/math.sin(theta) startInterp = math.sin((t-1)*theta)*invSinTheta finishInterp = math.sin(t*theta)*invSinTheta else startInterp = t-1 finishInterp = t end end return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp end
  290.  
  291. function clerp(a,b,t)
  292. local qa = {QuaternionFromCFrame(a)}
  293. local qb = {QuaternionFromCFrame(b)}
  294. local ax, ay, az = a.x, a.y, a.z
  295. local bx, by, bz = b.x, b.y, b.z
  296.  
  297. local _t = 1-t
  298. return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
  299. end
  300. end
  301. Num = 0
  302. Rnd = math.random
  303. game:GetService("RunService").Stepped:connect(function()
  304. if bars==true then
  305. local mcf = getMiddleCFrame()
  306. for i,v in pairs(soundscape) do
  307. local snd,m,pl=v:FindFirstChild("Sound"),v:FindFirstChild("Mesh"),v:FindFirstChild("PointLight")
  308. if snd and m then
  309. pl.Brightness=snd.Volume
  310. ClrLerp(m,Vector3.new(snd.Volume/2,0,snd.Volume),.05)
  311. m.Scale = Vector3.new(.2,math.max(.02,lerp(m.Scale.Y+snd.Volume/2*1.3,snd.Volume,.3)),.2)
  312. elseif m then
  313. pl.Brightness=0
  314. m.Scale = Vector3.new(1,.02,1)
  315. ClrLerp(m,Vector3.new(0,0,0),.3)
  316. end
  317. if m then
  318. m.Offset = Vector3.new(0,m.Scale.Y/2*v.Size.Y,0)
  319. end
  320. --[[
  321. local ran = 4
  322. local ang;
  323. repeat
  324. ran = ran + .25
  325. ang = math.atan(v.Size.X/ran) + math.rad(1)
  326. until (#soundscape)*ang < math.pi*2]]
  327. ang = math.pi*2 / #soundscape
  328. ran = math.max(3,(v.Size.X / math.tan(ang)) + .5)
  329. v.CFrame = clerp(v.CFrame,mcf * CFrame.Angles(0,(#soundscape-1)*ang/2+(i-1)*ang,0) * CFrame.new(0,0,-ran-v.Size.Z/2) * CFrame.Angles(-math.pi/2,0,0),.1)
  330. --v.CFrame = clerp(v.CFrame,mcf*CFrame.Angles(0,math.pi*2/#soundscape*(i-1),0)*CFrame.new(0,0,-#soundscape*.3)+Vector3.new(0,math.sin((tick()+i)*5),0),.1)
  331. end
  332. else
  333. Num = Num + .01
  334. local mcf = getMiddleCFrame()
  335. local Dist = #soundscape/math.pi/2
  336. for i,v in pairs(soundscape) do
  337. v.Anchored = true
  338. local snd,m,pl = v:FindFirstChild("Sound"),v:FindFirstChild("Mesh"),v:FindFirstChild("PointLight")
  339. if snd and m then
  340. pl.Brightness=snd.Volume
  341. m.Scale = Vector3.new(xnum,ynum,znum)*lerp(m.Scale.X/2,snd.Volume,.3)
  342. ClrLerp(m,Vector3.new(snd.Volume/2,0,snd.Volume),.05)
  343. elseif m then
  344. pl.Brightness=0
  345. m.Scale = Vector3.new(1,.01,.01)
  346. ClrLerp(m,Vector3.new(0,0,0),.3)
  347. end
  348. if m then
  349. m.Offset = Vector3.new(0,0,0)
  350. end
  351. --v.CFrame = clerp(v.CFrame,mcf*CFrame.Angles(0,0,0)*CFrame.Angles(0,math.pi*2/#soundscape*(i-1),0)*CFrame.new(0,m.Scale.Y/2,Dist),.1)
  352. if ynum == 2 then
  353. v.CFrame = clerp(v.CFrame,mcf*CFrame.Angles(0,math.pi*2/#soundscape*(i-1),0)*CFrame.new(0,0,-#soundscape*.3)*CFrame.Angles(math.sin((tick()+i)*5),math.sin((tick()+i)*5),math.sin((tick()+i)*5))+Vector3.new(0,math.sin((tick()+i)*5),0),.1)
  354. else
  355. v.CFrame = clerp(v.CFrame,mcf*CFrame.Angles(0,math.pi*2/#soundscape*(i-1),0)*CFrame.new(0,0,-#soundscape*.3)+Vector3.new(0,math.sin((tick()+i)*5),0),.1)
  356. end
  357. end
  358. end
  359. end)
  360.  
  361. if not soundscape then return end
  362.  
  363. --for i,v in pairs(soundscape:GetChildren()) do if v:IsA("Sound") then v:Destroy() end end
  364. --soundscape.AmbientReverb = "ConcertHall"
  365.  
  366.  
  367. midiplayer = script.Parent
  368.  
  369. sounds = {}
  370. midichecksum = 365
  371. waitloop = true
  372. tracksOn = 0
  373.  
  374. tempo = 250
  375. snap = 12222140
  376. ping = 12221990
  377. bass = 12221831
  378. button = 12221967
  379. clickf = "rbxasset://sounds//clickfast.wav"
  380. clunk = "rbxasset://sounds//flashbulb.wav"
  381.  
  382. url = "http://www.roblox.com/asset/?id="
  383.  
  384. -- M_INS
  385. programs = {
  386. {{"12857654",0.3,0,66,0.5},{"12857804",-7,67,71,0.5},{"12857664",-11.5,72,127,0.8}}, -- Banjo
  387. {{"12857637",-3.9,0,64,0.5},{"12857660",-8.4,65,127,0.5}}, -- Banjo 2
  388. {{"13114759",-6,0,127,1}}, -- ding
  389. {{"19344667",-8.6,0,127,0.5}}, -- bell
  390. {{"15666462",-13.5,0,127,0.4}}, -- Beep
  391. {{"13424334",-23.2,0,127,0.5,0,0.5}}, -- piccolo
  392. {{"1089407",8.2,0,57,0.5},{"1089403",3.2,58,127,1}}, -- Electric Guitar
  393. {{"13032199",8.2,0,57,0.5},{"13032178",3.2,58,127,1}}, -- Space Guitar
  394. {{"60661796",-2.5,0,127,0.5,0.3,0.2}}, -- Metal Guitar
  395. {{"13019281",11.2,0,127,0.5}}, -- Ninja Guitar (Twang Twang!)
  396. {{"13019300",11.3,0,127,0.5}}, -- Ninja Guitar (T-T-Twang Twang!)
  397. {{"12892216",-7,0,127,0.5}}, -- Jungle Guitar
  398. {{"10209668",6.5,0,127,0.5}}, -- synth sound 1
  399. {{"11998777",12,0,127,0.5}}, -- synth sound 2
  400. {{"11998796",4.8,0,127,0.5,0,0.15}}, -- synth sound 3
  401. {{bass,11.8,0,127,0.5}}, -- Bass
  402. {{"rbxasset://sounds//uuhhh.wav",0.2,0,127,0.5}}, -- Robloxian Death
  403. {{button,6.7,0,127,0.4}}, -- Button
  404. {{ping,-21.7,0,127,0.5,0,0.2}}, -- Ping!
  405. {{"rbxasset://sounds//Kid saying Ouch.wav",0.9,0,127,0.5}}, -- 'Ouch'
  406. {{"11984351",16.8,0,127,0.3,0.02,0.2}}, -- Long Destructive Synth
  407. -- v V Drumset V v
  408. {{"rbxasset://music//ufofly.wav",59,1,1,0.5},{"13114759",39.7,26,26,0.5},{snap,37,27,27,0.5,0,0.25},
  409. {"108553903",38,28,28,0.5,0,0,0},
  410. {"18426149",41,29,29,0.4,0,0.25},{"18426149",34,30,30,0.4,0,0.25},{snap,37,31,31,0.2},
  411. {clickf,40,31,31,0.7},{clunk,40,32,32,0.5},{clickf,38,33,34,0.5},
  412. {"56524816",24,34,34,0.3},{"31173820",20,35,35,0.5},{"31173820",24,36,36,0.5},
  413. {"14863866",16,37,37,1},{"31173799",20,38,38,0.7},{"2101148",54,39,39,0.7},{"31173799",20,40,40,0.5},
  414. {"31173881",17,41,41,0.5},
  415. {snap,45,42,42,0.25,0,0.25},{"31173881",19,43,43,0.5},{snap,52,44,44,0.25,0,0.25},
  416. {"31173881",21,45,45,0.5},{"31173735",14,46,46,0.5},{"31173881",23,47,47,0.5},{"31173844",13,48,48,0.5},
  417. {"31173771",14,49,49,0.5},{"31173844",15,50,50,0.5},{"31173898",8,51,51,0.5},{"31173771",5,52,52,0.5},
  418. {"11113679",9.5,53,53,0.5},{snap,34,54,54,0.15,0,0.25},{"31173771",24,55,55,0.5},{snap,14,56,56,0.2},{"57802055",1,56,56,0.3},
  419. {"31173771",7,57,57,0.5},{"31173898",1,59,59,0.5},{"57801983",3,60,60,0.5,0,0.25},{"57801983",-10,61,61,0.5,0,0.25}, -- tuning was -5
  420. {"101088307",24,62,62,0.5,0,0,0},{"57802055",-16,63,63,0.5,0,0.25},{"57802055",-22,64,64,0.5,0,0.25},{"57801983",-15,65,65,0.5,0,0.25}
  421. ,{"57801983",-21,66,66,0.5,0,0.25},
  422. {"13114759",-8,67,67,0.5,0,0.25},{"13114759",-14,68,68,0.5,0,0.25},
  423. {snap,22,69,69,0.4},
  424. {snap,32,70,70,0.5,0,0.25},{"28510547",-14.4,71,71,0.4,0,0.25},{"28510547",-18.4,72,72,0.4,0,0.25},{"101180005",-3.4,73,73,0.3,0,0,0},
  425. {"100391463",-4,74,74,0.4,0,0,0},{"15666462",8,75,75,0.4},{"57802055",-2,76,76,0.4},{"57802055",-5,77,77,0.4},{"75338648",-13,78,78,0.6,0,1,0},{"75338648",-31.7,79,79,0.5,0,0,0},
  426. {"19344667",2.5,80,80,0.25,0,0.25},{"19344667",1.5,81,81,0.2},{snap,12,82,82,0.3,0,0.25},{"101093314",-22,83,83,0.4,0,0.25},
  427. {"13061809",-4,84,84,0.4},{"57802055",8,85,85,0.4},{"31173844",-35,86,86,0.4},{"31173844",-36,87,87,0.4}},
  428. -- Horror SFX v v v
  429. {{"13061809",-2,56,64,0.5},{"13061802",-10,65,74,0.5},{"13061810",-23,75,84,0.5},{"11984254",-34,85,127,0.5},
  430. {"rbxasset://sounds//HalloweenThunder.wav",8,48,55,0.5},{"rbxasset://sounds//HalloweenGhost.wav",27,0,47,0.5}},
  431. {{"21338895",0,0,127,0.5}}, -- Maraca
  432. {{"11949128",10,0,127,0.5}}, -- Big Drum (Even though it isn't.)
  433. {{"10209888",13.4,0,127,0.3},{"10209888",14.2,61,127,0.3}}, -- Popcorn
  434. {{"45885030",1.4,0,127,0.3}}, -- KatanaSlash
  435. {{"75421988",33.75,0,80,0.3,0,0.2,1},{"75338648",-24.7,81,127,0.5,0,0.4,1},
  436. {"75338648",-0.7,81,127,0.4,0,0.4,1},{"75338648",11.4,81,127,0.5,0,0.4,1}}, -- ChargeSynth
  437. {{"15666462",52.2,0,127,0.4,0.5,0.5,1}}, -- Hard Synth Bass
  438. {{"11944350",-9.6,0,127,0.5}}, -- Pew
  439. {{"79236960",0,0,127,0.3,0}}, -- Bass Drum
  440. {{"81146867",16,0,127,0.3,0}}, -- Saber Sound
  441. {{"75338648",-13,0,127,0.7,0,0.1,1}}, -- Beep sound
  442. {{"11949128",43,0,127,0.5,0,0.25,1}}, -- Growly Thing
  443. {{"11998796",4.8,0,127,1,0,0.25},{"75421988",33.8,0,80,0.2,0.4,0.4,1},{"75421988",33.9,0,80,0.2,0.4,0.4,1},
  444. {"75338648",-24.7,81,127,0.5,0,0.4,1},{"75338648",-0.7,81,127,0.4,0,0.4,1},{"75338648",11.4,81,127,0.5,0,0.4,1}}, -- Nice Synth
  445. {{"58479648",15.2,0,127,0.5,0,0.25}}, -- 035 Spitsy Bass
  446. {{"58479648",15.2,0,127,0.5,0,0.15,1}}, -- 036 Spitsy Bass/Beep (Loops)
  447. {{"69446845",13.5,0,127,0.5,0,0.15,1}}, -- 037 Dead Synth Strings
  448. {{"75421988",33.7,0,80,0.2,0.4,0.4,1},{"75421988",33.8,0,80,0.2,0.4,0.4,1},{"75338648",-24.7,81,127,0.5,0,0.4,1},{"75338648",-0.7,81,100,0.4,0,0.4,1},{"75338648",11.4,81,86,0.5,0,0.4,1}}, -- 038 Charge Synth Smooth
  449. {{"57802055",-2,0,127,0.5}}, -- 039 Noted Congo
  450. {{bass,23.8,0,127,0.5}}, -- 040 Bass Octave Higher
  451. {{"25641508",-9.5,0,127,0.5}}, -- 041 "Oof!"
  452. -- 42 Fake Piano V2
  453. {{bass,23.8,42,50,0.07},{"12857664",-11.6,36,80,0.6},
  454. {ping,-21.7,82,127,0.5,0,0.15},
  455. {"12857664",-11.6,87,127,0.18},{"12857664",-11.6,81,86,0.3},{bass,23.8,0,41,0.2},
  456. {ping,-21.7,0,81,0.8,0,0.2}},
  457. {{"75338648",-24.7,0,127,0.7,0,0.1,1}}, -- Soft Whistle (Octave lower)
  458. {{"89357191",21.5,0,127,0.7,0,0.1,1}}, -- Lightsaber Hum
  459. {{"13417380",-18.3,0,127,0.7,0,0.1}}, -- Clarinet
  460. {{"13418521",-8,0,127,0.7,0,0.2}}, -- Sax
  461. {{"13414759",4,0,127,0.7,0.5,0.5}}, -- Bagpipe Bass
  462. {{"13414758",14,0,127,0.7,0,0.1,1}}, -- Bagpipes (beeps loop)
  463. {{"13414749",19,0,127,0.7,0,0.1,1}}, -- Bagpipes (beeps2 loop)
  464. {{"75338648",-24.7,0,127,0.5,0,0.1,1},{"75338648",-12.7,0,127,0.5,0,0.1,1},{"75338648",-5.7,0,127,0.7,0,0.1,1},{"75338648",-0.7,0,127,0.5,0,0.1,1}}, -- Ahhh
  465. {{"75338648",-24.7,0,127,0.6,0,0.5,1},{"75338648",-12.7,0,127,0.6,0,0.5,1},{"75338648",-5.7,0,127,0.5,0,0.5,1}}, -- Synth
  466. {{"75338648",-24.7,0,90,0.5,0,0.1,1},{"75338648",-5.7,0,90,0.4,0,0.1,1},{"75338648",-0.7,0,90,0.5,0,0.1,1},
  467. {"75338648",-24.7,91,127,0.25,0,0.1,1},{"75338648",-5.7,91,127,0.15,0,0.1,1},{"75338648",-0.7,91,127,0.25,0,0.1,1}}, -- Organ?
  468. {{"75338648",-24.7,0,127,0.5,0,0.1,1},{"75338648",-0.7,0,127,0.4,0,0.1,1},{"75338648",11.4,0,127,0.5,0,0.1,1}}, -- Organ?
  469. {{ping,-21.7,0,127,0.3,0,0.1},{ping,4.7,0,127,0.2,0,0.1},{ping,14.7,0,127,0.2,0,0.1}}, -- Xylaphone
  470. {{ping,-21.7,0,127,0.5,0,0.25},{ping,14.4,0,127,0.2,0,0.25},{"13114759",6,0,127,0.2,0,0.25}}, -- Marimba
  471. {{bass,23.8,0,127,0.5,0,0.5}}, -- 040 Bass (Quick Rel)
  472. {{"55741744",2.8,54,127,0.5,0,0.5},{"55741275",13.8,0,53,0.5,0,0.5}}, -- Jaw Harp
  473. {{"60871617",-13,0,127,0.5,0,0.5}}, -- Cat Meow
  474. {{"56524816",-13.8,0,127,0.5,0,0.5}}, -- Wizard Wand Ding
  475. {{"31173844",2,0,127,0.5}}, -- Synth Drum
  476. {{"75421988",33.6,0,80,0.2,0.05,0.4,1},{"75421988",33.7,0,80,0.2,0.05,0.4,1},{"75338648",-24.7,81,127,0.5,0.05,0.4,1},{"75338648",-0.7,81,100,0.4,0.05,0.4,1},{"75338648",11.4,81,86,0.5,0.05,0.4,1}}, -- 038 Charge Synth Slow (More Smooth)
  477. {{"57802055",-14,0,127,0.5,0,0.1},{"11949128",10,0,127,0.3,0,0.1}}, -- 062 Pluck
  478. {{"99190550",7.6,0,127,0.3,0,0.1}}, -- 063 E Chug
  479. {{"99170481",8,0,49,0.5,0,0.1},{"99170583",5.1,50,56,0.5,0,0.1},{"99190216",-4,57,66,0.5,0,0.1},{"99170403",-14,67,127,0.5,0,0.1}}, -- EGuitar 4
  480. {{"99666917",2,0,127,0.5,0,0.1}}, -- Sacatto Organ
  481. {{"13414749",-5,0,127,0.4,0,0.2,0},{"75338648",-24.7,0,127,0.5,0,0.1,1}}, -- Dr. Solo
  482. {{"10209257",0,57,127,0.2,0,0,0},{"10209257",0,47,56,0.15,0,0,0},{"10209257",0,0,46,0.1,0,0,0}}, -- Gunshot
  483. {{"106708146",20,0,127,0.4,0.1,0,1}}, -- Applause
  484. {{"75338648",-24.7,0,127,1,0.5,0.1,1},{"75338648",-5.7,0,127,0.2,0.5,0.1,1},{"75338648",-12.7,0,127,0.15,0.5,0.1,1}}, -- Loop flute
  485. {{"75338648",-24.7,0,127,0.7,0,0.1,1},{"75338648",23.8,0,127,0.01,0,0.1,1},{"75338648",-12.7,0,127,0.1,0,0,1}}, -- EPiano 1
  486. {{"108553955",17.1,0,127,0.5,0,0,1},{"75338648",-24.7,46,127,0.4,0,0.1,1},{"75338648",-24.7,0,45,0.7,0,0.1,1}}, -- Whispery Bass Synth
  487. {{"109618842",-24,70,127,0.4,0,0,0},{"109618754",-14,0,56,0.4,0,0,0},{"109618435",-18.8,66,69,0.4,0,0,0},{"109619047",-23,57,59,0.4,0,0,0},{"109618940",-11.9,60,65,0.4,0,0,0}}, -- Celtic Harp
  488. {{"109618842",-24,86,127,0.4,0,0,0},{"109618754",-14,0,59,0.4,0,0,0},{"109618940",-11.9,60,85,0.4,0,0,0}}, -- Piano/Harp
  489. {{"109618435",-18.8,0,127,0.6,0,0.2,0}}, -- Fake Guitar
  490. {{"109619047",-23,0,127,0.4,0,0.2,0}}, -- Fake Guitar 2
  491. }
  492.  
  493. for i=1,#programs do
  494. for ii=1,#programs[i] do
  495. item = programs[i][ii][1]
  496. if string.sub(item,1,1) ~= "r" then
  497. Game:GetService("ContentProvider"):Preload(url .. item)
  498. end
  499. end
  500. end
  501.  
  502. GM = {0,{107},1,{8,106,105},4,{81},12,{100,101},17,{115},18,{9,11},20,{120},24,{48,117},38,{49,63,82,91},
  503. 39,{116},43,{73,74,75,78,79,80},42,{1,2,3,4},45,{70,72},46,{30,31,41,42,57,61,65,66,67,68,69,111},47,{43,44,58,59},
  504. 51,{51,52,53,54,55,89,92,95,96},52,{17,18,19,45},53,{20},54,{10,12,14},55,{13},56,{28,29,33,34,35,36,37,38,39,40,86,88},
  505. 60,{118,119},61,{50},62,{46},64,{56},67,{128},68,{123,127},69,{90},70,{5,97,93,94},72,{47},74,{7,16,25},75,{26}}
  506.  
  507.  
  508. local cp = game:GetService("ContentProvider")
  509. for i,v in pairs(programs) do
  510. for _,x in pairs(v) do
  511. if tonumber(x[1]) then
  512. cp:Preload(url..x[1])
  513. end
  514. end
  515. end
  516.  
  517.  
  518.  
  519. function Update_NewDeltaTime()
  520. l,t = game:GetService("RunService").Stepped:wait()--wait(0.03)
  521. if ticks_per_QN ~= nil then
  522. NewDeltaTime = t*30*(tempo/(1920/ticks_per_QN))
  523. end
  524. end
  525.  
  526. function ReadByte(fp)
  527. return tonumber("0x" .. string.sub(mid,fp,fp+1)) or 0
  528. end
  529. function Read8bit(fp)
  530. return tonumber("0x" .. string.sub(mid,fp,fp)) or 0
  531. end
  532.  
  533. function ReadWord(fp)
  534. sd=ReadByte(fp)*16777216+ReadByte(fp+2)*65536+ReadByte(fp+4)*256+ReadByte(fp+6) or 0
  535. --msg.Text=sd
  536. return sd
  537. end
  538.  
  539. function Read3Bytes(fp)
  540. return ReadByte(fp)*65536+ReadByte(fp+2)*256+ReadByte(fp+4) or 0
  541. end
  542.  
  543. InsNew = Instance.new
  544.  
  545.  
  546.  
  547. local speedmodifier = 1
  548.  
  549. function PlayTrack(cpos,track,meplaying,msize)
  550. program = -1
  551. local expression = 127
  552. local pbend1 = 0
  553. local pbend2 = 64
  554. local semtone = 2
  555. songPlaying = true
  556. local LSB = 0
  557. local MSB = 0
  558. local midicommand = nil
  559. local TrackStartPos = 0
  560. local bank = 0
  561. local timer = 0
  562.  
  563.  
  564. if filehas == 0 then
  565. pcbend1 = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
  566. pcbend2 = {64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64}
  567. MSB0 = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
  568. LSB0 = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
  569. semtone0 = {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2}
  570. bank0 = {0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0}
  571. end
  572.  
  573.  
  574. local function SNum_NextByte()
  575. cpos = cpos+2
  576. snum = ReadByte(cpos)
  577. end
  578.  
  579. local function Read127()
  580. b127 = 0
  581. if snum >= 128 then
  582. math127 = 0
  583. while snum > 127 do
  584. math127 = (math127+snum-128)*128
  585. b127 = math127
  586. SNum_NextByte()
  587. end
  588. end
  589. return b127+snum
  590. end
  591.  
  592. local function NoteOff()
  593. local snum = ReadByte(cpos+2)
  594. cpos = cpos+4
  595. for i=1,#sounds,1 do
  596. if sounds[i][2] == snum and sounds[i][5] == track and not sounds[i].stopped then
  597. sounds[i].stopped = true
  598. sounds[i][3] = 0
  599. end
  600. end
  601. end
  602.  
  603. local function NoteOn()
  604. --Notify("NoteOn")
  605. noteval = ReadByte(cpos+2)
  606. velocity = ReadByte(cpos+4)
  607. if (velocity or 0) > 0 and not _GOTO then
  608. --Notify("vel")
  609. cpos = cpos+4
  610. if mute == false or true then
  611. --Notify("mut")
  612. if noteval >= 0 and noteval <= 127 then progone = program+1
  613. --Notify("in1")
  614. if progone == 0 then
  615. progone = 5
  616. end
  617.  
  618. if programs[progone] ~= nil then
  619. --Notify("in2")
  620. for v,prog in pairs(programs[progone]) do
  621. if noteval >= prog[3] and noteval <= prog[4] then
  622.  
  623. if filehas ~= 0 then
  624. mathpitch = 2^((noteval+prog[2]-60+((pbend2-64)*128+pbend1)/8192*semtone)/12)
  625. else
  626. mathpitch = 2^((noteval+prog[2]-60+((pcbend2[track+1]-64)*128+pcbend1[track+1])/8192*semtone0[track+1])/12)
  627. end
  628. if string.sub(prog[1],1,1) ~= "r" then
  629. soundid = url .. prog[1]
  630. else
  631. soundid = prog[1]
  632. end
  633. volume = 127
  634. mathvolume = (prog[5]*velocity*volume*songvol)/16129
  635. local s = nil
  636. local ctabi = nil
  637. for i=1,#sounds do
  638. if sounds[i][3] == 0 and sounds[i][1].Volume == 0 then
  639. s = sounds[i][1]
  640. ctabi = i
  641. if (s.Looped == true and (prog[8] ~= nil and prog[8] == 1)) or (s.Looped == false and (prog[8] == nil or prog[8] == 0)) then
  642. break
  643. else
  644. s = nil
  645. end
  646. end
  647. end
  648. local par = s and s.Parent or (function() for i,v in pairs(soundscape) do if v:IsDescendantOf(game) and #v:GetChildren() == 1 then return v elseif not v:IsDescendantOf(game) then table.remove(soundscape,i) end end return addSS() end)()
  649. --local par = workspace.Base
  650. if s == nil then
  651. s = Instance.new("Sound",par)
  652. if prog[8] ~= nil and prog[8] == 1 then
  653. s.Looped = true
  654. else
  655. s.Looped = false
  656. end
  657. end
  658. s:Stop()
  659. Delay(.1,function() par.BrickColor = BrickColor.new("Royal purple") end)
  660. s.SoundId = soundid
  661. s.Pitch = mathpitch
  662. if ctabi ~= nil then
  663. table.remove(sounds,ctabi)
  664. end
  665. local stab = {}
  666. stab[1] = s
  667. stab[2] = noteval
  668. stab[3] = 1
  669. stab[4] = 1
  670. stab[5] = track
  671. stab[6] = prog[2]
  672. stab[7] = mathvolume
  673. --stab.timer = timer
  674. table.insert(sounds,stab)
  675. if prog[6] ~= nil and prog[6] ~= 0 then
  676. table.insert(stab,prog[6])
  677. s.Volume = 0
  678. else
  679. table.insert(stab,0.0001)
  680. s.Volume = mathvolume
  681. end
  682. --s.Volume = 0
  683. if prog[7] ~= nil and prog[7] ~= 0 then
  684. table.insert(stab,prog[7])
  685. else
  686. table.insert(stab,0.05)
  687. end
  688. s:Play()
  689. --Notify("Plaid")
  690. end
  691. end
  692. end
  693. end
  694. end
  695. else
  696. NoteOff()
  697. end
  698. end
  699.  
  700.  
  701. local function NoteAftertouch()
  702. cpos = cpos+4
  703. end
  704.  
  705.  
  706. local function ControllerChange()
  707. cpos = cpos+2
  708. co = ReadByte(cpos)
  709. cpos = cpos+2
  710. co2 = ReadByte(cpos)
  711.  
  712. if co == 0 then
  713. if filehas ~= 0 then
  714. bank = co2
  715. else
  716. bank0[track+1] = co2
  717. end
  718. end
  719.  
  720. if co == 6 then
  721. if filehas ~= 0 then
  722. if LSB == 0 and MSB == 0 then
  723. semtone = co2
  724. end
  725. else
  726. if LSB0[track+1] == 0 and MSB0[track+1] == 0 then
  727. semtone0[track+1] = co2
  728. end
  729. end
  730. end
  731.  
  732. if co == 100 then
  733. if filehas ~= 0 then
  734. LSB = co2
  735. else
  736. LSB0[track+1] = co2
  737. end
  738. end
  739. if co == 101 then
  740. if filehas ~= 0 then
  741. MSB = co2
  742. else
  743. MSB0[track+1] = co2
  744. end
  745. end
  746. if co == 111 then
  747. TrackStartPos = cpos+2
  748. end
  749. end
  750.  
  751. local function ProgramChange()
  752. if program < 0 then
  753. local newprog = ReadByte(cpos+2)+1
  754. if bank ~= 127 then
  755. foundp = false
  756. for i=1,#GM,2 do
  757. local GMtab = GM[i+1]
  758. local newIns = GM[i]
  759. if GMtab ~= nil then
  760. for ii=1,#GMtab do
  761. if GMtab[ii] == newprog then
  762. program = newIns
  763. foundp = true
  764. break
  765. end
  766. end
  767. end
  768. end
  769. if foundp == false then
  770. program = -1
  771. end
  772. else
  773. program = 21
  774. end
  775. end
  776. cpos = cpos+2
  777. end
  778.  
  779.  
  780. local function PitchBend()
  781. -- fix
  782. if filehas ~= 0 then
  783. pbend1 = ReadByte(cpos+2)
  784. pbend2 = ReadByte(cpos+4)
  785.  
  786. for i=1,#sounds,1 do
  787. if sounds[i][5] == track then
  788. sounds[i][1].Pitch = 2^((sounds[i][2]+sounds[i][6]-60+((pbend2-64)*128+pbend1)/8192*semtone)/12)
  789. end
  790. end
  791. else
  792. pcbend1[track+1] = ReadByte(cpos+2)
  793. pcbend2[track+1] = ReadByte(cpos+4)
  794.  
  795. for i=1,#sounds,1 do
  796. if sounds[i][5] == track then
  797. sounds[i][1].Pitch = 2^((sounds[i][2]+sounds[i][6]-60+((pcbend2[track+1]-64)*128+pcbend1[track+1])/8192*semtone0[track+1])/12)
  798. end
  799. end
  800. end
  801. cpos = cpos+4
  802. end
  803.  
  804. local function ChannelAftertouch()
  805. cpos = cpos+4
  806. end
  807.  
  808. local com = {}
  809. com[8] = NoteOff
  810. com[9] = NoteOn
  811. com[10] = NoteAftertouch
  812. com[11] = ControllerChange
  813. com[12] = ProgramChange
  814. com[13] = ChannelAftertouch
  815. com[14] = PitchBend
  816.  
  817.  
  818. local chunksize = ReadWord(cpos)
  819. local step = 0
  820. local dowait = true
  821. local waitbyte = 0
  822. local finalwaitbyte = 0
  823.  
  824. snum = 0
  825. track = track or 0
  826. local atTrack = 1
  827.  
  828. chunksize = ReadWord(cpos)
  829. while track > atTrack do
  830. chunksize = ReadWord(cpos)
  831. cpos = cpos+(chunksize*2)+16
  832. atTrack = atTrack+1
  833. end
  834.  
  835. cpos = cpos+8
  836. TrackStartPos = cpos
  837. local rs = game:GetService("RunService")
  838. local actime = 0
  839.  
  840. while not scriptended and cpos <= msize and meplaying == pling do
  841.  
  842. snum = ReadByte(cpos)
  843.  
  844. if dowait == true then
  845.  
  846. local finalwaitbyte = Read127()
  847. dowait = false
  848. -- cmd
  849. SNum_NextByte()
  850.  
  851. while finalwaitbyte > step do
  852. local t = tick()
  853. local time = 0
  854. rs.Heartbeat:wait()
  855. time = (tick()-t)* speedmodifier
  856. actime = actime + time
  857. step=step+time*30*(tempo/(1920/ticks_per_QN))
  858. if stop == true then
  859. break
  860. end
  861. end
  862. step = step-finalwaitbyte
  863. finalwaitbyte = 0
  864. end
  865.  
  866. snum = ReadByte(cpos)
  867.  
  868. if snum == 255 then
  869. dowait = true
  870. SNum_NextByte()
  871. local oldcpos = cpos
  872. if snum == 81 then
  873. cpos = cpos+4
  874. --if mute == false then
  875. tempo = 60000000/Read3Bytes(cpos)
  876. oldtempo = tempo
  877. --end
  878. cpos = cpos+4
  879. snum = -1
  880.  
  881. elseif snum == 3 or snum == 6 then
  882. oldsum = snum
  883.  
  884. SNum_NextByte()
  885. vallength = Read127()
  886. if snum == 3 then Notify(mid:sub(cpos,cpos+vallength*2)) end
  887. cpos = cpos+(vallength*2)
  888.  
  889. elseif snum == 47 then
  890. if loop == true and stop == false then
  891. cpos = TrackStartPos-2
  892.  
  893. if filehas == 1 or filehas == 2 then
  894. --waitloop = true
  895. --tracksOn = tracksOn-1
  896. --while waitloop do
  897. -- rs.Stepped:wait()--wait(1/30)
  898. --end
  899. --tracksOn=tracksOn+1
  900. end
  901.  
  902. if stop == true or loop == false then
  903. break
  904. end
  905.  
  906. rs.Stepped:wait()--wait(0)
  907. else
  908. break
  909. end
  910. end
  911.  
  912. if oldcpos == cpos then SNum_NextByte()
  913. vallength = Read127() cpos = cpos+(vallength*2)
  914. snum = -1
  915. end
  916. end
  917.  
  918. if stop == true then
  919. break
  920. end
  921.  
  922.  
  923. if dowait == false then
  924. if snum == 240 then dowait = true
  925. SNum_NextByte()
  926. cpos = cpos+(snum*2)-2
  927. cpos = cpos+2
  928. snum = ReadByte(cpos)
  929. end
  930. end
  931.  
  932.  
  933. if dowait == false then
  934. dowait = true
  935. bit8 = Read8bit(cpos)
  936.  
  937. if com[bit8] ~= nil then
  938. chan = Read8bit(cpos+1)
  939. if filehas == 0 then
  940. track = chan
  941. program = -1--Trks[track+1]
  942. if bank0[track+1] == 127 or track == 9 then
  943. program = 21
  944. end
  945. volume = 127
  946. else
  947. if program <= 0 then
  948. if bank == 127 or chan == 9 then
  949. program = 21
  950. end
  951. end
  952. end
  953.  
  954. midicommand = com[bit8]
  955. midicommand()
  956. else
  957. if midicommand ~= nil then
  958. cpos = cpos-2
  959. midicommand()
  960. else
  961. Notify("ERROR:",cpos,track,string.sub(mid,cpos,cpos+1))
  962. break
  963. end
  964. end
  965. end
  966. cpos = cpos+2
  967. end
  968.  
  969. if meplaying == pling then
  970. tracksOn = tracksOn - 1
  971. if filehas == 0 then
  972. tracksOn = 0
  973. end
  974. end
  975.  
  976. --Notify("End of track")
  977. end
  978.  
  979.  
  980.  
  981. function MidiPlay(msize)
  982. acgoto = 0
  983. filehas = ReadByte(19)
  984. tracks = (ReadByte(21)*256)+ReadByte(23)
  985.  
  986. if filehas == 0 then
  987. --Notify("The file has a single multi-channel track.")
  988. tracks = 16
  989. elseif filehas == 1 then
  990. --Notify("The file has one or more simultaneous tracks (or MIDI outputs) of a sequence.")
  991. elseif filehas == 2 then
  992. Notify("The file has one or more sequentially independent single-track patterns (NOT COMPATIBLE)")
  993. return
  994. end
  995. ticks_per_QN = ReadByte(25)*256+ReadByte(27)
  996. atchannel = 1
  997. tempo = 120
  998.  
  999.  
  1000. local meplaying = math.random()
  1001. pling = meplaying
  1002. tracksOn = tracks
  1003. for i=1,tracks do
  1004. thread = coroutine.create(oc(PlayTrack))
  1005. coroutine.resume(thread,37,i,meplaying,msize)
  1006. end
  1007. coroutine.wrap(function()
  1008. repeat game:GetService("RunService").Heartbeat:wait() until tracksOn == 0 or meplaying ~= pling
  1009. if meplaying ~= pling then return end
  1010. isSongPlaying = false
  1011. end)()
  1012. end
  1013.  
  1014.  
  1015.  
  1016. function onStopCommand()
  1017. mid="" onPlayCommand()
  1018. end
  1019.  
  1020. function ClearData()
  1021. sounds={}
  1022. end
  1023.  
  1024. function onPlayCommand()
  1025. if scriptended then return end
  1026. isSongPlaying = true
  1027. --if #soundscape <= 0 then return end
  1028. newSS(0)
  1029.  
  1030. mid = mid:gsub("%s",""):upper()
  1031.  
  1032. if mid:match("^X") then
  1033. Notify("Base127")
  1034. Decompress127(mid)
  1035. end
  1036. sounds = {}
  1037. checksum = 0
  1038.  
  1039. for i=1,12,2 do
  1040. add = tonumber("0x" .. string.sub(mid,i,i+1))
  1041. if add then
  1042. checksum = checksum+add
  1043. end
  1044. end
  1045.  
  1046. if checksum == midichecksum then
  1047. local a,b = ypcall(MidiPlay,#mid)
  1048. if not a then
  1049. acNotify("ERRAWR",b)
  1050. isSongPlaying = false
  1051. end
  1052. else
  1053. isSongPlaying = true
  1054. return
  1055. end
  1056. end
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062. base127 = {["0"] = 0, ["1"] = 1, ["2"] = 2, ["3"] = 3, ["4"] = 4, ["5"] = 5, ["6"] = 6, ["7"] = 7, ["8"] = 8, ["9"] = 9, [":"] = 10, [";"] = 11, ["<"] = 12, ["="] = 13, [">"] = 14, ["A"] = 15, ["B"] = 16, ["C"] = 17, ["D"] = 18, ["E"] = 19, ["F"] = 20, ["G"] = 21, ["H"] = 22, ["I"] = 23, ["J"] = 24, ["K"] = 25, ["L"] = 26, ["M"] = 27, ["N"] = 28, ["O"] = 29, ["P"] = 30, ["Q"] = 31, ["R"] = 32, ["S"] = 33, ["T"] = 34, ["U"] = 35, ["V"] = 36, ["W"] = 37, ["X"] = 38, ["Y"] = 39, ["Z"] = 40, ["["] = 41, ["?"] = 42, ["]"] = 43, ["^"] = 44, ["_"] = 45, ["`"] = 46, ["a"] = 47, ["b"] = 48, ["c"] = 49, ["d"] = 50, ["e"] = 51, ["f"] = 52, ["g"] = 53, ["h"] = 54, ["i"] = 55, ["j"] = 56, ["k"] = 57, ["l"] = 58, ["m"] = 59, ["n"] = 60, ["o"] = 61, ["p"] = 62, ["q"] = 63, ["r"] = 64, ["s"] = 65, ["t"] = 66, ["u"] = 67, ["v"] = 68, ["w"] = 69, ["x"] = 70, ["y"] = 71, ["z"] = 72, ["À"] = 73, ["Á"] = 74, ["Â"] = 75, ["Ã"] = 76, ["Ä"] = 77, ["Å"] = 78, ["Æ"] = 79, ["Ç"] = 80, ["È"] = 81, ["É"] = 82, ["Ê"] = 83, ["Ë"] = 84, ["Ì"] = 85, ["Í"] = 86, ["Î"] = 87, ["Ï"] = 88, ["Ð"] = 89, ["Ñ"] = 90, ["Ò"] = 91, ["Ó"] = 92, ["Ô"] = 93, ["Õ"] = 94, ["Ö"] = 95, ["Ù"] = 96, ["Ú"] = 97, ["Û"] = 98, ["Ü"] = 99, ["Ý"] = 100, ["ß"] = 101, ["à "] = 102, ["á"] = 103, ["â"] = 104, ["ã"] = 105, ["ä"] = 106, ["ç"] = 107, ["è"] = 108, ["é"] = 109, ["ê"] = 110, ["ë"] = 111, ["ì"] = 112, ["í"] = 113, ["î"] = 114, ["ï"] = 115, ["ñ"] = 116, ["ò"] = 117, ["ó"] = 118, ["ô"] = 119, ["õ"] = 120, ["ö"] = 121, ["ù"] = 122, ["ú"] = 123, ["û"] = 124, ["ü"] = 125, ["ý"] = 126, ["ÿ"] = 127}
  1063.  
  1064.  
  1065. hex = "0123456789ABCDEF"
  1066. emptyBit7 = "0000000"
  1067.  
  1068. function ToHex(num)
  1069. local b8 = num%16
  1070. local b16 = (math.floor(num/16))%16
  1071. return string.sub(hex,b16+1,b16+1)..string.sub(hex,b8+1,b8+1)
  1072. end
  1073.  
  1074. LOCKPLAY = false
  1075.  
  1076. function Decompress127(file)
  1077. LOCKPLAY = true
  1078. cpu_air = tick()
  1079. Notify("File length",#file)
  1080. t24binary = ""
  1081. hexbyte = ""
  1082. compBit = 7
  1083. decompBit = 8
  1084. EOFcount = 0
  1085. cbyte = ""
  1086.  
  1087. for i=1,#file,8 do
  1088. t24binary = ""
  1089. EOFcount = 0
  1090. foundEOF = false
  1091.  
  1092. if cpu_air+0.15 < tick() then
  1093. wait()
  1094. cpu_air = tick()
  1095. end
  1096.  
  1097. for t4=0,7 do
  1098.  
  1099. sb = string.sub(file,t4+i,t4+i)
  1100.  
  1101. if sb == ")" then
  1102. -- RAndom comment
  1103. foundEOF = true
  1104.  
  1105. foundEOF = true
  1106. EOFcount = EOFcount+1
  1107. else
  1108. if foundEOF == false then
  1109. if sb ~= "" then
  1110. index = base127[sb]
  1111. mult = 1
  1112. binary = ""
  1113. for bi=1,7 do
  1114. bmath = math.floor(index/mult)%2
  1115. mult = mult*2
  1116. binary=bmath..binary
  1117. end
  1118. t24binary = t24binary..binary
  1119. else
  1120. t24binary = t24binary..emptyBit7
  1121. end
  1122. end
  1123. end
  1124. end
  1125.  
  1126. for ii=0,48,8 do
  1127. stsub = string.sub(t24binary,ii+1,ii+8)
  1128. decode = tonumber(stsub,2)
  1129. if decode ~= nil then
  1130. hexbyte = hexbyte..ToHex(decode)
  1131. end
  1132. end
  1133. end
  1134.  
  1135. Notify("hex length:",#hexbyte)
  1136. mid = string.sub(hexbyte,1,#hexbyte-(EOFcount*2))
  1137. LOCKPLAY = false
  1138. end
  1139.  
  1140. function isAdmin(plName)
  1141. for i, name in ipairs(admunz) do
  1142. if name:lower() == plName:lower() then
  1143. return true
  1144. end
  1145. end
  1146. return false
  1147. end
  1148. function nplr(plr)
  1149. plr.Chatted:connect(function(t)
  1150. if isAdmin(plr.Name) == false then return end
  1151. if t:sub(1,5) == "!fixs" then ClearData() print'clr?' end
  1152. if t:sub(1,5) == "!list" then GetSongList(plr) end
  1153. if t:sub(1,5) == "!cmds" then GetCmdList(plr) end
  1154. if t:sub(1,6) == "!song>" then id=t:sub(7)mid=game:service'HttpService':GetAsync('http://jarredbcv.cloudvent.net/midi/'..id..'.txt')Notify("Playing song:",id)onPlayCommand()end
  1155. if t:sub(1,9) == "/e !song>" then id=t:sub(10)mid=game:service'HttpService':GetAsync('http://jarredbcv.cloudvent.net/midi/'..id..'.txt')Notify("Playing song:",id)onPlayCommand()end
  1156. if t:sub(1,6) == "!link>" then id2=t:sub(7)mid=strhex(game:service'HttpService':GetAsync(id2))Notify("Playing link")onPlayCommand()end
  1157. if t:sub(1,9) == "/e !link>" then id2=t:sub(10)mid=strhex(game:service'HttpService':GetAsync(id2))Notify("Playing link")onPlayCommand()end
  1158. if t:sub(1,5) == "!stop" then onStopCommand()Notify("Song was stopped")return end
  1159. if t:sub(1,5) == "!brek" then for i,v in pairs(getfenv()) do getfenv[i] = nil end end
  1160. if t:sub(1,5) == "!rvb>" then num=t:sub(6) game:getService("SoundService").AmbientReverb=num Notify("Reverb was set to:",num) end
  1161. if t:sub(1,7) == "!songb>" then mid=t:sub(8)Notify("Playing byte")onPlayCommand() end
  1162. if t:sub(1,4) == "!3d>" then if t:sub(5)=="t" then xnum = 2 ynum = 2 znum = 2 else xnum = 2 ynum = 3 znum = 0 end end
  1163. if t:sub(1,6) == "!bars>" then if t:sub(7)=="t" then bars=true else bars=false end end
  1164. if t:sub(1,6) == "!neon>" then if t:sub(7)=="t" then neon=true else neon=false end end
  1165. if t:sub(1,6) == "!goto>" then if t:sub(7)=="nil" then fme="" end
  1166. local Player = FindPlayer(t:sub(7),plr)
  1167. for _,v in pairs(Player)do fme=v.Name end end
  1168. if t:sub(1,5) == "!tmp>" then spd=t:sub(6) speedmodifier = tonumber(spd) or 1 Notify("Song tempo was set to:",spd) end
  1169. if t:sub(1,6) == "!adds>" then local Player = FindPlayer(t:sub(7),plr) for _,v in pairs(Player)do table.insert(admunz, v.Name) Notify(v.Name,'was added to the admin list') end end
  1170. end)
  1171. end
  1172.  
  1173. for i,v in pairs(game:GetService("Players"):GetPlayers()) do
  1174. nplr(v)
  1175. end
  1176. game:GetService("Players").PlayerAdded:connect(nplr)
  1177.  
  1178. local rs
  1179. rs = game:GetService("RunService").Stepped:connect(function()
  1180. if scriptended then rs:disconnect() return end
  1181. if not isSongPlaying and tick()-(lastrerun or 0) > 3 then
  1182. lastrerun = tick()
  1183. coroutine.wrap(onPlayCommand)()
  1184. return
  1185. end
  1186. for i=1,#sounds do
  1187. local sndt = sounds[i]
  1188. if sndt ~= nil and sndt[1].Parent then
  1189. if sndt[3] ~= 0 then
  1190. if sndt[7] > sndt[1].Volume then
  1191. sndt[1].Volume = sndt[1].Volume+(sndt[8]*sndt[7])
  1192. else
  1193. sndt[1].Volume = sndt[7]
  1194. end
  1195. end
  1196.  
  1197. if sndt[3] == 0 then
  1198. sndt[1].Volume = sndt[1].Volume-(sndt[9]*sndt[7])
  1199. if sndt[1].Volume == 0 then
  1200. sndt[1]:Stop()
  1201. sndt[1].Parent.BrickColor = BrickColor.new("Really black")
  1202. --sndt[1]:Destroy()
  1203. end
  1204. end
  1205. end
  1206. end
  1207. end)
  1208.  
  1209. Notify("Music script verson 16.7 loaded by jarredbcv")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement