Creating examples
This commit is contained in:
+16
-16
@@ -1,31 +1,31 @@
|
||||
# Specify analysis parameters for root mean square analysis.
|
||||
rms = {
|
||||
"window_size": 70,
|
||||
"overlap": 8,
|
||||
"window_size": 100,
|
||||
"overlap": 4,
|
||||
}
|
||||
|
||||
f0 = {
|
||||
"window_size": 2048,
|
||||
"overlap": 8,
|
||||
"ratio_threshold": 0.1
|
||||
"ratio_threshold": 0.4
|
||||
}
|
||||
|
||||
# Specify analysis parameters for variance analysis.
|
||||
variance = {
|
||||
"window_size": 70,
|
||||
"overlap": 8
|
||||
"window_size": 100,
|
||||
"overlap": 4
|
||||
}
|
||||
|
||||
# Specify analysis parameters for temporal kurtosis analysis.
|
||||
kurtosis = {
|
||||
"window_size": 70,
|
||||
"overlap": 8
|
||||
"window_size": 100,
|
||||
"overlap": 4
|
||||
}
|
||||
|
||||
# Specify analysis parameters for temporal skewness analysis.
|
||||
skewness = {
|
||||
"window_size": 70,
|
||||
"overlap": 8
|
||||
"window_size": 100,
|
||||
"overlap": 4
|
||||
}
|
||||
|
||||
# Specify analysis parameters for FFT analysis.
|
||||
@@ -48,7 +48,7 @@ matcher_weightings = {
|
||||
"spcflux" : 2.,
|
||||
"spccf" : 2.,
|
||||
"spcflatness": 3.,
|
||||
"zerox" : 0.,
|
||||
"zerox" : 1.,
|
||||
"rms" : 1,
|
||||
"peak": 2.,
|
||||
"centroid": 1.,
|
||||
@@ -88,11 +88,11 @@ analysis = {
|
||||
matcher = {
|
||||
# Force the re-matching of analyses
|
||||
"rematch": False,
|
||||
"grain_size": 70,
|
||||
"overlap": 8,
|
||||
"grain_size": 100,
|
||||
"overlap": 4,
|
||||
# Defines the number of matches to keep for synthesis. Note that this must
|
||||
# also be specified in the synthesis config
|
||||
"match_quantity": 20,
|
||||
"match_quantity": 10,
|
||||
# Choose the algorithm used to perform matching. kdtree is recommended for
|
||||
# larger datasets.
|
||||
"method": 'kdtree'
|
||||
@@ -109,14 +109,14 @@ synthesizer = {
|
||||
"enforce_f0": True,
|
||||
# Specify the ratio limit that is the grain can be modified by.
|
||||
"enf_f0_ratio_limit": 100.,
|
||||
"grain_size": 70,
|
||||
"overlap": 8,
|
||||
"grain_size": 100,
|
||||
"overlap": 4,
|
||||
# Normalize output, avoid clipping of final output by scaling the final
|
||||
# frames.
|
||||
"normalize" : True,
|
||||
# Defines the number of potential grains to choose from matches when
|
||||
# synthesizing output.
|
||||
"match_quantity": 20
|
||||
"match_quantity": 10
|
||||
}
|
||||
|
||||
output_file = {
|
||||
|
||||
+13
-12
@@ -426,15 +426,15 @@ class Matcher:
|
||||
analysis_formatting = self.analysis_dict[analysis]
|
||||
|
||||
target_data, s = target_entry.analysis_data_grains(target_times, analysis, format=analysis_formatting)
|
||||
target_data = target_data ** weightings[analysis]
|
||||
target_data **= weightings[analysis]
|
||||
all_target_analyses[i] = target_data
|
||||
|
||||
|
||||
# nan_columns = np.all(np.isnan(all_target_analyses), axis=0)
|
||||
# all_target_analyses[:, nan_columns] = 0.
|
||||
nan_columns = np.all(np.isnan(all_target_analyses), axis=0)
|
||||
all_target_analyses[:, nan_columns] = 0.
|
||||
# Impute values for Nans
|
||||
# all_target_analyses = imp.fit_transform(all_target_analyses)
|
||||
all_target_analyses[np.isnan(all_target_analyses)] = np.inf
|
||||
all_target_analyses = imp.fit_transform(all_target_analyses)
|
||||
# all_target_analyses[np.isnan(all_target_analyses)] = np.inf
|
||||
|
||||
for sind, source_entry in enumerate(self.source_db.analysed_audio):
|
||||
self.logger.info("K-d Tree Matching: {0} to {1}".format(source_entry.name, target_entry.name))
|
||||
@@ -450,16 +450,16 @@ class Matcher:
|
||||
analysis_formatting = self.analysis_dict[analysis]
|
||||
|
||||
source_data, s = source_entry.analysis_data_grains(source_times, analysis, format=analysis_formatting)
|
||||
source_data = source_data ** weightings[analysis]
|
||||
source_data **= weightings[analysis]
|
||||
all_source_analyses[i] = source_data
|
||||
|
||||
|
||||
# Impute values for Nans
|
||||
# nan_columns = np.all(np.isnan(all_source_analyses), axis=0)
|
||||
# all_source_analyses[:, nan_columns] = 0.
|
||||
# all_source_analyses = imp.fit_transform(all_source_analyses)
|
||||
nan_columns = np.all(np.isnan(all_source_analyses), axis=0)
|
||||
all_source_analyses[:, nan_columns] = 0.
|
||||
all_source_analyses = imp.fit_transform(all_source_analyses)
|
||||
|
||||
all_source_analyses[np.isnan(all_source_analyses)] = np.inf
|
||||
# all_source_analyses[np.isnan(all_source_analyses)] = np.inf
|
||||
|
||||
source_tree = spatial.cKDTree(all_source_analyses.T, leafsize=100)
|
||||
results_vals, results_inds = source_tree.query(all_target_analyses.T, k=self.match_quantity, p=2)
|
||||
@@ -736,8 +736,9 @@ class Matcher:
|
||||
)
|
||||
|
||||
if not np.all(np.any(x, axis=1)):
|
||||
pdb.set_trace()
|
||||
raise ValueError("Not all match indexes have a corresponding sample index. This shouldn't happen...")
|
||||
raise ValueError("Not all match indexes have a corresponding sample index. This shouldn't happen...\n"
|
||||
"Check that all database path arguments are correct then try re-running with the --rematch and --reanalyse flags.\n"
|
||||
"If this does'nt work, delete the audio and data directories in all databases and try again...")
|
||||
|
||||
x = x.reshape(mi_shape[0], mi_shape[1], x.shape[1])
|
||||
x = np.argmax(x, axis=2)
|
||||
|
||||
@@ -49,7 +49,7 @@ the fundamental period.
|
||||
|
||||
In order to improve the accuracy of peak detection, parabolic interpolation is
|
||||
used to estimate the peak's location with greater accuracy by using the peak
|
||||
correlation and it's two closes neighbour's values to estimate the fractional
|
||||
correlation and it's two closest neighbour's values to estimate the fractional
|
||||
peak value.
|
||||
|
||||
The method for parabolic interpolation is defined as:
|
||||
@@ -78,7 +78,7 @@ Fourier Transform for windows of a signal. The full description of this
|
||||
transform is outside the scope of this project, however it should be understood
|
||||
that this analysis provides a description of the spectral content of a windowed
|
||||
signal. By applying the transform, a number of bins of size :math:`K` are
|
||||
calculated that detail the sine and cosine apmlitudes required to reconstruct
|
||||
calculated that detail the sine and cosine amplitudes required to reconstruct
|
||||
the signal. The calculation of the STFT is defined as:
|
||||
|
||||
.. math::
|
||||
@@ -90,9 +90,9 @@ Ref: :cite:`lerch2012itaca`
|
||||
Harmonic Ratio
|
||||
~~~~~~~~~~~~~~
|
||||
The harmonic ratio can be used to differentiate between noisy and periodic
|
||||
signals. higher values suggest that the signal is more periodic (such as a sine
|
||||
signals. Higher values suggest that the signal is more periodic (such as a sine
|
||||
wave) and lower values represent less periodicity. This can be used as a form
|
||||
of confidence measure in determining the validity of F0 values. it is
|
||||
of confidence measure in determining the validity of F0 values. It is
|
||||
calculated as part of the F0 estimation algorithm as:
|
||||
|
||||
.. math::
|
||||
@@ -113,7 +113,7 @@ Ref: :cite:`lerch2012itaca`
|
||||
|
||||
Peak Amplitude
|
||||
~~~~~~~~~~~~~~
|
||||
Peak amplitude measures the highest peak in the absoulte signal. it is
|
||||
Peak amplitude measures the highest peak in the absolute signal. It is
|
||||
calculated as:
|
||||
|
||||
.. math::
|
||||
@@ -136,10 +136,10 @@ Ref: :cite:`lerch2012itaca`
|
||||
|
||||
Spectral Centroid
|
||||
~~~~~~~~~~~~~~~~~
|
||||
The spectral centroid measure the center of gravity accross frequency bins to
|
||||
determine the central point accross the spectral content of the frame. High
|
||||
value sindicate that the spectral content is centered in higher frequencies and
|
||||
lower value indicate a lower center. The spectral centroid is calculated as:
|
||||
The spectral centroid measure the centre of gravity across frequency bins to
|
||||
determine the central point across the spectral content of the frame. High
|
||||
values indicate that the spectral content is centred in higher frequencies and
|
||||
lower value indicate a lower centre. The spectral centroid is calculated as:
|
||||
|
||||
.. math::
|
||||
SC(n) = \frac{\sum_{k=0}^{K/2-1} k \cdot | X(k,n) | ^2}{\sum_{k=0}^{K/2-1} | X(k,n) | ^2}
|
||||
@@ -151,11 +151,11 @@ Ref: :cite:`lerch2012itaca`
|
||||
|
||||
Spectral Crest Factor
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
The spectral crest factor can be used as a mesure of tonalness of the signal.
|
||||
it is calculated by taking the maximum magnitude and dividing by the sum of
|
||||
The spectral crest factor can be used as a measure of tonalness of the signal.
|
||||
It is calculated by taking the maximum magnitude and dividing by the sum of
|
||||
magnitudes.
|
||||
This differntiates between flat spectrums and sinusoidal spectrums. (low values
|
||||
represnting the former and high values representing the latter.)
|
||||
This differentiates between flat spectrums and sinusoidal spectrums. (low values
|
||||
representing the former and high values representing the latter.)
|
||||
|
||||
.. math::
|
||||
SCF = \frac{ \max_{0 \leq k \leq K/2-1} \{| X(k,n) | \}}{\sum_{k=0}^{K/2-1} | X(k,n) | }
|
||||
@@ -180,7 +180,7 @@ Spectral Flux
|
||||
Spectral flux is a measure of change between consecutive frames. It calculates
|
||||
the average difference between frames to differentiate between adjacent frames
|
||||
that are largely dissimilar (suggesting a non-stationary section of signal) and
|
||||
similiar frames (that suggests a steady state signal). It is calculated as:
|
||||
similar frames (that suggests a steady state signal). It is calculated as:
|
||||
|
||||
.. math::
|
||||
SF(n) = \frac{\sqrt{\sum_{k=0}^{K/2-1} \Big( | X(k,n) | - | X(k,n-1) | \Big)^2
|
||||
@@ -213,8 +213,8 @@ Ref: :cite:`lerch2012itaca`
|
||||
Zero-Crossing
|
||||
~~~~~~~~~~~~~
|
||||
The zero-crossing rate counts the number of times a signal's value changes from
|
||||
positive to negative in a frame. it is relevant to determining the noisiness of
|
||||
a signal, as noisy signals will pass from positive to negative more frequenctly
|
||||
positive to negative in a frame. It is relevant to determining the noisiness of
|
||||
a signal, as noisy signals will pass from positive to negative more frequently
|
||||
than period signals. It is calculated as:
|
||||
|
||||
.. math::
|
||||
|
||||
@@ -3,6 +3,12 @@ rms = {
|
||||
"overlap": 16,
|
||||
}
|
||||
|
||||
f0 = {
|
||||
"window_size": 2048,
|
||||
"overlap": 8,
|
||||
"ratio_threshold": 0.0
|
||||
}
|
||||
|
||||
variance = {
|
||||
"window_size": 130,
|
||||
"overlap": 16
|
||||
|
||||
Reference in New Issue
Block a user