IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
Noise shaped dither in 8 bit audio, DAC choices?......
rogs
post Nov 23 2013, 13:48
Post #1





Group: Members
Posts: 9
Joined: 23-November 13
Member No.: 112486



I have a project that uses short 8 bit audio samples, stored on EPROM or Flash chips, which are then 'replayed' using simple CMOS binary counters and a simple 8 bit DAC (TLC7524), all triggered from a simple momentary switch command.

When using speech as an audio source, then the use of analogue companding each side of the digital process can improve the perceived quality of replay quite a lot, compared to listening to 'raw' (linear) 8 bit audio...and allows for reasonable results from simple (and cheap!) hardware.

Works fine for my purpose up until now. I now have a requirement to replay very short, but very dynamic samples (audio recordings of percussion sounds).
For this application, the attack and release time constants of the analogue 'companding' technique pose a real problem....

So I looked at using a high sampling rate, and shaped dither noise instead.

Starting with a 16 or 24 bit recording of the percussion (drum) sound at a high sampling rate (96KHz) I then used my audio editor (an old version of Cool Edit - Audition) to add shaped dither noise, and reduce the resolution to 8 bits.
Seems to work very well --- the improvement in the quantisation noise problems at low level is pretty impressive.......and the noise shaping shifts most of the dither noise above 15KHz.

But of course, simply taking this new 8 bit file, and storing the data on Flash or EPROM to replay using a simple 8 bit linear DAC doesn't work. The newly introduced 'shaped' noise simply gets 'replayed' as broad band noise at the level of the introduced dither amplitude (at about -24dB). Totally unusable.


What I can't get my head round is which part of my the 16 or 24 bit PC soundcard DAC is being used to replay the file so much more accurately. Replayed from the PC soundcard, the dither noise virtually disappears (apparently, of course!)

My reference 'silence' half level is 80 .. which of course is totally silent - even to a simple 8 bit linear DAC!).
I'm guessing that the smallest negative change of 1 binary count to 7F, which causes the MSB to change from 1 to 0 is probably the culprit, so I probably need a much more accurate DAC to retain the accuracy of the shaped dither noise........and if so, what DAC can I use that can read an 8 bit parallel data input.... and which 8 bits do I choose to use, from a higher resolution DAC....

Unless I'm missing the point completely here?......

Any pointers gratefully received...... smile.gif

Go to the top of the page
+Quote Post
Kees de Visser
post Nov 23 2013, 14:53
Post #2





Group: Members
Posts: 678
Joined: 22-May 05
From: France
Member No.: 22220



What is the playback sampling rate ?

Is the TLC7524 DAC suitable for audio ?

This post has been edited by Kees de Visser: Nov 23 2013, 15:04
Go to the top of the page
+Quote Post
rogs
post Nov 23 2013, 18:50
Post #3





Group: Members
Posts: 9
Joined: 23-November 13
Member No.: 112486



Thanks for replying...

Playback sampling rate is 96KHz......and no, the TLC7524 is not really a special audio device.....it's just a simple linear 8 bit R2R ladder DAC...
It works fine for larger amplitude signals. It just falls apart a bit, trying to resolve the dither noise masking of the lower amplitude signals

I can see that I shall probably need a more specialised higher resolution audio DAC... my question is what type, and which part of the data inputs do I select for replaying an 8 bit data word, while retaining the benefits of the noise shaped dither .......

As I say, the file replays fine using my PC soundcard - which uses a 24 bit DAC - but which 8 bits are they using to retain the accuracy that allows the dither noise to work effectively......or are there extra processes involved?......
Go to the top of the page
+Quote Post
lvqcl
post Nov 23 2013, 19:22
Post #4





Group: Developer
Posts: 3384
Joined: 2-December 07
Member No.: 49183



From http://www.ti.com/lit/ds/symlink/tlc7524.pdf

QUOTE
Linearity error: 0.5 LSB


