Artifact testing
A series of tests have been performed on the sonification algorithms in order to explore
the artifacts present. These are outlined in IPython notebooks, which core testing code contained
in ./Tests_Artifacts/baseMethods.py
Note
Audio examples are used in the notebooks, in order to listen to these you will need to reload and run all cells first, as jupiter doesn’t save the audio in the notebook file.
Each algorithm was tested first on sine waves and harmonics. Subsequent testing was performed on frequency sweeps, frequency sweeps combined with harmonics and frequency sweeps combined with gaussian white noise. Sonifying the results of these test was found to be particularly helpful in quickly identify the type and severity of distortions.
Overall, testing indicated the complete insuitability of WSOLA for situations involving frequency sweeps, particularly when noise was introduced.
The other three algorithm performed better. Below is a comparison of the
audio for wavelets, phase vocoder and paulstretch for a x16 stretching of a frequency sweep with
gaussian white noise added. (NOISE_MAGNITUDE = 2, ie. the noise was scaled to have a standard
deviation twice the magnitude of the frequency sweep)
Expected audio (prediction):
Actual audio - Wavelet stretch:
Actual audio - Phase vocoder stretch:
Actual audio - Paulstretch:
Install
The artifact tests are located in ./Tests_Artifacts, not in the main package. Clone the github
repository in order to run them locally. You will need to have jupiter notebook installed.
Base Methods Module
A set of functions used to construct artifact tests from idealised signals and render the output of the tests
- baseMethods.PSD(dataSet: magSonify.DataSet_1D.DataSet_1D) numpy.array
Compute the PSD of a data set
- baseMethods.PSD_freqs(dataSet: magSonify.DataSet_1D.DataSet_1D, sampleRate=44100) numpy.array
Compute the corresponding frequencies for the PSD of a data set
- baseMethods.compare_Harmonic(algorithm, freqs, stretch)
Computes the expeted and actual time stretch on a harmonic with the given algorithm
See also:
baseMethods.getAfterAlgorithm()
- baseMethods.compare_Sine(algorithm, freq, stretch)
Computes the expeted and actual time stretch on a sine wave with the given algorithm
See also:
baseMethods.getAfterAlgorithm()
- baseMethods.getAfterAlgorithm(before: magSonify.DataSet_1D.DataSet_1D, stretch, algorithm)
Process data series with the given time stretch algorithm
- Parameters
algorithm – Can be ‘waveletStretch’, ‘paulStretch’, ‘phaseVocoderStretch’ or ‘wsolaStretch’
- baseMethods.getAfterPaustretch(before: magSonify.DataSet_1D.DataSet_1D, stretch)
- baseMethods.getBeforeAndExpectation_Harmonic(freqs, duration_seconds, stretch=16)
Get generated data sets for a simulated harmonic, before and after a time stretch
- baseMethods.getBeforeAndExpectation_Sine(freq, duration_seconds, stretch=16)
Get generated data sets for a simulated sine wave, before and after a time stretch
- baseMethods.getBeforeAndExpectation_Sweep(startingFreq, finalFreq, duration_seconds, stretch=16, method='logarithmic')
Get generated data sets for a simulated frequency sweep, before and after a time stretch
- baseMethods.normalisePSD(psd)
Normalise a PSD so that its highest peak has a magnitude of 1
- baseMethods.plotPSD(expectation, after, showPlot=True)
Plots the PSD of the provided pair of data sets
- baseMethods.plotPSD_Harmonic(algorithm, freqs, stretch, showPlot=True)
See also:
baseMethods.compare_Harmonic()
- baseMethods.plotPSD_Sine(algorithm, freq, stretch, showPlot=True)
See also:
baseMethods.compare_Sine()
- baseMethods.plotPSDpaulstretchHarmonic(freqs, stretch, showPlot=True)
- baseMethods.plotPSDpaulstretchSine(freq, stretch, showPlot=True)
- baseMethods.reducePlotResolution(frequencies, PSD, n=1000)
Reduce PSD resolution to allow plotting with matplotlib. Smooths the PSD.
- Returns
( reducedFreq: np.array, reducedPSD: np.array )