[PD] midifile ... in reverse

Frank Barknecht fbar at footils.org
Mon Nov 2 10:35:10 CET 2009


Hallo,
Claude Heiland-Allen hat gesagt: // Claude Heiland-Allen wrote:

> mark edward grimm wrote:
>> Is is possible to play a midifile in reverse 
>
> Sure, if you want each note-off message to happen before its  
> corresponding note-on messages!
>
> Actually doing it might be difficult though - MIDI files have  
> variable-length fields, so you probably have to decode *all* of it into  
> some other format or data structure before you start playing from the 
> end.

This actually isn't too hard if some external tools are allowed. In the
rj-library, the help file for [c_seqplay] contains an example how to convert a
midi file to a text file, that [qlist] can read (using Cyclon's [seq] instead
of [midifile]). Once you have the qlist-file, you can reverse it using for
example the "tac" command in Linux/OS-X - "tac" is the opposite of "cat". 

As qlist-files encode delta times or times between events, loading this
reversed file into qlist will make it play back the whole midi file backwards. 

As you noted, the notoffs then happen before the noteoffs, so some additional
tweaking may be wanted, either to the file format or to your Pd player logic.

Ciao
-- 
Frank




More information about the Pd-list mailing list