Probably too high nonlinearity?
Go to the top of the page
+Quote Post
saratoga
post Nov 23 2013, 19:41
Post #5





Group: Members
Posts: 4972
Joined: 2-September 02
Member No.: 3264



Measure the thd and imd of your DAC. If its highly nonlinear noise shaping will work poorly.
Go to the top of the page
+Quote Post
rogs
post Nov 23 2013, 19:55
Post #6





Group: Members
Posts: 9
Joined: 23-November 13
Member No.: 112486



Thanks for the comments guys -- I think I've realised that I'm going to need a better DAC, my question is really --
which one, and which 8 bits to use from, say, a 16 bit parallel input DAC , to maintain the advantages of adding the dither noise?..
Go to the top of the page
+Quote Post
saratoga
post Nov 23 2013, 20:52
Post #7





Group: Members
Posts: 4972
Joined: 2-September 02
Member No.: 3264



Audio DACs are quite cheap, but will probably expect to be driven via a microcontroller with I2C, I2S, USB, or some other interface which it sounds like you don't have access to. Maybe check with TI and see if they have a higher end model of the TLC7524? You basically just want something with either more bits, or less nonlinearity. This is easy enough to make, but its just less common to have higher quality outputs on devices so simple they lack a CPU.
Go to the top of the page
+Quote Post
rogs
post Nov 23 2013, 22:51
Post #8





Group: Members
Posts: 9
Joined: 23-November 13
Member No.: 112486



QUOTE (saratoga @ Nov 23 2013, 19:52) *
Audio DACs are quite cheap, but will probably expect to be driven via a microcontroller with I2C, I2S, USB, or some other interface which it sounds like you don't have access to. Maybe check with TI and see if they have a higher end model of the TLC7524? You basically just want something with either more bits, or less nonlinearity. This is easy enough to make, but its just less common to have higher quality outputs on devices so simple they lack a CPU.


Thanks for your advice.... this is intended to be a very simple, cheap project. As you say, no microcontrollers!
I now realise just how important the DAC linearity is for effective noise shaping. I was just a little surprised about just how yes/ no the results were.
An 8 bit file played back via my PC soundcard -- noise shaping is very effective.

