Thursday, 19 February 2015

8/10/14 - THD - Part 2



As I mentioned in the previous blog post, THD measurement allows us to see the response of a nonlinear system to a spectrally pure sine wave.
This means we can quantify, in the frequency domain how linear a system is in one dimension. This is also the flaw of THD. As we will see in later distortion analysis, the effect of distortion on a complex signal is far more variable and complex than that of a sine wave.
Below is an fft graph of a 1kHz sine wave, being clipped at a ratio of 1:2 i.e. the output of the system at the sine to (if the system was linear in response) would be a single tone at 1kHz of 0.5.

As we can see, there is harmonic content distributed at multiples of the fundamental frequency. The magnitude of the fundamental is reduced, but is still greater than the 0.5 intended limit. This is due to the fact that this is a graphical representation of the magnitude of frequency components, of a signal which has been analysed using a Fourier transform. Such is the companies between frequency domain analysis of changes that are made in the time domain. If we did a correlation between the distorted and non-distorted vector, we would be presented with a coefficient of 0.9739, which means that the change in values within the vector for a signal of roughly 23% THD, presents a 0.9739 similarity to the non-distorted signal.  
If you have ever heard something with 23% THD present, you will know that it doesn’t sound 97% similar to the non-distorted version, anecdotally. So where does this leave us? We cannot use THD to analyse complex signals, because there is inherent interaction between the frequency content a complex signal and the components caused by the nonlinear behaviour. Another angle which is not looked at In this view is the effect of phase on the signal. We need a way of looking at the effect of a nonlinear device on more than one frequency component.
We can also see that the first harmonic is dominant in this signal, and far out-weighs the energy of the following components of the signal. However, this relationship may change depending on the nonlinearity. An example of this is taking the square of the signal. This pitch-shifts the output signal, as can be seen below. Not that no other frequency components occur, and the amplitude is limited to 0.5.

It is possible to modify a nonlinear behaviour to give a pattern which is far less predictable that those shown previously, as can be seen below. This came from using the nonlinear expression (2.5*atan(0.9*x)+2.5*sqrt(1-(0.9*x).^2)-2.5) - x;
Performed on the sinewave vector x.
This is the result:



As it happens, this behaviour sounds more like a bitcrusher, where some of the other behaviours sounded rough and distorted in a more regular or recognisable pattern.

I WILL LATER ADD SOME REFERENCES TO LOOK AT

I have found a number of papers discussing methods of looking at THD in the time domain, but nothing that is either well written or seems to work.
There is another method for analysing the effect of a nonlinear device on a signal. This is Intermodulation, which I will discuss in the next post.

In the next week I am to look at ways of comparing distorted and clean signals.

Tuesday, 17 February 2015

Distortion and THD 1 – 1/10/2-14

THD 1 – 1/10/2-14

Distortion

Distortion is characterised in the Master Handbook of Acoustics (Everest & Shaw), as ‘any change in the waveform or harmonic content of an original signal, as it passes through a device. The result of nonlinearity within a device’.
This distortion not only includes having a variable input/output relationship with the signal, but may also modify the basic content of the signal.
One example of the behavioural characteristics of this nonlinearity may be the change of harmonic content within the signal with respect to the frequency domain.  There are two predominant measures of this which I will discuss briefly in the coming posts; Total Harmonic Distortion and Intermodulation Distortion. These are two methods which have been used since the 1940s, to characterise the effect a device has on a signal. There is a big catch to both of these methods, which I will also discuss.

Total Harmonic Distortion

Total harmonic distortion (THD) is the measure of a system response and viewed in the frequency domain, when the system is given an input of a spectrally pure sine wave at a given frequency (often 1kHz).
The total energy of the output (in the frequency domain) is measured, and compared with the level of the excitation tone. This relationship is characterised as a percentage, and known as the percentage of total harmonic distortion.
The benefits of this method of nonlinear behaviour characterisation, is that you can clearly see (graphically and numerically) the effect a device has on a signal. The down side is that this method by definition only works with a spectrally pure signal, and in modern measurement systems the noise floor of the system must also be taken into account. Pure sine tones do not accurately represent the complex and highly variable signals presented as music, and therefor do not relate to what realistically occurs when a system distorts musical signals. Furthermore, links to the perception of distortion of pure tones may not relate to the perception of the distortion of complex tones.
For more information: see Temme 1992 – Audio Distortion Measurements – a Brual and Kjaer text on methods of measuring distortion.
Shmilovits 2005 characterises THD in his paper ‘On the definition of Total Harmonic distortion and its effect on measurement interpretation’ as either a comparison to a signals RMS, or its harmonic content and advocates the latter. As such, I will be using this method in the analysis on the effect of the nonlinear devices.
In the following blog post, I will give an example of a total harmonic distortion measurement, and compare what is measured with a complex signal and a spectrally pure signal.

 

In the coming week I plan to try and find a method of using THD measurement to characterise the distortion effect of a device on complex music.
I will also look for supporting literature.

I have found a number of papers on the perception of distortion, but none specifically looking at the links to loudness perception. Generally most work is done on quality.


