"Custom" Sawtooth signal in ADAU1452?

Hi guys,

So basically I'm trying to make a sawtooth signal in sigma studio, recreating something like this (the x-axis values are accurate and it is indeed the values I wanted, but please ignore the y-axis values as what I need is actually for it to go from 0 to 1):

I noticed that the foundation of this signal is an inverted sawtooth, that has some zeros on it and that allows the orange and blue signal to be overlapping with each other, with the orange signal is simply the delayed version of the blue one. Not knowing how to modify the sawtooth block, I tried to sweep a 15-row LUT with a counter block, like this:

with the LUT being 1 to 0.9 to 0.8 and finally reaching 0s at the end. I am having difficulties in terms of getting them in my required timings (first picture). I observed the results through an oscilloscope and they looked like this:

but the resolution is pretty bad (my hunch is a 15-row LUT is not enough to make a smooth graph), and as I increase the rows, the timings also change. I am wondering if there is an elegant way to do this? Thank you!!

-Levi



(EDIT: the units of the x-axis values on the first picture is ms)
[edited by: Levi at 9:22 AM (GMT -4) on 7 May 2021]
Parents
  • +1
    •  Super User 
    on May 8, 2021 2:19 AM

         Hello Levi,

         Actually your LUT solution is quite elegant, it amounts to an arbitrary waveform generator.  Its outputs are well-defined and easily changed via the contents of the LUTs. By contrast,  I tend to think of "analog" ways to do things in SigmaStudio -- thus came up with an integrator (an adder which feeds back to itself) with ABCD comparators to provide the timing.  The project produces waveforms like those in your first picture -- with its horizontal axis I had unfortunately assumed to be in seconds.  At this scale, the waveforms' period is about 80 mS  (12.5 Hz). The project's output appears below:

         With the horizontal axis in mS instead of seconds, the desired waveforms' period changes to 80 uS, with a corresponding rep rate of 12.5 kHz.  A 48K sample rate yields only about 4 samples per cycle -- not enough to define the desired waveforms.  Another way of saying this is that the 12.5 kHz ramps include harmonics beyond the Nyquist frequency of fs/2.

          Even if you run the DSP at 192 K, the result still won't look very good.  My eval board only works at 48K, yet we can simulate the quality of the 12.5 kHz ramps at 192K by running 3.13 kHz ramps at 48K.  Here's the results:

           

         Note how each sharp upward transition is surrounded by ripples before and after.  My guess is these arise from the DAC's reconstruction filter, which could be an oversampled windowed-sinc FIR -- not unlike the "sin(x) / x interpolation" found in digital scopes.  Anyhow, I attached the project should you wish to have a look at it.  You can change the ramps' frequency by adjusting the "increment" value -- the integrators' per-sample ramping.

         Best regards,

         Bob

    1452-Ramps.zip

  • Hi KJBob,

    This is amazing! I guess your approach on making it analog-ey worked better in terms of adjusting the parameters.

    And about the horizontal axis being ms or s, I just realized that my required specification does not need a frequency that is that fast. I am currently attempting to implement this pretty promising pitch shifting algorithm I found on Matlab. Running the mentioned Matlab app to my desired pitch shift value (+12 semitones) showed me a graph that is pretty much achievable with that schematic of yours.

    This left me wondering about the available pitch shifting block in the Sigma Studio. What kind of algorithm is being used there? Reading the old comments on this website about that, the tech supports here considered that block to be not quite enough for basic shifting such as karaoke apps. The link I put above includes samples with human voice and it worked pretty well, that is why I am very curious about implementing those.

    I will let you know how my project worked out. And thank you again KJBob!

    Sincerely,

    Levi

Reply
  • Hi KJBob,

    This is amazing! I guess your approach on making it analog-ey worked better in terms of adjusting the parameters.

    And about the horizontal axis being ms or s, I just realized that my required specification does not need a frequency that is that fast. I am currently attempting to implement this pretty promising pitch shifting algorithm I found on Matlab. Running the mentioned Matlab app to my desired pitch shift value (+12 semitones) showed me a graph that is pretty much achievable with that schematic of yours.

    This left me wondering about the available pitch shifting block in the Sigma Studio. What kind of algorithm is being used there? Reading the old comments on this website about that, the tech supports here considered that block to be not quite enough for basic shifting such as karaoke apps. The link I put above includes samples with human voice and it worked pretty well, that is why I am very curious about implementing those.

    I will let you know how my project worked out. And thank you again KJBob!

    Sincerely,

    Levi

Children
No Data