Post Go back to editing

Detecting and processing command sequences in SigmaStudio

I'm using SigmaStudio and an ADAU1442 development board to process an audio input stream with 6 different channels, which I've been able to separate. One of these channels contains volume and mute information, instead of regular audio data. I need to decode this data and use it to control the output stream. This data is sent in the form of packets, which consist of two header bytes, a length byte, some data, and finishing with a checksum.

I'm thinking of storing the last N data samples in some kind of array or buffer, looking for the header bytes, and then accessing the data bytes directly after the header bytes.

Is there a way of implementing a data buffer or queue in SigmaStudio? Is there a better way of decoding these command packets?

  • Hello aytli,

    This will be very difficult to do since it is a DSP and not a general purpose processor. What will make it more difficult is that it seems to me that it is a variable length since you have a length byte. 

    Do you have any control on changing this data stream? There might be a better way to implement this sort of control. 

    This is just my first thoughts on your question.  I would need to see the format and how it is being transmitted in the audio steam. I have built some bit-banging SigmaStudio programs but this may be a challenge. 

    So supply some more details and let me know if there is any way to alter how the data is being sent?

    One other thing, Are you set on using this processor? The reason I ask is because the ADAU1452 has block processing available and this might be a good place to use it. 

    Thanks,

    Dave T

  • Hi Dave,

    We don't have control over the data stream. I've asked the manufacturer for more documentation, but there are only two commands we're looking for (mute and unmute), and it seems like the bytes we care about should be in the same position (bytes 3 and 4 in the packet) in each packet, as well as having the same value (0x0C0001 for mute, 0xE10002 for unmute).

    These commands are actually broadcast at a frequency of about 4Hz, instead of just being sent out once. For example, when the mute button is pressed, a mute command will be sent every 250ms. When the mute button is released, an unmute command will immediately be sent out, and then repeated every 250ms.

    I'm currently trying to detect the bytes of the mute command, and disabling the output stream whenever these bytes are active on the command channel.

  • Hello aytli,

    It was past my time to go home but I had to try to work out something. So I thought of a simple way to do this and it worked! Remember that this program is run every sample period. As long at those two hex values you gave are unique for the data stream then this should work. 

    Every time it gets the value for mute it will set a value-hold cell to output a zero. This output is sent to a volume control with an external control so it will mute the audio. 

    Then when an Un-Mute command is sent, it will send a reset to the Value-Hold cell but since the mute value was not correct it will hold a "1" instead and that will turn on the audio. 

    If the values are repeated it will simply stay in the same state. If other values are present it will do nothing. 

    Give it a try, no guarantee but I was pleased that I got this on pretty much my first try. ( I had the logic backwards on my first try, oops). :)

    Here is a screenshot of the logic portion of the project. I will attach the project as well. Note, I have a switch to test different values. So two positions are junk values on purpose to represent the other data in the stream. 

    Dave T

    ADAU1442 Mute and Unmute from Data Stream.zip

  • Hi Dave,

    So the block diagram you sent me works great, I'm able to control the output audio by selecting the input blocks.

    However I'm having trouble getting the DSP to detect these bytes. I know the bytes are there because I can see them on a logic analyzer, but the DSP only sees values of 0 on that channel.

  • Hello aytil,

    I will need a lot more detail. 

    How is the data getting into the DSP? Is it on a TDM data stream? 

    What is the data format? 

    Send screenshots if you can?

    Tell me frequencies of all the clocks?

    Send me a SigmaStudio project that you are using to test this. You can strip out some of your proprietary stuff but I can look at your register settings much quicker with a project in front of me. 

    Hardware schematics can sometimes also give clues. 

    I will most likely not be able to replicate the data stream but I may be able to see the issue with more details. 

    Dave T