Just in case anyone's a bit bored and looking for a challgenge I'm looking for a program (any language but must run in windows XP - its be amazing if it could be done in Scratch or BYOB itself!) that will take a .mid file and convert it into a series of sprites containing set instrument to x, play note y for z beats, (and rests of course).
I'm going to try getting a class of pupils to use their netbooks as a e-orchestra and it would nice to setup the main computer with a real midi keyboard and midi-in recorder to record short sequences and then edit them in Scratch and thne play them back out all together with a conductor at the front of the class.
Simon
Offline
1) That's not what he wanted
2) That's not what he wanted
3) I just got rick roll'd
4) I have the strange urge to obey you!
Offline
Um… try recording the file?
Offline
I doubt this is gonna be easy... maybe you should put a C++ coded converter as a middle step, for the processing power...
Offline
@flashgocrazy - this is the advanced section
@LS97 - i don't have the time/skill to do it - I'm looking for someone who's bored and capable
I think it will have to written in a "grown-up" language
but in concept it could be failry simple - read midi file - split into midi tracks - and then the hard bit - write it out as a Scratch sprite!
Simon
Offline
SimpleScratch wrote:
I think it will have to written in a "grown-up" language
but in concept it could be failry simple - read midi file - split into midi tracks - and then the hard bit - write it out as a Scratch sprite!
Writing it out as a Scratch sprite is definitely the hardest part. I'm not sure if it's possible to do it in something like Python and not in Squeak itself, but I might go have a look!
Offline
I'll (mildly) attempt this.
Offline
Go blob8108 and bobbybee !
[edit]daft info removed
[/edit]
Simon
Last edited by SimpleScratch (2011-12-12 02:17:23)
Offline
SimpleScratch wrote:
Go blob8108 and bobbybee !
[edit]daft info removed[/edit]
Simon
I assume this is the relevant thread...
It'd be really useful to have a MIDI file and corresponding Scratch .sprite file to demonstrate precisely what it is you're looking for.
Offline
I'll get onto it.
Simon
Offline
Here is a simple midi file generated in Anvil Studio
http://dl.dropbox.com/u/1173161/scratch/Frere%20Jaques.mid
and first half of it in Scratch
http://dl.dropbox.com/u/1173161/scratch/frere.PNG
Si
Offline
Scratch has a built-in MIDI player. It is inherited from Squeak.
You need to Shift-Click-R before play.
Then open "file list" from "World" menu and select the midi file.
To play it, choose "play midi file" from right button menu.
https://twitter.com/#!/abee2/status/146 … 24/photo/1
It requires some mods to convert it into blocks.
Offline
@abee - good find - very interesting what you can find under the hood
Simon
Offline
I've thought that actually I could get 80% of what I'd like by just having a midi reader program produce a text file like
Set Instrument to 1
Play Note 48 for 0.5 beats
Play Note 50 for 0.5 beats
Play Note 52 for 0.5 beats
Play Note 48 for 0.5 beats
etc
regards
Simon
Offline
SimpleScratch wrote:
I've thought that actually I could get 80% of what I'd like by just having a midi reader program produce a text file like
Set Instrument to 1
Play Note 48 for 0.5 beats
Play Note 50 for 0.5 beats
Play Note 52 for 0.5 beats
Play Note 48 for 0.5 beats
etc
regards
Simon
You'd still have to write the script yourself, though, wouldn't you?
Last edited by blob8108 (2011-12-15 08:41:14)
Offline
50% completed.
https://twitter.com/#!/abee2/status/147 … 80/photo/1
Offline
blob8108 wrote:
You'd still have to write the script yourself, though, wouldn't you?
![]()
Yes, but at least my pupils could just write them by hand.
My plan is to record short 1 or 2 bar repeating sections with a midi keyboard and then convert them into scratch loops so getting the instrument, note and duration would let me start my after school clubs
Simon
Offline
One way would be to make a parser within BYOB (Scratch would be too hard) that reads a string (generated by a "grown-up" language) and plays it in Scratch language. It would have to work something like this:
Get a string that looks like this:
P(1,A,2,B)G(1,R,2,B)
from a Java/C file.
Read it as: INSTRUMENT(DURATION,NOTE,DURATION,NOTE...)INSTRUMENT(DURATION,NOTE...)...
Parse into a list of lists of lists, with arrangement:
Each item in the "big" list is an instrumental track. Each instrumental track is a list of notes. Each note is a two-object list of a duration and a note.
Finally, you'll need to convert that into a list of scripts rather than instruments, then launch each script.
It'll probably take a while, but it'll simplify the "to Scratch" conversion to a "to String" conversion.
Offline
Done. Here it is.
http://squeakland.jp/abee/tmp/midi2script.zip
Use midi2script.image instead of Scratch,image.
Then choose "import midi file" menu in the script area, See midi2script.png.
There are some restrictions.
- cannot get instruments
- take a long time when import a big file
- tempo is not reliable
- etc.
Cheers.
Last edited by abee (2011-12-17 06:24:10)
Offline
@abbe - great effort :-)
Seems to work on the Frere Jacques but struggling to get it to work on others
I'll try more variations and see when it hits problems
But fantastic work !
Simon
Offline
I tried another simple 2 bar one I recorded so its probably good enough for the main job required
Simon
Offline
Almost 3 years ago, I converted the midi to lists that could be read by this scratch program.
Does that help?
Offline