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