I always load up all my music in one go. Never worry about their memory use in game(not normally a lot). Hence the stop music command and not delete music above, and level so I can play from the the music selection. Will have a look at your link, but memory leaks are not new here

Edit - Surprised you said my code didn't work, it works fine here. Here is a full program to try using the suggestion. I include media and an exe also.
Rem Project: Music player
Rem Created: Wednesday, August 18, 2010
Rem ***** Main Source File *****
set display mode 800,600,32,1
sync on
randomize timer()
soundnum=12
dim a$(soundnum)
set dir "media"
for n= 1 to soundnum
cls
read a$
a$(n)=a$
tune=rnd(soundnum-1)+1
center text 400,0,"Loading "+a$
load music a$+".mid",n
sync
next n
set dir ".."
tune=rnd(soundnum-1)+1
play music tune
cls
do
if spacekey()=1 and rep=0
cls
rep=1
stop music tune
tune=rnd(soundnum-1)+1
center text 400,100,"Now Playing "
center text 400,120,a$(tune)
play music tune
endif
if spacekey()=0
rep=0
center text 400,100,"Now Playing "
center text 400,120,a$(tune)
endif
sync
LOOP
data "ninja-step","over-the-bay","run-or-die","the-shinobi","terrible-beat-boss-","sunrise-blvd-"
data "like-a-wind-xg-","chinatown","boss-fight","bonus-stage","failure","stage-complete"
All you need to do to add more tunes is to add the extra to the variable soundnum, and put the names in the data array. If nothing else it's a nostalgia trip for some

No points for guessing what sort of game I am working on presently!
http://s6.bitefight.org/c.php?uid=103081