ElementsMedia & visuals
CreateBytebeat
Creates a configurable bytebeat audio generator and returns its playback controller.
CreateBytebeat
What it does
Creates a configurable bytebeat audio generator and returns its playback controller.
When to use it
Use it for procedural audio when you need the factory form of the bytebeat API.
XLQPGen1:CreateBytebeat(config)
local Bytebeat = Library:CreateBytebeat({
Name = "Bytebeat Lab",
Default = "t*(t>>5|t>>8)",
Mode = "Bytebeat",
Hz = 22050,
Seconds = 3,
MaxSeconds = 300,
Pitch = 1,
Speed = 1,
Visualizer = true,
VisualizerHeight = 150,
Playlist = {
{Name = "Classic Bytebeat", Mode = "Bytebeat", Code = "t*(t>>5|t>>8)", Hz = 22050, Duration = 30},
{Name = "Pulse Bytebeat", Mode = "Bytebeat", Code = "t*(t>>7&t>>12)", Hz = 22050, Duration = 60},
{Name = "Arp Bytebeat", Mode = "Bytebeat", Code = "t*(t>>6|t>>9|t>>13)", Hz = 32000, Duration = 90},
{Name = "Stereo Crunch", Mode = "Bytebeat", Code = [=[vl=t/6|0, vr=(t+240)/6|0,
L=((vl*(vl>>12)&(201*vl/100)&(199*vl/100))&(vl*(vl>>14)&(vl*301/100)&(vl*399/100)))+((vl*(vl>>16)&(vl*202/100)&(vl*198/100))-(vl*(vl>>17)&(vl*302/100)&(vl*298/100))),
R=((vr*(vr>>12)&(201*vr/100)&(199*vr/100))&(vr*(vr>>14)&(vr*301/100)&(vr*399/100)))+((vr*(vr>>16)&(vr*202/100)&(vr*198/100))-(vr*(vr>>17)&(vr*302/100)&(vr*298/100))),
[(L&255)-128, (R&255)-128]]=]},
{Name = "JS Reverb Preset", Mode = "Bytebeat", Code = "T=t,t*=1.2,r=repeat=(x,y)=>Array(x).fill(y).flat(9),lim=limiter=input=>input,Master=pan=>0,[Master(0),Master(1)]"},
{Name = "XLQP Phonk Preset", Mode = "Bytebeat", Code = "[(this.a??=0,r=t/1.25,p=t*2**(parseInt('25259474'[7&r>>13],36)/12)/2.1,a=(a*24+((p%88+p%59*6/4)-64)/((r/'4142'[3&r>>13]%4096+128)**.7)*64)/32,a/12),(this.a??=0,r=t/1.25,p=t*2**(parseInt('25259474'[7&r>>13],36)/12)/2.1,a/12)]"},
{Name = "Float Melody", Mode = "Floatbeat", Code = [=[t==0?(a=b=d=e=0):0,
A='1111100000011111111111111111111111111111111111111111111000001111111001111111110001000000000000001111110000000000000000000111111111111001111110000000000000000000000000000000000',
n=1.23,
m=[5,5,5,8,8,8,10,10,10,10,12,13,13,13,12,12,7,7,7,10,10,[9.8,9.5,9.3,9.1][t>>10&3],8,8,8,8,17,12,12,12,8,8,7,7,7,13,13,13,17,17,17,17,13,13,12,12,13,13,0,0,0,10,10,10,8,8,8,8,5,5,0,0,5,5,5,5,5,8,8,8,10,10,10,10,12,13,13,13,12,12,7,7,7,10,10,[9.8,9.5,9.3,9.1][t>>10&3],8,8,8,8,17,12,12,12,8,8,7,7,7,20,20,20,17,17,17,17,13,13,12,12,13,13,10,10,10,22,22,22,20,20,20,20,17,17,13,12,10,12],
c=a+=b+=(n*2**(m[t>>12&127]/12)-b)/800,
s=[3,3,3,[3,4][t>>13&1]][t>>14&3],
p=[1,s,5,[0,0,0,[-2,0][t>>13&1]][t>>14&3],1,s,5,[8,8,8,[10,12][t>>13&1]][t>>14&3]],
g=d+=e+=(n*2**(p[t>>16&7]/12)-e)/400,
(A[(c*175>>8)%175]/1.3+(A[(g*175>>8)%175]/2+(A[(g/2*175>>8)%175]/3-1)))*((-(t+"00055522227744440005552222774422"[t>>12&31]*4096)>>7&255)/200)+sin(t*n*PI/512)*((-t>>13&1)*.25)]=]},
{Name = "Soft Floatbeat", Mode = "Floatbeat", Code = "sin(t/18)*0.7+sin(t/53)*0.25"},
{Name = "Lua Tone", Mode = "Lua", Code = "return math.sin(t / 22) * 0.8"}
},
Callback = function(player)
print("bytebeat generated", player.Asset)
end
})Behavior and return value
Store the returned controller or object when later code needs to update its state, call its methods, or close it.
Fields marked optional may be omitted. XLQP then uses the method’s built-in default or leaves that feature disabled.