Make Beats Online

kama

benkama.net
VIP Junglist
Messages
2,762
Likes
48
#4
the tempo is not very steady man... try it with a kick each 4th steps and you'll see. Or then its my Opera fucking me up.
 

changa

New Member
Messages
4
Likes
0
#5
No idea what that virus stuff was all about, hopefully nothing to do with me.

The tempo is beign worked on - a new version does work near perfect upto about 130 bpm, but then on faster bpms not as good - problem is that it is online, uses flash, and is affected by every other programme that is active. Hopefully will sort it out soon, will let you know when the full site goes up.
 

Affliction

thought size didnt matter
VIP Junglist
Messages
1,191
Likes
3
#6
Warning! Trend PC-collin has detected a virus.
Infected File: Temporary Internet FIles \ Content.IE5 \ YORY9BSI \ archive[1].jar
Virus Name: JAVA_BYTVERIFY.A

comes up every time i open the page, i think it could possibly be something to do with those stat counters you have at the bottom?


anyways, nice beat creator man, i made something similar in basic a while ago.... i can give you the source code to have a browse through if you like :thumbsup:
 

Affliction

thought size didnt matter
VIP Junglist
Messages
1,191
Likes
3
#9
here's the source code for my old one, might point you in the right direction a bit... i see you're having the same problems i did with the timing :)

Graphics 701,201,16,2
AppTitle("Beat Creator 0.1")
HidePointer

ClsColor(255,255,255)

SetBuffer(BackBuffer())
Cls

Type Control
Field Image
Field Pressed
End Type

Type Metronome
Field Alive
Field PositionX
Field Frame
End Type


Global BeatInterval = 500 /4
Global CurBeat = 1
Global ProgramStartTime = MilliSecs()
Global CurrentRunTime = MilliSecs() - ProgramStartTime
Global NextBeatTime = 1000

Dim Sounds(6)
Sounds(1) = LoadSound("snd01.wav")
Sounds(2) = LoadSound("snd02.wav")
Sounds(3) = LoadSound("snd03.wav")
Sounds(4) = LoadSound("snd04.wav")
Sounds(5) = LoadSound("snd05.wav")
Sounds(6) = LoadSound("snd06.wav")

Dim SoundMatrix(6,16,2)

Global Metronome = LoadAnimImage("flash.bmp",20,20,0,10)
MaskImage(Metronome,255,255,255)

Global Ctrl01.Control = New Control
Ctrl01\Image = LoadAnimImage("ctrl01.bmp",25,20,0,2)
Ctrl01\Pressed = False

Global Ctrl01b.Control = New Control
Ctrl01b\Image = LoadAnimImage("ctrl01b.bmp",25,20,0,2)
Ctrl01b\Pressed = False

Global Ctrl02.Control = New Control
Ctrl02\Image = LoadAnimImage("ctrl02.bmp",50,20,0,2)
Ctrl02\Pressed = False

Global Ctrl03.Control = New Control
Ctrl03\Image = LoadAnimImage("ctrl03.bmp",50,20,0,2)
Ctrl03\Pressed = False


Global Cursor = LoadImage("cur.bmp")
MaskImage(Cursor,255,255,255)


Dim Labels(6)
For x = 1 To 6
Labels(x) = LoadImage("lbl"+x+".bmp")
Next

Global ProgramClose = False

FPS = CreateTimer(50)



Repeat

UpdateTime()
CaptureClick()
UpdateMetronome()
UpdateMatrix()
DrawScene()

WaitTimer(FPS)

Flip 0
Cls
Until ProgramClose = True
End


;=====================================================================================================================

Function UpdateTime()

CurrentRunTime = MilliSecs() - ProgramStartTime

If CurrentRunTime > NextBeatTime
CreateBeat()
EndIf

End Function

;============================

Function CreateBeat()

NextBeatTime = CurrentRunTime + BeatInterval

