As of yet
no analysis has been done on the sound. Next Loris uses
a Channelizer class which creates a set of overlapping windows
"for signal analysis". The Channelizer matches
peak frequencies in subsequent windows and gives respective
matched frequencies the same label. After the channelizer
has made its pass on the sound file, Loris then uses a Distiller
to map breakpoints with matching labels into iterators of breakpoints
and placed in different partials. Then these partials
are clumped together in a list representing the entire sound
file. Loris dilates "short lived" signals, i.e.
noise, into longer partials - interpolating values in windows
where the respective partial does not resides.
For
our goals in this project this last feature was undesired.
So we created an algorithm in Python that runs after the above
processes and returns a list of Partials that we want.
Here's the code.
First
our algorithm goes and breaks up the partials into smaller segments
if need be. If a there is a large gap between breakpoints
then the partial is split between the two breakpoints.
After
the Partials have been broken up into smaller partials, noise
is now represented as "short lived" partials.
So our algorithm makes a pass through the list of partials and
puts the partials that have a lifetime longer than a given threshold
and adds them to an "inCrowd" list of partials; otherwise,
it adds the partial to the "outCrowd" list of partials.
After this pass, the algorithm then proceeds to check to see
if any of the partials in the "outCrowd" are close
of enough to any members of the "inCrowd" or their
harmonics. This approach allows us to keep harmonics of
a tone in melodious music (which is desirable.) Keeping
the harmonics of a tone keeps the "richness" of the
sound.
The
"closeness" of two partials is determined locally
with respect to the time period in which both partials are alive
(if there is no overlap then it assumed that the partials are
not close at all). The average frequency of both partials
in the given time period is then calculated and if the distance
between these average values is less than a defined threshold
then the partial in the "outCrowd" is now added to
the "inCrowd". After this pass is done we have
a list of partials that should have less noise in it.