Advertisement
Upscalefanatic3

MiDi Player

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