I’m trying to think of a design for a kind of zero-crossing instrument, which detects when a recorded a-rate signal crosses its horizontal axis or 0 point. Each time that happens, I need an oscillator to switch value from 1 to 0 (or 0 to 1, if already at 1).
To achieve this, I was thinking of using the rms opcode to track input signal amplitude, and have some sort of conditional block with a built-in flagging system to get the output signal to switch when the rms value is at or close to 0; however, I would theoretically need to track at a-rate, and that doesn’t seem possible with rms.
Another design idea was to write the signal to an f-table and ‘find’ the 0 (or close to 0) values through table lookup, then apply those results to my output signal (i.e. get it to switch if a 0 or close to 0 value is detected).
Has anyone attempted this before, and if so, any advice or suggestions? Perhaps I’m missing the barn door in front of me, and there’s a brutally simple way of doing it…
Hi Mark. Can you not write a UDO with setksmps 1 that will check each sample, and output a 0/1 each time a sample values changes from plus to minus? Or am i over simplifying this?
I’m sure it’s been attempted before, but not by me I’m afraid!
I’m also interested in zero-crossing because I plan to detect external trigger. I have been waiting for Expert Sleepers ES-9 over months!
You might be interested in schmitt trigger for stable zero-crossing detection. It is available as sound-plugin. https://csound-plugins.github.io/csound-plugins/opcodes/schmitt.html