OpenMusic

Visual Programming | Computer-Assisted Composition

OpenMusic Reference

Prev| | Next


band-filter

band-filter

(lists module) -- Filters elements of a tree based on their numerical (arithmetic) value

Syntax

band-filter list bounds mode

Inputs

name data type(s) comments
list a tree the tree to filter
bounds a list of pairs of numbers must contain at least one pair of numbers, for example ((1 3))
mode menu two options: pass and reject. Defaults to ‘pass’

Output

output data type(s) comments
first a tree  

Description

band-filter passes or rejects all elements from list that fall within the specified values of bounds . Multiple bands of values can be specified in the form of additional pairs of numbers as sublists of bounds . Even if there is only one band, it must be given as a sublist of bounds , which must thus have two levels of parentheses. Each pair of numbers defines an interval.

If mode is set to pass , only elements within one of these intervals are passed. If mode is set to reject , elements falling within any one of these intervals are suppressed.

band-filter processes every element of list regardless of the level of nesting. Elements which are passed retain the level of nesting from the original list.


|Note If you are looking to filter ranges of elements in a list based on their position in the list rather than their value, use range-filter )| | ***

Examples

Filtering a range of values from a tree

Mode is set to pass , so only the elements in list in the intervals 0-3 and 8-10 will be passed:

? OM->(1 2 3 8 9 10)

Reversing the mode will cause only elements outside of those intervals to be passed:

? OM->(4 5 6 7)


Prev Home Next
atom Up bpf-sample