Saturday, 29 November 2014

Update

A newer version of the listening test has been completed.
This takes the 7 samples at different levels of clipped distortion (known THD% conditions for 1kHz sine), and allows users to listen and choose preference.
The paper of the day is 'The Correlation Between Distortion Audibility
and Listener Preference in Headphones' by 'Temme et al', which basically showed that there is no direct link between distortion audibility and listener preference in headphones. It also warranted that more studies on a perceptual basis need to be undertaken, and thus my paper will be obsolete by the time those occur I expect.
It does give the go-ahead to set up the generic test pattern for data sets that I had planned, because there is not a defined standard set of parameters out there as yet. Although the ITU-R 1770-2 method for setting headphone loudness should be considered to make a fair test.
'The hawksford paper' doesn't reference a measurement standard for the listening tests, which make a good comparison hard to do, in relation to their method.
Two more things. Both backup ideals for test measurements.
1: randomly generate some waves with frequency x, and get listeners to pick which nld sounds loudest, and which one sounds clearest.

Thursday, 13 November 2014

Minor Brainwave

The problem with my originally proposed method may have been convolving with a sine wave that does not have a DC offset? Because of 0s...

Idea

Maybe this is total nonsense...
What if I found the THD% of a nonlinear device for a bin of frequencies...
I then convolved that behaviour with the Frequency domain version of some music.
I would then have a signal with a known average thd% per f bin.

I can then add and remove that harmonic content as a function of a slider, and know the THD%av. The thing to remember is that, if I add x much energy over the frequency response at that frequency, and then reduce that by half, that is still a known amount of energy added. Der Untergang is the IMD and other artifacts possibly caused by adding this content. That said, an amount of energy + an amount of energy is still that given amount, in this instance. I would no longer be applying the NLD to the signal, just its effects and thus I may avoid some of the other effects of the NLD on a boradband basis.

EDIT: Reality check


Some of the fundamental properties of signals.

So a signal may have multiple channels, but each channel will effectively be just a set of number values through time (in matlab). This change of numbers will infer spectral content throughout a time period, but will in effect just be an intensity value at any single point. in time.

Continuous Time & Discrete Time

In continuous time, this would mean that THD should only be there for the response time of the device in the instance of an impulse, and by extension the THD pattern will change with continuous time. This does not have to imply IMD, as the distortion characteristic (DC) of the device should imply the DC output with signal instantaneously (assuming it is a memoryless device such as those that I am using). The problem may become more apparent, when taking time variant devices into account such as capacitors and inductors.

So if you chop the signal into small packets of time, the same must be true?
This is why the signal must be processed in the time domain. If you did it in the frequency domain it wouldn't work.

If you were really clever, you would find a way to separate out the THD effects over time, and see the difference, sample to sample. There must be a way to take an NLD, and simply get a numerical output for the distortion value, without the music? Because you loose frequency information when you look at small segments of the time domain.

Here is a concept for you

Is it not possible to comprehend that the difference in sample time, may allow for time variable devices to correct themselves, if you placed a small enough get in-between audio samples. The gap would have to be pretty small, or in a digital amplifier.

After a couple days to think on it, I think that a THD% study using music will not work.
Why?
Because signals with multiple frequencies at once, in

How very convoluted

So the next step in the process I have deemed, is to find a way to quantify the THD of an audio signal. As it turns out, this is a hard thing to do. I have been trying to do this quite a lot.

In fact, a lot of the papers I have referenced so far (mostly in the proposal) are based on this particular point. The reality is, the original question is in itself questionable.

THD% is a way of measuring distortion. By definition, distortion and complex signals cause more distortion i.e. inter-modulation, and various other properties of non linearity.

The question shouldn't really be 'does total harmonic distortion have an effect on perceived loudness', but more likely 'does amplifier/loudspeaker distortion have an effect of perceived loudness'. These are not the easiest things to determine in some cases, but it would be a much tidier question all in all.

I have most recently been trying to use a home-brewed method to calculate the THD of a music signal. Convolving a 1kHz sine wave with the distortion characteristic of the music which has been processed with a nonlinear device. The problem I am having is that a 1kHz sine is spectraly sparse, and most of the distortion seems to occur in a wide band at high frequency.

Key papers at this time are:
Measurement and Perception on Nonlinear Distortion - Comparing Numbers and Sound Quality
- Alex Voishvillo
Testing Challenges in Personal Computer Audio Systems
- Wayne Jones et al.
Nonlinear Distortion Measurement in Audio Amplifiers: The Perceptual Nonlinear Distortion Response
-Phillip Minnick
Auralization of Signal Distortion in Audio Systems Part 1: Generic Modeling
-Wolfgang Klippel
Non-linear Convolution: A New Approach for the Auralization of Distorting Systems
- Angelo Farina

One of the biggest problems I am currently having, is that if I re-analyse a pre-distorted and analysed sinewave, I get a different value to what I can clearly see on the graphing of the function.


So it is time to step back, look at the question and make a decision.
Do I forge ahead and stick with THD as the metric for distortion measurement, or do I go freeform? I think the NLDs cause IMD and all other kinds of goodies for analysis, and convolution is going to become a big part of getting real answers from the complex program material. In the mean time I am going to see if I get start to get my understanding correct in relation to 2 sinewaves, some impulses and some noise.

I must also look towards perceptual models, in case analytical ones do not work out.

Monday, 10 November 2014

Listening Test Beta version

The aim for this weekend, was to get a listening test software beta together.
A deliverable for John, to show that I can deliver. 

Take into account that before this project, I had never touched Matlab.
Well, once I did, using a program Adam had made, I entered data and it spit out a polar plot.
But really nothing of any use relating to this project.

