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

Creating a boolean generator from a square wave source?

SigmaDSP & SigmaStudio audiolab1 Apr 23, 2012 00:00 3 replies Original on forum ↗
Subscribe
audiolab1 Question
Apr 23, 2012 00:00

I have an interesting problem that I have not been able to solve.

What I have is an audio signal path within an ADAU1701 which is split into two lines, each lines having different conditioning, and the output signal is then selected between these two paths with an index selectable multiplexer. What I would like to do is have the selection between the two branches toggle at a constant rate, i.e. Path one is output for "x" seconds and path 2 is output for "x" seconds. My thought was to take an internal square wave oscillator block and somehow condition the signal so that when the square wave is positive a boolean "1" is output and when it is negative a boolean "0" is output. I could then connect this signal to the control port of the mux and it would switch between the two signal lines at whatever frequency the square wave generator is set to. Unfortunately, none of my attempts so far have worked. Any suggestions would be appreciated!

Audio Signal Processors

SigmaDSP Audio Processors

adau1701

ADIApproved Reply
Apr 23, 2012 00:00

Hi audiolab,

The boolean logic in SigmaStudio is in 28.0 format, whereas the square wave is in 5.23, so you have to convert. The easiest way to do this is by using an AB in, CD out cell. I attached an example. If the 5 Hz sine signal is greater than zero, then the output of the logic cell is one (in 28.0 format), and the mux picks input channel 0. If the sine tone is less than zero, then the output of the logic cell is zero (in 28.0 format), and the mux picks input channel 1.

46bb8512dacc5a1798973234146d75f6.jpg
46bb8512dacc5a1798973234146d75f6.jpg
46bb8512dacc5a1798973234146d75f6.jpg-374x327.jpg
46bb8512dacc5a1798973234146d75f6.jpg-374x327.jpg
audiolab1 Reply
Jan 17, 2013 00:00

Hi Brett,

I have had a block similar to the above working in another project for some time now. For a new project I am looking at toggling back and forth between three values with a three-input index selectable mux. I have a "common" line, which we can assume corresponds to the mux input selected by decimal value 1. At a rate determined by the frequency of the square wave generator, I want to repetitively switch the mux inputs back and forth in the following manner:

1-0-1-2-1-0-1-2-1-0...

I have tried to get a decimal generator working in this manner using logic blocks, but have not had any luck.

Any suggestions?

Thanks!

ADIApproved Reply
Jan 17, 2013 00:00

audiolab1, how about using these cells to do the job?

Pulse generator

Toggle counter

Index lookup table

Index selectable multiplexer

You can hook them up like this:

Note that the table values are 1,0,1,2 as you requested.

I haven't had a chance to test this on the hardware, but I think it should work in your application.

7d03624389d79fa49ece52eceee46d3e.jpg
7d03624389d79fa49ece52eceee46d3e.jpg
7d03624389d79fa49ece52eceee46d3e.jpg-229x52.jpg
7d03624389d79fa49ece52eceee46d3e.jpg-229x52.jpg
b2072836efec0c8c731b09977bf645b5.jpg
b2072836efec0c8c731b09977bf645b5.jpg
b2072836efec0c8c731b09977bf645b5.jpg-450x222.jpg
b2072836efec0c8c731b09977bf645b5.jpg-450x222.jpg