The same 8 bit file played back using a (not very linear) external DAC -- noise shaping becomes unusable (the dither noise is reproduced as broad band white noise at an unacceptably high level.

I might find a little improvement operating the DAC in current mode, but I'm pretty sure the difference would be minimal.

Moving up to a 12 bit parallel input DAC - like the LTC1450 for example - and using the 8 LSBs of that device might make some improvement, but I suspect not enough.

Time for one more look at improving the analogue 'companding' option -- or failing that, moving the whole project up a gear, which, sadly, will almost certainly kill it off.
No budget for development involving SMD devices, and an ever dwindling number of DIP version of chips being available mean that, like so many electronic hobby projects, it's is now simply cheaper and easier to go and buy a commercial equivalent!

Thanks for all your input guys..... most grateful.

Go to the top of the page
+Quote Post
saratoga
post Nov 24 2013, 04:04
Post #9





Group: Members
Posts: 4972
Joined: 2-September 02
Member No.: 3264



QUOTE (rogs @ Nov 23 2013, 17:51) *
I now realise just how important the DAC linearity is for effective noise shaping. I was just a little surprised about just how yes/ no the results were.
An 8 bit file played back via my PC soundcard -- noise shaping is very effective.


Yes, if there is much nonlinearity, you get intermodulation, where some of the noise downmixes other noise to lower frequencies.

Go to the top of the page
+Quote Post
knutinh
post Nov 25 2013, 08:46
Post #10





Group: Members
Posts: 569
Joined: 1-November 06
Member No.: 37047



Can you measure the nonlinearity of the DAC? Perhaps it it possible to pre-compensate the input signal?

-k
Go to the top of the page
+Quote Post
pdq
post Nov 25 2013, 13:46
Post #11





Group: Members
Posts: 3407
Joined: 1-September 05
From: SE Pennsylvania
Member No.: 24233



QUOTE (rogs @ Nov 23 2013, 16:51) *
Moving up to a 12 bit parallel input DAC - like the LTC1450 for example - and using the 8 LSBs of that device might make some improvement, but I suspect not enough.

As long as you use the 8 LSBs of any DAC you will probably see no improvement. What you want is the 8 MSBs.
Go to the top of the page
+Quote Post
rogs
post Nov 25 2013, 19:19
Post #12





Group: Members
Posts: 9
Joined: 23-November 13
Member No.: 112486



Thank you for the additional comments.... I had automatically assumed that the lower 8 LSBs would offer smaller step changes, and therefore less noise, so thanks for that correction.

It would appear that the majority of the extra 'non linear' noise comes in my present experiment, as expected , from the the transition from 7F to 80 -- (i.e. the transition to the MSB going from 0 to 1 )

This was verified by shifting a 1 bit noise sample negative by 1%, to ensure that the MSB threshold was not exceeded. Greatly improved results.

Not viable of course -- simply shifts the MSB change 'up the scale' by 1 bit, so to speak, so the 'nasty' threshold is crossed in a slightly different area..

I was wondering whether changing the output from a voltage mode to a differential current mode might maintain a more 'linear' MSB transition, if the currents are maintained as always being equal, regardless of any code change?
Yet to experiment on that one...

As I mentioned, I do appreciate that this is really chasing rainbows, and that technology has moved on from using such crude DACs for audio. But I do still enjoy experimenting..... it's just getting more difficult to be able to do that, without getting involved with either microcontrollers, or SMD --or both!

And the latter gets expensive, with PCBS required just for a 'fun' project experiment.

In this case, it would probably be cheaper to go and buy something like an Alesis 'Sample Pad' at about 100....

.... Sort of feels a bit like throwing in the towel though.....

One more look at improving the analogue audio 'companding' option, I think.... that does actually work quite well .. especially on speech...

Thanks again for your comments and interest --- in what must seem a pretty pointless exercise to real audiophiles smile.gif

This post has been edited by rogs: Nov 25 2013, 19:20
Go to the top of the page
+Quote Post
rogs
post Dec 2 2013, 22:01
Post #13





Group: Members
Posts: 9
Joined: 23-November 13
Member No.: 112486



QUOTE (saratoga @ Nov 23 2013, 19:52) *
Audio DACs are quite cheap, but will probably expect to be driven via a microcontroller with I2C, I2S, USB, or some other interface which it sounds like you don't have access to.

Thinking a bit more about your comment here made me wonder.... even if a modern audio DAC expects to be driven by a microcontroller, maybe it would be possible to configure one without using one... especially for a simple function like this?

Looking at the data sheet for the Wolfson WM8524 suggests that it may be possible (it has a hardware configuration mode)...and it is cheap!....

It would mean applying few unorthodox 'tweaks' to things, but it does look as if less than 2 (3$) worth of parts might help gain the benefit of noise shaped dither noise, when added to an 8 bit audio signal.

Audio recorded and prepared as a 16 bit .wav file would then need to be down-sampled and saved in a signed 8 bit format (8 bit normal .wav files are of course unsigned), as I'd need a 2s complement (signed) input format for the DAC.
That would automatically strip the wav header, and the raw signed 8 bit data stored in my 8 bit flash could then be serialised, using a cheap shift register like the 74HC165.
That would give me serial 8 bit 2's complement data as input for the DAC. The unused LSBs from the 16 or 24 bit DAC input format would be ignored by the DAC, according to the data sheet.

It might work!..... I still need to decide whether I2S or left or right justified is the best format for this configuration, and also hope that the DAC will function at a much lower clock speed during initial experiments (with much reduced quality of course!) to give me a chance to prove the concept before having to do a PCB layout that can cope with a high speed clock.

If it does work, I'll have got myself a reasonably priced hardware digital audio player for no more expense than adding analogue 'companding' components to my existing system!

Unless of course I've missed something vital here?.......and I know I still have to work on the clock sequence timing details......but it might be a bit of fun to try.......

Thanks for giving me the idea!..... smile.gif


Go to the top of the page
+Quote Post
saratoga
post Dec 2 2013, 23:00
Post #14





Group: Members
Posts: 4972
Joined: 2-September 02
Member No.: 3264



That might work actually. You'll need a few Mhz oscillator, but provided you keep the traces very short that is doable.
Go to the top of the page
+Quote Post
rogs
post Dec 15 2013, 19:15
Post #15





Group: Members
Posts: 9
Joined: 23-November 13
Member No.: 112486



Further to your comments above, I've been looking at this a little more. I had hoped to have built something by now, but it keeps getting pushed back by more pressing matters --( I think I may need to reassess some priorities! smile.gif )

The most obvious solution to keep things simple would seem to be to use a Wolfson WM8762, in conjunction with a 74HC165 shift register, to convert my 8 bit parallel audio data to a left justified serial format for that DAC.
And then control the whole thing using several 74HC4040 counters, driven from a 12.288MHz oscillator.

What I can't quite figure out is whether I can use the DAC in an 8 bit mode, which seems possible if the phrase on page 10 of the data sheet is correct (there's a copy here: http://www.wolfsonmicro.com/documents/uplo...s/en/WM8762.pdf ):

" The word length maybe any value up to 24 bits ".......Unfortunately, that follows immediately on from the phrase " the WM8762 supports word lengths of 16-24 bits"

I'm guessing they might mean any length between 16 and 24 --- but they don't actually say that?..and the drawing simply shows 'n' bits....
If I am obliged to use a minimum of 16 bits, then I'm not sure quite how to deal with the unused 8 LSBs in each word? They would presumably all be the same as the last output from the shift register, whether that is either 0 or 1.
Not sure quite what the implication of that are?...

I think I shall probably just try it all out and see what happens, and if I can use 8 bit word lengths, and stick to a specified MCLK and LRC clock ratio (probably 128fs) then that would be the easier option.

The data sheet does seem a bit ambiguous though........unless of course I've just missed something fundamental in the timing concept (entirely possible smile.gif )
Go to the top of the page
+Quote Post
pdq
post Dec 15 2013, 23:33
Post #16





Group: Members
Posts: 3407
Joined: 1-September 05
From: SE Pennsylvania
Member No.: 24233



Just clock your shift register 16 times. The last 8 bits will be whatever you are inputting on its serial input, such as zeros.
Go to the top of the page
+Quote Post
rogs
post Dec 16 2013, 14:38
Post #17





Group: Members
Posts: 9
Joined: 23-November 13
Member No.: 112486



QUOTE (pdq @ Dec 15 2013, 22:33) *
Just clock your shift register 16 times. The last 8 bits will be whatever you are inputting on its serial input, such as zeros.


Thanks for that --as I'm importing my data via the parallel inputs, I hadn't realised that the serial input would be functional after the initial 8 bits had been shifted.... that should help keep things simple!

I have also asked Wolfson if I need a minimum of a 16 bit input, and they confirm that is the case, so hopefully I can now complete my prototype.

Thanks again for the advice.....
Go to the top of the page
+Quote Post
AstralStorm
post Feb 12 2014, 06:05
Post #18





Group: Members
Posts: 745
Joined: 22-April 03
From: /dev/null
Member No.: 6130



Heck, you can build your own R2R DAC from precision resistors combined with an opamp. It will be large though, but for 8 bits, should be sufficient.
The tricky part is getting good resistors.

This post has been edited by AstralStorm: Feb 12 2014, 06:06


--------------------
ruxvilti'a
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 22nd September 2014 - 21:33