CreateMetronome(CurBeat)

For x = 1 To 6
If SoundMatrix(x,CurBeat,1) = True
ChanMain = PlaySound(Sounds(x))
EndIf
Next

CurBeat = CurBeat +1
If CurBeat = 17 Then CurBeat = 1

End Function

;============================

Function CaptureClick()

If MouseHit(1)
MX = MouseX() : MY = MouseY()


Select True
Case PointInsideBox(MX,MY,640,54,25,20)
Ctrl01 \ Pressed = True
BeatInterval = BeatInterval + 5
Case PointInsideBox(MX,MY,665,54,25,20)
Ctrl01b \ Pressed = True
BeatInterval = BeatInterval - 5
Case PointInsideBox(MX,MY,640,80,50,20)
Ctrl02 \ Pressed = True
ClearMatrix()
Case PointInsideBox(MX,MY,640,105,50,20)
Ctrl03 \ Pressed = True
ProgramClose = True
End Select


XPos = 60
For X = 1 To 16
If PointInsideBox(MX,MY,XPos,30,30,20)
SoundMatrix(1,X,2) = True
EndIf
XPos = XPos + 35
Next

XPos = 60
For X = 1 To 16
If PointInsideBox(MX,MY,XPos,55,30,20)
SoundMatrix(2,X,2) = True
EndIf
XPos = XPos + 35
Next

XPos = 60
For X = 1 To 16
If PointInsideBox(MX,MY,XPos,80,30,20)
SoundMatrix(3,X,2) = True
EndIf
XPos = XPos + 35
Next

XPos = 60
For X = 1 To 16
If PointInsideBox(MX,MY,XPos,105,30,20)
SoundMatrix(4,X,2) = True
EndIf
XPos = XPos + 35
Next

XPos = 60
For X = 1 To 16
If PointInsideBox(MX,MY,XPos,130,30,20)
SoundMatrix(5,X,2) = True
EndIf
XPos = XPos + 35
Next

XPos = 60
For X = 1 To 16
If PointInsideBox(MX,MY,XPos,155,30,20)
SoundMatrix(6,X,2) = True
EndIf
XPos = XPos + 35
Next


Else
Return 0
EndIf

End Function

;========================

Function CreateMetronome(Beat)

Flash.Metronome = New Metronome
Flash \ Alive = True
Flash \ Frame = 0
Select Beat
Case 1: Flash \ PositionX = 65
Case 2: Flash \ PositionX = 100
Case 3: Flash \ PositionX = 135
Case 4: Flash \ PositionX = 170
Case 5: Flash \ PositionX = 205
Case 6: Flash \ PositionX = 240
Case 7: Flash \ PositionX = 275
Case 8: Flash \ PositionX = 310
Case 9: Flash \ PositionX = 345
Case 10: Flash \ PositionX = 380
Case 11: Flash \ PositionX = 415
Case 12: Flash \ PositionX = 450
Case 13: Flash \ PositionX = 485
Case 14: Flash \ PositionX = 520
Case 15: Flash \ PositionX = 555
Case 16: Flash \ PositionX = 590
End Select

End Function

;========================

Function UpdateMetronome()

For Flash.Metronome = Each Metronome

If Flash \ Alive = True
DrawBlock(Metronome,Flash\PositionX,10,Flash\Frame)
Flash \ Frame = Flash \ Frame + 1
If Flash \ Frame > 9
Flash \ Alive = False
EndIf
Else
Delete Flash
EndIf

Next

End Function

;========================

Function UpdateMatrix()

For X = 1 To 6
For Y = 1 To 16
If SoundMatrix(X,Y,2) = True
If SoundMatrix(X,Y,1) = True
SoundMatrix(X,Y,1) = False
Else
SoundMatrix(X,Y,1) = True
EndIf
SoundMatrix(X,Y,2) = False
EndIf
Next
Next

End Function

;========================

Function ClearMatrix()

