Using an external codec and DUEHiFi lib to get audio input

Hello!
I am working on a project to implement a guitar pedal. The project is succesful but i have a lot of noise from the DUE ADCs, as they are 12 bit and they intoduce a lot of quantization error.
I store the guitar input , quantized from the ADC into this array:
uint16_t sDelayBuffer0[40000];

As the ADCs are bad, i am considering using an external audio codec. Fellow forum member ard_newbie introduced me to this library:

As i have never again worked with audio codecs, my question is.... With this library and an audio codec (16 bit, for memory issues) can i get the digitized values of my guitar and stored into the same uint16_t array?

So i can then apply the effects and send them either to the DUE's DACs or the codec's DACs (my DACs work fine and don't introduce any noise - i checked with a simple sinewave generator program)

but i have a lot of noise from the DUE ADCs, as they are 12 bit and they intoduce a lot of quantization error.

I'd be surprised if that was the problem... I understand you wanting 16-bits (or better) 12-bits isn't that bad... I'd guess that regular guitar noise (hum, etc.) would be worse than 12-bits of quantization noise...

I don't know of an easy way to make a 12-bit test-file but I can tell you how to get 12-bits of resolution -

  1. Open any known-good audio file in [u]Audacity[/u].

  2. Run the Amplify effect and set the New Peak Amplitude to -24dB.*

  3. Export to 16-bit WAV. **

  4. Re-open the file and run Amplify again and accept the default to bring the gain back up. (Now, you've got a full-volume file with 12-bits of resolution.)

  • Each bit gives you 6dB. At -24dB, the 4 most-significant bits are zero.

** It's important that you save (export). Audacity uses floating-point internally and you won't loose any resolution until you save to an integer format.

I store the guitar input , quantized from the ADC into this array:
uint16_t sDelayBuffer0[40000];

So that is 80000 bytes. Are you sure that fits into the available SRAM memory?
96 KB of SRAM (two banks: 64 KB and 32 K
Are the banks contiguous? Or maybe the compiler is smarter than I thought.

Yep! My code works! Its just that it very noisy.
I want to use a 16 bit codec to feed data to my array.
Thats why i am asking info on how to do this.

I know 16 bit means a much bigger size of the array, but i just want to do it at first. Then i will think of something, maybe external RAM

This library is not well documented... For example, it lacks wiring instructions. Also, how periodically do i have to talk with the codec to consistently get data?
For a subject like getting a data stream from an audio codec, i am surprised the lack of projects that do this, given how many years tha arduino exists

The project is succesful but i have a lot of noise from the DUE ADCs, as they are 12 bit and they intoduce a lot of quantization error.

No, I have used the Due ADC and it does not introduce what you say. Unless you are a hi-fi buff then the quality is quite good. It is difficult to here quantisation noise at 12 bits. What you might be getting is clipping that is much more likely, or aliasing if your input filtering is not too good.

Ok. Take a look at this thread please.

The noise is common not just for me, but for every member of this community.
Did you convert audio with the DUE?

Did you convert audio with the DUE?

Yes.

The noise is common not just for me, but for every member of this community.

I don't see any reference to quantisation noise here. Only talk of power supplies.

You do know the output range on the DAC outputs is limited in range 1/6 to 5/6 of Vcc, so 0.55 - 2.75V,

The DAC works fine! I can verify it because i have a sinewave generator program that works great!

Hey Grumpy_Mike.
Another person on that forum wrote that 12 bit ADCs work fine for audio conversion.. It's just that the DUE ADCs are not good for that!

You can check it out yourself on the link i posted previously!

If that it the case, then that's great because i thought that i needed at least 16 bits ADC for audio.

You said that you have gotten away with DUEs ADC for audio with good performance. Is your code public? If yes, could you share so i run your setup to see if it works good standalone?

It is not the code it is the hardware and the environment it is in. Linear regulators plenty of decoupling, no PWMed LEDs, good layout.

There is an LED to the circuit! Do you think this messes with my sound quality?
Why do you think noise exists in my project?
Do you happen to have a schematic for your audio sampling project? Describing the things you mentioned earlier?

BTW, here is a schematic of the circuit i use:

There is an LED to the circuit! Do you think this messes with my sound quality?

Is it being driven by PWM? If not no.

Why do you think noise exists in my project?

The problem of mixing digital and analogue circuits together.

Do you happen to have a schematic for your audio sampling project? Describing the things you mentioned earlier?

No sorry.

BTW, here is a schematic of the circuit i use:

You have absolutely no decoupling in those circuits.

Hello Grumpy_Mike!
I want to thank you very much because you have given back hope to me in a project that i thought was lost!
If noise was due to the ADCs then was project was ruined. I hope it's just due to decoupling issue.

I didn't post here for a while. I read as much as i could.

The ADCs in my deisgn are provided by two TL072 ICs.
I also have a TC1044 IC in my design.

I read the schematics and consulted electronic forums.
(BTW here are the schematics if you want them
http://www.ti.com/lit/ds/symlink/tl074b.pdf (THIS ON PAGE 32 MENTIONS DECOUPLING STUFF)
http://ww1.microchip.com/downloads/en/DeviceDoc/21348a.pdf
)

Anyway to sum up everything i leanred in one picture. Is this ok?
Is this what proper decoupling for this circuit is?

(The reds in the image is what i added)

Thank you so much my friend!

EDIT: I don't know why the image is not visible. Here is the link Imgur: The magic of the Internet

Or rather look the updated version of my theoretical design:

Imgur

I am sceptical though.. If it was a decoupling issue and not an issue caused by the DACs, then why the sinewave generator example (which does NOT use the ADCs obviously) is heard perfectly, without any noise whatsoever? Man, i really hope this is the issue and i fix it fast!