Simple midi player

Post Reply
Henko
Posts: 797
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Simple midi player

Post by Henko »

Hi all,
I use this little tool to test downloaded midi files, and to delete them right away if they aren't worth to be kept.
F332953D-F64E-4E92-8808-6A3DE4D533EA.png
F332953D-F64E-4E92-8808-6A3DE4D533EA.png (1.28 MiB) Viewed 171 times

Code: Select all

graphics ! graphics clear ! draw color 0,0,0
do ! del=0
  f$=file_select$("Midi files","mid",100,100,400,700,.8,.9,.6)
  if f$="" then break else muziek(f$)
  if del then file f$ delete
  until forever
end

' paged filesector
' list files with extension ext$ from current directory
' background remains unchanged after fileselector closes
' title$ = title of the fileselector window
' ext$ = file extension filter.
'        If ext$="" then all files will be displayed in the list
'
def file_select$(title$,ext$,xs,ys,ww,hh,R,G,B)
name$="midi_"
page name$ set ! page name$ frame xs,ys,ww,hh
page name$ color R,G,B,0
fill color R,G,B ! set buttons custom
button name$&"win" text "" at 0,0 size ww,hh ! set buttons default
button name$&"title" text title$ at 1,1 size ww-2,27
button name$&"cancel" text " Stop " at 10,hh-50 size 80,40
button name$&"del" text "Delete" at ww/2-40,hh-50 size 80,40
button name$&"ok" text " Play " at ww-90,hh-50 size 80,40
again:
dir "" list files fil$,nfiles
dim ff$(nfiles) ! nf=0
for i=0 to nfiles-1 ! f$=fil$(i) ! pos=instr(f$,".")
  if pos>-1 then
    e$=right$(f$,len(f$)-pos-1)
    if e$=ext$ then ! nf+=1 ! ff$(nf-1)=f$ ! end if
    end if
  next i
if nf then
  dim fil$(nf) ! for i=0 to nf-1 ! fil$(i)=ff$(i) ! next i
  end if
set lists custom ! fill color R,G,B
list name$ text fil$ at 3,33 size ww-7,hh-96
page name$ show
nr=-1 ! fsel$="" 
do slowdown
  if bp(name$&"cancel") then ! fsel$="" ! break ! end if
  nr=list_selected(name$) ! if nr=-1 then continue
  if bp(name$&"ok")  then ! fsel$=fil$(nr) ! break ! end if
  until forever
'page "" set
return fsel$
end def

def muziek(f$)
playing=0
do
  if not playing then ! notes load f$ ! notes play ! playing=1 ! end if
  if bp("midi_del") then ! .del=1 ! break ! end if
  until bp("midi_cancel") or notes_time()>=notes_length()
notes stop
end def

def bp(a$) = button_pressed(a$) 

smbstarv
Posts: 54
Joined: Wed Nov 27, 2013 3:44 pm
My devices: Ipad 6th gen
Flag: Netherlands
Contact:

Re: Simple midi player

Post by smbstarv »

Henko, thanks.
Please accept my midi homework.
Smbstarv
Attachments
AINT SHE SWEET.MID
Homemade
(9 KiB) Downloaded 12 times

Henko
Posts: 797
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Re: Simple midi player

Post by Henko »

Jolly good, exactly the kind of music that i search for my "bridgeclock" program.
Do i have your permission to use it (non commercially)?

smbstarv
Posts: 54
Joined: Wed Nov 27, 2013 3:44 pm
My devices: Ipad 6th gen
Flag: Netherlands
Contact:

Re: Simple midi player

Post by smbstarv »

Of course !

Post Reply