Simple midi player

Post Reply
Henko
Posts: 814
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 3603 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: 98
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 648 times

Henko
Posts: 814
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: 98
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 !

User avatar
Dav
Posts: 279
Joined: Tue Dec 30, 2014 5:12 pm
My devices: iPad Mini, iPod Touch.
Location: North Carolina, USA
Contact:

Re: Simple midi player

Post by Dav »

Nice midi player, @Henko. Thanks for sharing it. Handy little program.

Hey @smbstarv, did you play/record that version of ain’t she sweet? Very nice rendition of it. I have to play/sing that song frequently when entertaining at nursing homes. After all these years that old song is still popular with seniors.

- Dav

Post Reply