' ritm box (quicky)
' programmed by Michiel
' 24-10-2015
'
option base 0
True=1
False=0
notes tempo 300
ninstrument=4
dim instrument$(ninstrument),noot$(ninstrument)
data "bass drum", "b1"
data "snare drum", "d2"
data "closed hihat", "f#2"
data "ride cymbal", "d#3"
for i=0 to ninstrument-1
read instrument$(i),noot$(i)
next i
cellw=38
cellh=50
gridoffx=120
gridoffy=200
dim pattern(4,16)
def gridx(col)
gridx=.gridoffx+col*.cellw+5*floor(col/4)
end def
for row=0 to ninstrument-1
y=gridoffy+row*cellh
name$="f-"&str$(row)
field name$ text instrument$(row) at 10, y size 100,35 ro
for col=0 to 15
name$="b-"&str$(row)&"-"&str$(col)
button name$ text " " at gridx(col), y
next col
next row
poll:
slowdown
mutated=False
for row=0 to ninstrument-1
for col=0 to 15
name$="b-"&str$(row)&"-"&str$(col)
if button_pressed(name$) then
if pattern(row,col) then
button name$ text " "
pattern(row,col)=False
else
button name$ text " @ "
pattern(row,col)=True
end if
mutated=True
end if
next col
next row
if mutated then
drum$=""
for col=0 to 15
chord$="("
for row=0 to ninstrument-1
if pattern(row,col) then chord$&=noot$(row)
next row
chord$&=")"
if chord$="()" then chord$="r"
drum$&=chord$
next col
notes stop
notes set ,,,,,,,,,drum$ & drum$ & drum$ & drum$
notes play
end if
goto poll
"Ritm box", a quicky
-
- Posts: 814
- Joined: Tue Apr 09, 2013 12:23 pm
- My devices: iPhone,iPad
Windows - Location: Groningen, Netherlands
- Flag:
"Ritm box", a quicky
Last edited by Henko on Mon Oct 26, 2015 10:05 pm, edited 1 time in total.
- rbytes
- Posts: 1338
- Joined: Sun May 31, 2015 12:11 am
- My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet - Location: Calgary, Canada
- Flag:
- Contact:
Re: "Ritm box", a quicky
The very first drum machine in smartBASIC
The only thing that gets me down is gravity...