Menu

Dolby C progress report.

2016-07-19
2018-05-05
  • Richard Evans

    Richard Evans - 2016-07-19

    Since it is taking a long time the write a Dolby C
    decoder I thaught I'd better write a progress report.

    I now have a Dolby C program, and I'm trying to get it
    to work properly. A few weeks ago, I finished most of the
    work in writing it. Testing it I found one channel was
    quiet and muffled, and there were some spikes in the
    output. (Nothing works 1st time).

    I fixed the problem of the spikes. Basically my system
    of finding the output value, by refining guesses,
    sometimes produced very extreme vaues for it's initial
    guess. This caused an arithmatic overflow, which messed
    up the rest of the processing. To fix this problem, I
    just simplified the inital guess, so that it wouldn't
    produce extreme values.

    As for the week muffled channel, I always suspected
    that this was to do with the fact that the test track I
    was using, was also a bit weak in one channel. But I
    thaught there was more to it than this.

    I tried converting the test track to mono, using one
    channel, and then the other. Sure enough, the weaker
    track always ended up a lot weaker. I then tried
    temporily by-passing the Low Level stage in my program
    and this made the problem go away. So I began to
    suspect my Low Level stage was working at the wrong
    level.

    So after quit a bit of expimenting, to find the
    difference in level, between the Low level Stage, and
    High Level Stage. I found it was a fair bit greater than
    I thaught. So I amended the levels in my program, and this
    helped a lot, but it didn't eliminate the problem.

    Next I thaught it would be helpful to decode the same
    track in a real Dolby cassette deck, at differen't levels
    to see if there was any similar behaviour. It did seem
    to do the same sort of thing when the level was too low.
    Although it was a bit hard to tell, because at low levels
    I was also getting a lot of noise.

    So I tried running my program using much higher Threshold
    levels. For this I had to disable the clipping stage on
    the output of the side paths. At about 40dB, which is
    rather high, the result sounded qute close to what it should
    be. Although the treble was quite poor, compared to the
    cassette deck, and I wasn't sure if there was any
    distortion.

    That is about as far as I've got so far.

    I'm thinking, the high Threshold level probably indicates
    that I've got my levels wrong. Howerver I'm starting to
    wonder if the 2 channes should be completely independant
    of each other. Perhaps for example, the gain contoll for
    the low level stage, might use a mono level. So I'll
    try some experimenting, to see if one channel has any
    effect on the other.

    The slight distortion might just be the poor sound on
    my Laptop. I'll try listening to the output files on my
    hifi, and if I do hear any distortion, then I will have
    to find out why.

    As for the poor treble. I noticed a quiet part of my
    test track sounded a lot better. To cut along story short,
    I'm thinking this may indicate that my Anti Saturation
    routine isn't correct. By altering it I could probably
    get more treble in the output, so I'll do some more
    experimenting to find out more accuratly what it should
    do.

    Well that is about it so far. Things are progressing but
    with probably a lot more to do.

     
  • Richard Evans

    Richard Evans - 2016-07-31

    A bit more progress.

    Fixing the fault with the ThresholdGin made some difference, but it still needs improving.

    Earlier today, I created some plots to help me see what needs fixing.
    I Found there was a bit too much noise reduction,
    The anti saturation didn't seem to be doing anything,
    And there was a fault that sometimes the amplitue is suddenly less.
    Perhaps that was why I sometimes thaught I head a little bit of distortion.

    The 1st problem was just a matter of calibration, I hadn't (until recently) got around to calibrating the program properly. I added a routines today to help me calibrate the program, and now I've calibrated properly, it seeme to work quite a bit better.

    That is as far as I've got so far.

    Next I think I need to find out why the amplitude seddenly drops. It may take some time to find this fault.

    Then I want to get the Anti-Saturation working.

    I also want to try another way of doing the Spectral Scew. This was one of the difficult bits. I had hoped to use an FIR filter, but I couldn't get it to decode. However I've recently find some instructions I want to try. Whether they will work is another matter.

    Also I'm considering adding a Balance parameter, to help deal with situations where one channel is louder than the other.

    Plus I will need to updatethe documentation.

     
  • Richard Evans

    Richard Evans - 2016-08-02

    Been debugging this for a while.
    I found the cottrol signal for the Anti-Saturation was not working properly,
    which explained both the problem of output levels suddenly changing,
    as well as why the AntiSat wasn't working.

    Well so far I have corrected two bugs withe the AntiSat control signal,
    however it's not working yet, the output is a bit of a mess at present,
    so more debugging to do.

    I'll try to attach a plot to show the current problem.

     
  • Richard Evans

    Richard Evans - 2016-08-03

    Some sucess.
    I will have to adjust the parameters, but I was expecting that.

    Still a few more thing I want to do before releasing it.
    1: I want to add some command line paramiters.
    2: I want to move some settings into the parameter file, so they can be adjusted more easily.
    3: Adjust the parameters.
    4: Test it on some real music.
    5: Write some documentation.

     
  • Richard Evans

    Richard Evans - 2016-08-07

    Had a few unexpected problems,
    but for the 1st time I've now decoded something with the results sounding pretty good :)

    My 1st problem was when I tried to adjust the Anti Saturation, my program just didn't seem to want to cooperate. I eventually realised that perhaps the control should be based on a Logarithmic scale, then it worked a lot better.

    Then I tried decoding some music, and it sounded horribly muffled. I soon realized I had made a mistake with the decode routine, which was adding AntiSat, instead of removing it. I changed this, and that made the program crash. Well I've just found out why it crashed, and discovered another Bug in the process. So I've corrected those, and now the decode sounds pretty good.

    So I'm now at the stage I thaugt I was at a few days ago.
    So I hope it will be routine from now on. I hope, but based on past experience, I'm not holding my breath just yet.

     
  • Richard Evans

    Richard Evans - 2016-08-07

    BTW.
    The decode is pretty slow.
    I have been thinking of a way it might work a lot faster.
    Whether or not this will work is something I won't know until I try.
    But for now it's just an idea, as I want to finish it as it is 1st.

     
  • Richard Evans

    Richard Evans - 2016-08-09

    Getting closer.

    I've moved the anti saturation settings into the rourtine that handles paramethers, that way I can expirement more with the settings (by writing a Parameter file)..

    I've added a few more options.
    And I spent some time trying to improve the SpectalScew. However this last part was a can of worms. But I've added a parameter to choose the method, so if in the future I fing a better method I can add it.

    I also just tried upsampling the audio 1st (using a free program called SOX). This means my program doesn't need to do the upsampling. This way took a lot longer, but doing it this way, the sound quatity was noticeably better. So when I write the documentatio, I'll include some instruction on how to do this.

    I think that all I need to do now is try to adjest the settings a bit.
    do some more testing, and write some documentation.

     
  • Richard Evans

    Richard Evans - 2016-08-31

    The issue I've been working on tor the last 2-3 weeks, is that Noise reduction reduced rather suddenly, as audio gets louder. It should reduce more gradually, which may be why I couldn't get a DolbyC decode to sound right.

    The amount of Noise reduction depends upon the resistance of the FET, and that depends on Vgs (the voltage difference between gate and source pins on the FET). I looked at how quickly the resistance changes with Vgs. It's similar to an exponential cure, but a lot steeper than I realised.

    Another issue was I use tables for all the resulting values for each value of Vgs. Because of the steepness of the curve, most of the change was happenening over just a few table positions. I changed the way the tables work, to fix this issue. This helped a little, but I still needed to fix the problem of the resistance changing suddenly.

    My 1st idea was to divide Vgs by a constant, so the resistance changed more gradually. That idea never worked properly, whatever I tried there was not nearly enough NR at 1KHz.

    Next I looked at the problem bit more carefully, and found that most of the change in NR, was on the steep part of the curve, but it was almost on the much more gentle part. So I thaught if I can shift it a bit further down the curve, that should fix the problem.

    My idea to do this was to multiply the resistance by a constant. This effectivly shifts everything upwards, and so the regon where NR changes, gets pushed to the flatter part of the curve. This fixed the problem, but caused another lesser problem.

    Multiplying up the resistance, also greatly increases the minimum resistance, so the minimum NR was not low enough. In the end I solved this by making the multiplyer variable. So It's now about 25 where the noise reduction changes a lot, but goes down to 0, as it gets towards to lowest resistance. Now I'm getting much smoother curvers, so it looks promosing, but I need to do more tests.

    But testing the program I've just found another problem Grrrr......
    For some reason, when the audio is loud, the high frequencies do not go to the maximum levels, it's as is they get clipped or something. This might be another reason why the output doesn't sound right. So before I do anything else, I need to find out why this is happening.

     
  • Mark Huessy

    Mark Huessy - 2018-05-05

    hi, just a note, to say that when you have the Dolby C code working, I'll worship the water you walk on. I'm facing < 1 tb of audio to process. Every so often, a file was digitized with errors -- a problem only because many of the cassette decks I use have electrolytic caps that are slowly dying = no accurate decoding.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.