Okay, as planned I have merged those three functions in a single program.
There is a bunch of optimizations, especially around the regular expressions (mostly thanks to this very handy website), so now it won't miss a single midi :].
I decided to make a real user interface (which may remind you something :p) for some additional features, and now the program got a name: GRAMP! (also know as Global Random Midi Player )
This will be released quite soon, as most functions are already working, and in the mean time I'll post some of the scripts here.
The idea is to be able to add midi sources as "plugins", that everyone can write to expand the range of GRAMP!
So here is what the three first sources scripts look like :
8notesGet(){
Loop
{
;Choose a page to download a song from
Random, rand, 300, 13000
UrlDownloadToFile, http://www.8notes.com/scores/%rand%.asp?ftype=midi, page.htm
FileRead, Haystack, page.htm
FileDelete, page.htm
;Retrieve the file link
RegExMatch(Haystack,"http?:\/\/.*.(midi|mid)",file)
;Send result if there's a file
RegExMatch(Haystack,"midi_on",midi)
StringLen, check, midi
StringLen, check, file
if (midi >0 and check > 0)
{
return %file%
}
}
}
The main application calls a function in the external script, that returns a midi file with its path.
So if you want to join, feel free to write a plugin for your favorite website if you like .
I believe it's better to use websites with an id for each song for now, as they're easier to randomize, and usually have a specific info page for each song, with some additional ressources that GRAMP! is probably going to use later.
Yeah thanks! Apparently you just have to use %ProgramFiles%\Synthesia\synthesia.exe for autokey ^^
Btw those scripts have changed a bit in the meantime, to include the "id" for my lil log file.
I also added another source, http://www.midicenter.com, to add a bit of pop fantasy :]
Gramp has arrived, see the first post
That's mainly some ramblings of a non-developer, as Rich would say
So please report bugs if something doesn't work as expected :p
For real, how in the world did you compress it so my compression ratio of 7Zip is like 3479% ???
Anyway, it's supercool and worked fine for me on Win7.
Finally something to mess around MIDI sites with without doin' it self!
After messing some more it looks like it freezes some after you scrub the volumebar a lot. And is it supposed to return an empty MsgBox after leaving Synthesia with the Play-button in GRaMP! ?
Oups looks like it forgot to remove a debugging box :p
This one was there to check the score array from Synthesia
It's re-uploaded without it, should be better
Dunno what's up with that volume bar though
Thanks for trying Gramp ^^
Is there a maximum amount of sources that will be saved or is that infinite?
What are the numbers for next to the volume?
What is the green bar?
Is Local the folders that Synthesia watches?
Maby it can play from a certian directory file.
DC64 wrote:I love it! Is there any way I can be involved?
Is there a maximum amount of sources that will be saved or is that infinite?
Currently the number of sources is mostly limited to the number of good midi portals I know. But I guess that could be as infinite as the web can be .
As I said in a previous message, you can be involved by writing a plugin for your favourite midi website (see the files in the sources folder), or if you don't know how to script in autohotkey,
you can still send me the links (I already read all that thread). Each song gotta have its own page, with an ID to find it, for example: "http://www.mutopiaproject.org/cgibin/pi ... .cgi?[b]id[/b]=1108"
DC64 wrote:What are the numbers for next to the volume?
What is the green bar?
Please do us a favour and read everything twice
As mentioned, the grey box next to the volume displays the size of the midi (in octets). As I can't retrieve the length yet, that's still a way to judge the complexity of a song, as it's size is directly proportional to the number of notes. When I'll have the length, I'll be able to divide it from the size or notes, to display its complexity with a colour code in that same box.
Concerning the green bar, that's obviously a time slider, but as I also explained it will be activated in the next version.
DC64 wrote:Is Local the folders that Synthesia watches?
Maby it can play from a certian directory file.
If people want more control I think I can make some room for custom directories.
For now I'm retrieving the watched folders indeed.
Just a little update.
I realized that the last tab was showing the old shortcuts.
The corrected archive is up, with those :
F1: Save - F2:Play - F3:Skip - F4:Exit
Btw you may also use F5 if you want to reload the thing for whatever reason.
Well that's a nice try
But that ain't gonna work unfortunately
You took that code from the Mutopia function, but Mididb doesn't have that ID system I was talking about.
Just look at the URL when you are on their website:
Mutopia: http://www.mutopiaproject.org/cgibin/piece-info.cgi?id=1108
Mididb: http://themes.mididatabase.com/movies/
Those two are really different
Let's check the first two lines in the loop:
Random, rand, 1, 2000 > The script chooses a number between 1 and 2000, for example rand=300
UrlDownloadToFile, http://www.mididb.org/cgibin/piece-info.cgi?id=%rand%, page.htm > It tries to retrieve the page with that URL http://www.mididb.com/cgibin/piece-info.cgi?id=300
->And of course the page won't exist
I could do random scripts based on other things that a random ID, but for the moment it's more simple this way.
After those lines there is a "RegExMatch", which is a regular expression you have to adapt for each site, but that's already a lot more complex than the first two lines.
If you want to try stuff for yourself, just install Autohotkey (and read a bit of the documentation). You will see what works and what doesn't.
Hey I found some homework for you DC64 (or anyone else who wants to be involved), if you still want to play around with code http://ichigos.com
This one is for anime & game music fans out there.
Each section has its own id, but this site is a bit more tricky because you can have several songs by anime/game.
So you have to find a random "sheet" url (1 to 500), then find a random song in that page.
Good luck
PS: Here is a simplified standalone 8notes script to start with:
Loop
{
;Choose a page to download a song from
Random, rand, 300, 13000
UrlDownloadToFile, http://www.8notes.com/scores/%rand%.asp?ftype=midi, page.htm
FileRead, Haystack, page.htm
FileDelete, page.htm
;Retrieve the file link
RegExMatch(Haystack,"http?:\/\/.*.(midi|mid)",fileplus)
filepath=%fileplus%|http://www.8notes.com/scores/%rand%.asp?ftype=midi
;Send result if there's a file
StringLen, check, fileplus
if (check > 0)
{
msgbox, %filepath%
}
else
{
msgbox, No url with that id: %rand%
}
}