Skip to Content

experimental MIDI import program available (perl script)

4 replies [Last post]
rvmindstep
Offline
Joined: 04/17/2010

Hi,

I've created a perl script that load a MIDI drum tracks and convert it as a hydrogen file. This is still experimental but it somehow does the job (i.e: I can load it, play it and export it as WAV, which is
what I needed).

This was tested on a linux machine, and relies in two external
cpan.org packages (see script comments).

Doing this program raised a few issues related to midi import:

- instrument mapping between GMidi and H2 is not necessarily trivial

- the pattern/note/score representation of H2 does not match well the nature of MIDI events (I sliced the whole thing in fixed length patterns). "intelligent" slicing in the hope of reusing similar/identical patterns is likely complex (anyone has an idea?)

- I never messed with MIDI before; I might have missed a few important things :)

- we would need to expose a lot of parameters to make this import flexible enough (instrument map, handling of some MIDI controls, etc)

Anyway, that's more a proof of concept than a definitive solution. It could be used as a base to implement the MIDI import feature within the main program.

Let me know if you've any suggestion or problem using this program.

Herve

-=-

PS: I still have a problem changing generated songs (which was not
my main goal). When I save the changes, I constantly get this error:

> hydrogen: src/lib/LocalFileMng.cpp:1213: void SongWriter::writeSong(Song*, std::string):
> Assertion `instr->m_pADSR' failed.
> Aborted (core dumped)

rvmindstep
Offline
Joined: 04/17/2010

The attached version contains a few fixes:

- hydrogen no longer crashes when loading a converted file
- deal with note collisions (notes occuring on the same instrument and the same time): the velocity is set to the highest value
- added --dump options, which show the song content details (converted MIDI events)

Herve

Asmantat
Offline
Joined: 04/17/2010

i'dont understand the english very well but i wouldlike thank for your job
bye

emisoundsmachine
Offline
Joined: 04/17/2010

Works just fine at the moment. Thank you Herve. :)

[i]Note to producers :[/i]

cpan XML::Simple [i]for missing library[/i]

Regards,
Emi

juliandola
Offline
Joined: 05/10/2013

oh yeah¡¡¡ good job...and where is the script???, i want to use¡¡¡ thank for your time¡¡¡