Thursday, 22 January 2015

AS things currently stand

I have finished the version 3 listening test which is now in full beta.
I am going to publish in on Github, links to follow.
Currently writing report, just finished stuff on THD, now doing other distortion measures.

I am going to rewrite a few new logbook posts, which more accurately represents THD and IMD.

I am also going to talk about the test development timeline, and Rnonlin, which i have started looking at.

I have also been looking at papers talking the perception of loudness and distortion in relation to dynamic range.

I am finding that masking may be a particularly significant part of the way we experience distortion.

Monday, 12 January 2015

The final listening test format

After much too-ing and frow-ing and re-evaluation, the final listening test interface is ready.
The listening test format is a double-blind compare and capture i.e. a listener will compare two versions of the same track for loudness, and will set the volume for one version.

This will be done for 10 tracks, some of which are the same.
The tracks will vary in genre, because loudness perception is reportedly so genre dependent.
Although, I believe the dependence is really in the data (tracks) and not in their associated labels.
The distorted tracks will be the ones that listeners change the level of.

Each track will last 30 seconds, and be of the same sampling rate.
This is to keep even comparison and quality in the measurements later on, and to keep the listening windows short so more accurate comparisons in level can be drawn.

Each track will be peak normalized to -10dBFS.
This is to make 'like' comparisons, and reduce any extra distorted caused by DSP due to numbers going beyond the registers size.

The order of tracks will be randomised, to ensure that its not possible to cheat the test by asking someone else what levels they set.

The track volume for the distorted version, will be offset by 0.5, and then modulated with a 0 - 1 slider. This should an an appropriate amount of level variety available to the listeners, without adding too great a range.

The listeners name, age and listening experience will be recorded, as well as the levels set for each track.

There will be another test format, which uses one track.This track will be modulated 4 times using 4 different NLDs. The slider will be present to change the envelope, and the listener will aim for the loudest and clearest response. The point in time and NLD modulation coefficient will be recorded for each listener.


Monday, 5 January 2015

How LUFS works.

Please see the LUFS related document in the attached folder. 
The program is very close to working now!




More lit review, and starting to think about Rnonlin as a perceptual method of measuring distortion.

Tuesday, 9 December 2014

Making the listening test

After giving it some thought, I am going to normalize all the clean signals to -10LUFS and run the listening test at 80dbA as suggested in ITU-R BS 1770 -3

I will then have listeners change the level of a distorted file, to be the same.

This is a similar format to what the ITU did when testing LUFS for multichannel comparability.

It will also mean data can be compared fairly.

If we and LUFS are correct, the listeners should choose a level where the LUFS of the distorted signal is negligible to that of the audio signal.
A less distorted signal will be boosted more and a more distorted signal will be boosted less.

There is good evidence that LUFS is good stuff, when looking at :

The Effect of Dynamic Range Compression on Loudness and Quality Perception in Relation to Crest Factor

This not only suggests that LUFS is pretty accurate, but that a change in crest factor using dynamic range compression will effect loudness perception

Therefore, we can compare level coefficients to correlation, THD, crest factor, harmonic content, dynamic range and LUFS.


Even if the listener boosts the level of the distorted signal beyond the level of the clean signal, this will show that there is an effect on perceived loudness. 


I am going to wittle down the levels of the clipper to reduce the THD caused to a 1kHz sine wave to roughly 0 - 20% THD. This is because beyond this level, the distortion is very audible and I want to minimize the subjective effects of distortion on results. 20% THD is audible enough as it is. A further study could look at those levels of THD. Other studies previously referenced have proven that distortion becomes audible beyond 15% THD, when compared with the effects of clipping on a pure tone.

This will also allow me to slip the signals through other nonlinearities which function with frequency, and see how the different harmonic patterns compare.

I need to learn how to make waterfall plots for these signals. Maybe spectrographs will have to do?


Anyway.

Thursday, 4 December 2014

Nonlinear dynamics


https://www.youtube.com/watch?v=Y0u3o9_BRVQ

Anyway, it has been a little while (i think) since I updated this blog.

Stuff is moving along well. The listening test is due for a slight modification.

Next up I am going to apply the LUFS measurement algorithm in matlab, and use it to process the loudness of all audio files used, to ensure a solid LUFS level.

I will then standardise the listening conditions to a particular LUFS measure using a dumy head and the listening test rig, to ensure everything is the same. I can then increase the LUFS on the test rig to test different loudness effects on the effects of DISTORTION on perceived loudness.

I cannot directly link only THD to perceived loudness in musical signals, so I am just going mainly for a distortion characteristic now,

Also, I will evaluate crest factor and other bits with the data I accrue to get a more accurate picture of the systems involved.

Finally I will perform some cross-correlation analysis on audio that has been passed through nonlinear devices, to give a number to amounts of distortion, even if it isn't a traditional distortion metric. I am also modifying the listening test to get relative loudness measures between a clean and distortion version of a signal, so we can find what the level change is for perceptual level difference.

Good stuff.

It is just a shame that I have no listening test data yet.
I am also thinking about simplifying the listening test, to make it less prone to error.