This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Varying Audio DAC (TLV320DAC32) or any Other?) MCLK over a wide range - 4:1 frequency.

Other Parts Discussed in Thread: TLV320DAC32, PCM5121, PCM5141, PCM5142

Hi, I am using a TLV320DAC32 with an external MCLK input and I want to continuously vary MCLK  on the fly while it its playing audio over a wide range e.g. a 4:1 frequency range to achieve artificial Doppler Shift of the audio signal. The DAC is in I2S Master mode.  I can vary MCLK over a narrow range, but not nearly up by 2 or down by half. I am using an external clock synthesizer chip to generate MCLK.

Does TI make any audio DACs that can do this?.

I just discovered your newer PCM5121/PCM5141 DACS. Could they do this? Thanks.

Regards,
David Harrison
Model Sounds Inc.
www.modelsoundsinc.com

  • Hi, David,

    Sorry we missed your question. 

    Since this is not a run of the mill question, let me chat with a few blokes and get back with you.

    -d2

    PS you seem to be the #1 fan of our power amps! Thanks!!!!

  • Hello David,

    This is a little out of my realm, but your application sounds similar to the Vari-Speed function we've seen on some DJ mixers. (where the outputs can be "sped up" or "slowed down" by the DJ to make the music mix).

    In those applications, I suggest you run the DAC as a complete slave and have external dividers handle your bit clock and LRCK generation. In your final design, you may find that you can rely on the dividers internal to the part.

    You'll also need to disable any clock error detection. I believe the PCM512x can do this in one of the registers. On many modern DAC's like the PCM51xx, there's an integrated oscillator that's constantly checking if something weird happened to the clocks coming in. In your case, this is a deliberate thing! :)

    Keep us updated with your findings - this is an interesting challenge you have!

    Thanks again

    Dafydd Roche

    PS Are you generating tones, then playing with Doppler effects? You may be able to use PCM5142 to generate these tones and apply doppler effects, without having to mess about with clocks. Food for thought. that's all! :)

  • Dafydd Roche said:

    Hello David,

    This is a little out of my realm, but your application sounds similar to the Vari-Speed function we've seen on some DJ mixers. (where the outputs can be "sped up" or "slowed down" by the DJ to make the music mix).

    In those applications, I suggest you run the DAC as a complete slave and have external dividers handle your bit clock and LRCK generation. In your final design, you may find that you can rely on the dividers internal to the part.

    You'll also need to disable any clock error detection. I believe the PCM512x can do this in one of the registers. On many modern DAC's like the PCM51xx, there's an integrated oscillator that's constantly checking if something weird happened to the clocks coming in. In your case, this is a deliberate thing! :)

    Keep us updated with your findings - this is an interesting challenge you have!

    Thanks again

    Dafydd Roche

    PS Are you generating tones, then playing with Doppler effects? You may be able to use PCM5142 to generate these tones and apply doppler effects, without having to mess about with clocks. Food for thought. that's all! :)

    Hi Dafydd, thanks for your suggestions. This is a cost senstitive application so I don't want to use external divider chips if I don't need to. The reason I'm using the DAC in master mode is because the PIC32 uc I am using can't generate the required frequencies.

    No I am not generating tones, I am playing back audio from a micro-SD card.  The audio is engine sounds for a R/C model airplane. The artifical Doppler shift would be controlled by a GPS receiver that tells the uc how fast it is going, its direction and whether it is approaching or receding from the pilot on the ground. This makes the model plane sound as though it is going much faster than it really is - neat eh!

  • Hi David,

    U can also use signal processing to your help. U can explore multiple options. One is that u over sample your sound and store the samples in sd card. e.g. 4 times over sample. So when u play it at that speed via ur pic32 it will generate normal sound. Then play the same by keeping the clock the same but skip one sample. This is 1/2 the rate of previous and a simple example of decimation. U can also use interpolation to get mid way samples and generate other than 2 multiples / divisions.

    Let me know if u need more help on this. I will suggest a text on multirate dsp. Ideally interpolation will save u on space but will require filtering, a special filter call Fractional Delay filter.

  • Jawwad Hafeez said:

    Hi David,

    U can also use signal processing to your help. U can explore multiple options. One is that u over sample your sound and store the samples in sd card. e.g. 4 times over sample. So when u play it at that speed via ur pic32 it will generate normal sound. Then play the same by keeping the clock the same but skip one sample. This is 1/2 the rate of previous and a simple example of decimation. U can also use interpolation to get mid way samples and generate other than 2 multiples / divisions.

    Let me know if u need more help on this. I will suggest a text on multirate dsp. Ideally interpolation will save u on space but will require filtering, a special filter call Fractional Delay filter.

    Thanks, I'd already thought about that but had temporarily dimsissed it as too complex as I don't have any experience with digital filters and DSP. I was looking for an easy and fast way out. But I might revisit the idea at some point if I don't have any luck with varying DAC clocks. What is the text on mutlirate DSP that you were referring to?

     

  • Hi

    Decimation in multiples of 2 is very easy. What I suggest is that u simply change your software loop where u write to the DAC on a sample by sample basis. I assume that the samples are available in an array. So u use alternate index to increase the pitch to twice. Here is some sample / psuedo code. U can experiment with 2 and 4, these are 2^x type multiples. For i+=4 u will get a pitch 4 times the actual sample pitch. U can use a mix and match of DAC clk and decimation.

    for(i=0;i<SIZE_LIMIT;i+=2){

      WriteDAC(Sound[i]);

      delay(usec);

    }

    for text on this, I would suggest Digital Signal Processing by . I can get u some good literature on this.

    I will not suggest Interpolation for the time being that will require Interpolation Filter, normally Sync Interpolation is used. If required I will send u some Matlab code that I wrote some years back.

    But I would suggest that as a quick experiment and to get the feel of it just decimate by 2 and 4 and hear what u get. If u do that on your existing samples u will get pitch x 2 and pitch x 4 but with degraded quality. Get the feel of it then filtering the output of decimation with a low pass digital filter is not difficult.

  • Hi, again. Actually our playback code is more complex, using DMA to transfer blocks of audio samples to the DAC for left/right channels without CPU intervention. But it should be possisble to build the blocks using skipped samples. I understand the principles for integer 2 sample decimation, but am wary of interpolation. I will look into the text reference you suggested.

  • Hi David,

    from a hardware perspective, the DAC32 will scale the sample rate as you vary MCLK. So, if you reduce MCLK, the sample rate should reduce proportionally. The only constraints should be the max MCLK freq of 50 MHz. You can go as low as 500 kHz. As long as MCLK stays in that region, you should be ok. If this is not working, we would need to look at the schematics and register settings to see if something else is going on.

  • After further tesing, it seems I can achieve what I want after all using the TLV320DAC32 in master mode. When I use an initial sample rate of 44100, I can vary MCLK such that the effective sample rate varies infinitely between 22050 and 110000. But if I start out with an initial sample rate of 22050, I can go down to 11025 but after a few seconds it loses its mind and puts out white noise. Which is good news as I have a huge library of sound files at 44100 which I can use without downsampling first.