Last night I completed this first working beta version on my listening test software. 
There are still some things to change i.e. how it exports test data and biasing the sliders to the middle. Otherwise, it is just a bit slow and clunky. This is because every time you move a slider, it recalculates the mix of tracks, adds them and normalises them before playing from the same sample. Initial listens show some very strange, interesting and unpredicted results. As such, I need the software to be reviewed by someone who actually understands how Matlab works to a good level. 

My advances have been great in a very short space of time, but there is still a mountain to go!

So here the is format of the listening test as far:

The listener has to go through 7 genres of music, listening to each track at least twice. The listener for each track, is to move the appropriate slider, one to find the best sound, and once to find the loudest sound for each genre. The listener is also to put in their sex and age, and save the answers between each genre. I haven't finished how saving and exporting data works yet. For this, I need Adam or Bruce.

It has been a learning curve, the last 24 hours. But here it is.
I aim to optimise it better, change the save behaviour, and make it much prettier. But it is a deliverable beta, put together in roughly 10 hours.

I am pretty chuffed.
The data recorded is fully quantitative, in that numerical values between 0 and 1 are chose, by listeners who don't know what they are listening to i.e. without deception by still blind.

The next step from a data perspective, is to polish up the sample choice, and look at the crest factor of each sample at given times in the sample. Then once listening test data is back, determine the difference in crest factor for the highest and lowest populated data points. 

I think it is in fact the effect on crest-factor as I originally thought, that determines perceived loudness in these basic listening tests. I believe that greater THD makes lower mid and bottom end more perceptible, by masking the top end clarity of the music. I believe that this perceived extension in bass is what clubbers want, and you can hear it in the sample variations when listening to a 2.1 speaker system. I haven't tried headphones yet. I think the next step is more tests with the better quality samples, and multiple NLDS.

Really, testing needs to happen with people whose ears have gone into 'protect mode', with the 3piece system seizing up a little. Unfortunately, there is no way the ethics police will allow that. So I may need to look into modelling that mathematically. I will also need access to whatever the military has on this behaviour.

My aim by the end of the week is to have beta V2 together, and to have done a reasonably hardcore literature review on crest factor and the ears internal protection system. 

Woop! 
Below is a link to the folder including the Matlab embed of my beta.



In the folder above, the first test interface is here.


Thursday, 6 November 2014

Houston, we have a mild breakthrough

I have started to develop the listening test interface.
It involves using a home built user interface, and functions written in Matlab.

The function works using 'audio player' objects, and does an iteration of the code every time a slider is moved. The problem is editing large audio files makes the program slow and clunky.

Listeners will compare two versions of a bunch of tracks, and decide how much distorted track they like in the mix.

I have borrowed an MBox 2 from the university, and have bought a new set of headphones for these tests.

Tuesday, 4 November 2014

Getting the % effect and what percentages I am aiming for

It came to me in a dream...



Remove the original audio from the induced distortion, normalize to a percentage of the level of the original audio signal and add the distortion to the original signal again.

Well, this was mild nonsense. It wouldn't have fixed the THD% calculation for music, because there is already spectral content outside of the fundamental. Therefor, the calculation cannot work for music in the iteration I am using for this project. This was something Adam and I spoke about in the first place.

The new plan (which was really the old plan before the tangent), is to modify quantities in the nonlinear equations, to give a distortion % to the 1kHz sine tone that everyone uses (normalized to 1). Then apply that filter to the audio samples and the different percentages and have some samples for testing.


These will be ready by tomorrow (with luck). After speaking with Adam, I have decided to vito the rectifying NLDs because they aren't similar to a normally working device in saturation. Although, interestingly, squaring the wave pitch shifts it if it is a sine wave. The behavior to other wave types is even more interesting. I would love to start looking at distortion characteristics in deeper detail for post-grad.

Back to the scheduled program.

To decide what percentages of THD are worth exploring, I fist looked at the Geddes & Lee paper 'Auditory Perception of Nonlinear Distortion', which discussed a new method for measuring the perception of distortion (THD, IMD, ETC) in listening tests. This was all good, but I wanted to see what else had been done before I commit to that method. I looked through 'Nonlinear Distortion Measurement in Audio Amplifiers: The Perceptual Nonlinear Distortion Response' by Phil Minnick, which pointed me towards the Voishvillo paper 'Measurements and perception of nonlinear distortion - comparing numbers and sound quality'; which . There was also 'a new method for measuring distortion using a multitone stimulus and non-coherence' by Temme and Brunet.
Got that?



Finally, I came to the paper 'Measurement of Harmonic Distortion Audibility Using a Simplified Psycho-acoustic Model - Updated' by Temme, Brunet and Qarabaqi. This paper suggested that distortions that THD% samples between 0 and 9 had a lower standard deviation of subjective grading, where as at 10%, the deviation of this grading became much wider. These ratings were from 1 - 5, good to terrible. At 1-% some ratings jumped up from below 2.5 to above and up to 3.4. This is in line with a number of other papers, which suggest that THD becomes more perceptible above 10%.


As such I will use samples at THD%s in steps of 0.5% between 0% to 20%, and then steps of 10% up to 80%. This is because above the threshold conscious of perception of distortion, the listener will know they are hearing a strongly distorted signal (as proposed in the results of the paper mentioned above), and therefor the accuracy of the effect may be less.

The order of test signals in listening tests will be randomized, to fit in with the methods I will discuss in the next post. "I got it rapped like a mummy", Dr Dre.

From the hawksford paper, I am going to focus on the Cubic/SQS NLDs, as they may follow the behavior of saturated amplifiers/loudspeakers more readily.