For X = 1 To 16
For Y = 1 To 6
SoundMatrix(Y,X,1) = False
Next
Next

End Function

;========================

Function DrawScene()

Color 0,0,0

Rect 0,0,700,200,False
Rect 1,1,698,198,False
Rect 5,5,690,190,False
Rect 6,6,688,188,False

CaptureClick()

DrawLabels()
DrawControls()
DrawGrid()
DrawGridMatrix()
UpdateMetronome()

DrawImage(Cursor,MouseX(),MouseY())

End Function

;=========================

Function DrawGrid()

Local Y = 30

Repeat
DrawCell(60,Y,30,20,True)
DrawCell(95,Y,30,20,False)
DrawCell(130,Y,30,20,False)
DrawCell(165,Y,30,20,False)
DrawCell(200,Y,30,20,True)
DrawCell(235,Y,30,20,False)
DrawCell(270,Y,30,20,False)
DrawCell(305,Y,30,20,False)
DrawCell(340,Y,30,20,True)
DrawCell(375,Y,30,20,False)
DrawCell(410,Y,30,20,False)
DrawCell(445,Y,30,20,False)
DrawCell(480,Y,30,20,True)
DrawCell(515,Y,30,20,False)
DrawCell(550,Y,30,20,False)
DrawCell(585,Y,30,20,False)

Y = Y + 25
Until Y = 180

End Function

;========================

Function DrawGridMatrix()

XPos = 65
For X = 1 To 16
If SoundMatrix(1,X,1) = True Then DrawImage(Metronome,Xpos,30,0)
If SoundMatrix(2,X,1) = True Then DrawImage(Metronome,Xpos,55,0)
If SoundMatrix(3,X,1) = True Then DrawImage(Metronome,XPos,80,0)
If SoundMatrix(4,X,1) = True Then DrawImage(Metronome,XPos,105,0)
If SoundMatrix(5,X,1) = True Then DrawImage(Metronome,XPos,130,0)
If SoundMatrix(6,X,1) = True Then DrawImage(Metronome,XPos,155,0)
XPos = XPos + 35
Next

End Function

;=========================

Function DrawCell(X,Y,Width,Height,Greyed)

If Greyed = True
Color 220,220,220
Rect X,Y,Width,Height
Color 0,0,0
EndIf

Rect X,Y,Width,Height,False

End Function

;==========================

Function DrawLabels()

Local Y = 35

For x = 1 To 6
DrawBlock(Labels(x),10,Y)
Y = Y + 25
Next

End Function

;==========================

Function DrawControls()

Select Ctrl01 \ Pressed
Case False : DrawBlock(Ctrl01 \ Image,640,54,0)
Case True : DrawBlock(Ctrl01 \ Image,640,54,1) : Ctrl01 \ Pressed = False
End Select

Select Ctrl01b \ Pressed
Case False : DrawBlock(Ctrl01b \ Image,665,54,0)
Case True : DrawBlock(Ctrl01b \ Image,665,54,1) : Ctrl01b \ Pressed = False
End Select

Select Ctrl02 \ Pressed
Case False : DrawBlock(Ctrl02 \ Image,640,80,0)
Case True : DrawBlock(Ctrl02 \ Image,640,80,1) : Ctrl02 \ Pressed = False
End Select

Select Ctrl03 \ Pressed
Case False : DrawBlock(Ctrl03 \ Image,640,105,0)
Case True : DrawBlock(Ctrl03 \ Image,640,105,1) : Ctrl03 \ Pressed = False
End Select

End Function

;========================

Function PointInsideBox(PointX,PointY,BoxX,BoxY,BoxWidth,BoxHeight)

If (PointX > BoxX) And (PointX < (BoxX + BoxWidth))
If (PointY > BoxY) And (PointY < (BoxY + BoxHeight))
Return True
Else
Return False
EndIf
EndIf

End Function

;=======================
 
Top