Re: Filtering out specific notes from MIDI files

From: Alexandre Ratchov <alex_at_caoua.org>
Date: Thu Dec 10 2009 - 09:11:54 CET
On Thu, Dec 10, 2009 at 03:27:29PM +0900, Stanis?aw Raczy?ski wrote:
> Here's what I have created after reading the whole manual (back and forth a
> couple of times) and the mailing list (assuming I want to filter out
> everything which is not MIDI note #69):
> 
> import "input.mid"
> sel 10000

Hi,

``sel [mend]'' should work with any file length, but i guess
you're safe with 10000 :)

> for trk in [tlist] { ct $trk; tevmap {note {} 0..68} {none}; }

``tevmap'' is to change events, you should probably use ``tclr''
which is to clears events (remove without changing time
structure).

ev {note {} 0..68}
for trk in [tlist] { ct $trk; tclr; }

> for trk in [tlist] { ct $trk; tevmap {note {} 70..127} {none}; }
> export "output.mid"
> 
> However, it does not work, telling me that I should:
> 
> use the same cmd for 'from' and 'to' args
> use the same cmd for 'from' and 'to' args
> use the same cmd for 'from' and 'to' args
> use the same cmd for 'from' and 'to' args
> use the same cmd for 'from' and 'to' args
> 

it complains because source and destination event command
are not the same (ie ``none'' != ``note'')

> which, frankly, doesn't help me to understand the problem.
> 
> The above code only seems to work if I am very precise about the events I
> want to filter and don't use the "none" events as well as any ranges. The
> following, for example, works:
> 
> import "input.mid"
> sel 10000
> for trk in [tlist] { ct $trk; tevmap {note {} 69} {note {} 68}; }
> export "output.mid"
> 

tevmap requires commands of events to be the same and the
source set to be as large as the destination set. (ex 0..68
-> 1..69 works, but 0..68 -> 1..2 doesn't).

-- Alexandre
Received on Thu, 10 Dec 2009 09:11:54 +0100

This archive was generated by hypermail 2.1.8 : Wed Nov 08 2017 - 16:32:21 CET