ΣSigmaStudio Ask AI Русский Log in

How to initialize adau variables ?

SigmaDSP & SigmaStudio drugoimir Sep 9, 2016 00:00 4 replies Original on forum ↗
Subscribe
drugoimir Question
Sep 9, 2016 00:00

Hi,

i've a recursive filter used as a smoother, and i need to preset its N-1 input to some value at startup.

I can do this using timers or other stuff to give the requested value to the feedback element on startup,

but i want to know if there is any simpler method to do this.

Many thanks

Tom

KJBob Reply
Sep 12, 2016 00:00

Hello Tom,

Since no one has responded, perhaps there isn't a highly desirable solution (like initializing the variables directly). Of all the "other stuff" methods I could think of, the one shown below uses the least instructions:

One sample after startup, the delay allows a 1 through to switch the ABCD Comparator inserted where desired in your filter. It uses fewer instructions than an index mux. In this example the initial condition is applied to the whole filter, not just the one feedback term as it made the results show up in the Real-Time Display.

Best regards,

Bob

8182.95dbbb19c8165954c6816b11af0fd261.png
8182.95dbbb19c8165954c6816b11af0fd261.png
8182.95dbbb19c8165954c6816b11af0fd261.png-529x348.png
8182.95dbbb19c8165954c6816b11af0fd261.png-529x348.png
drugoimir Reply
Sep 13, 2016 00:00

Hello Bob (the great),

many thanks for your answer. I'd already solved that in my way:

But i was curious if there was any 'zero instructions' solution.

You said that having variables initialized at some value it is not a desirable solution, but i think it is not a strange need, because, expecially on very slow processes (not just audio filters) i can choose to start from a 'some value' instead of zero.

Just like some .init section on the GCC compiler.

I can suggest this as a new feature to be inserted in the new SigmaStudio release.

Many thanks again.

Bye

Tom

2251.6d17e53baa0c86dfa5acef61b4ac8b48.png
2251.6d17e53baa0c86dfa5acef61b4ac8b48.png
2251.6d17e53baa0c86dfa5acef61b4ac8b48.png-541x410.png
2251.6d17e53baa0c86dfa5acef61b4ac8b48.png-541x410.png
KJBob Reply
Sep 13, 2016 00:00

Hi Tom,

Thanks for your kind words & for sharing an alternative method. It would be good for SigmaStudio to directly initialize variables where needed. I'm not certain which of the SigmaDSP chips can support this feature-- for example, in the -1701 there's no way to write to data memory via I2C / SPI, thus I don't know whether something SigmaStudio puts in the code could copy a parameter to the appropriate variable at startup. It's definitely a good question for the SigmaDSP team at ADI to consider.

Best regards,

Bob

DaveThib Reply
Sep 30, 2016 00:00

Hello Tom,

Please fill me in if I am missing something but it is just the previous sample that will be zero when starting up correct? Then that zero will propagate through the filter and eventually the filter will settle. How long does this take? Why not either mute the audio for that period of time or start with a volume control all the way down and use a long slew to have it ramp up slowly. Then by that time the filter would have settled and you should not hear the thump or click?

Dave T