gnuradio: How can I change the value of the tag exiting the "Correlate Access Code - Tag" block? Background: I have built a conventional demodulator in gnuradio and am trying to send payload data out of the flowgraph to an external Python script. I'm using gnuradio v3.7.12.

It seems to me that the optimal method would be to use the flowgraph to:


find the preamble and tag it
convert the data following the payload to a pdu
send the pdu as a message to the external Python code


I've built a flowgraph that successfully does this using the following blocks:
input bitstream->"Correlate Access Code - Tag Stream"->"Repack Bits"->"Tagged Stream to PDU"->"ZMQ PUSH Message Sink".

The problem is that the "Correlate Access Code - Tag Stream" block expects a very specific header between the preamble and the payload: 32 bits containing the payload size (16 bits repeated twice). This is fine if I am the one controlling the input signal. Any other signal I try to receive, however, is not going to have this header field.

So instead of the "Correlate Access Code - Tag Stream" block, I tried to use the "Correlate Access Code - Tag" block, but this block sets the length tag value to 0, which prevents the rest of the signal chain from working correctly. It seems like all I need to do is change the value of the length tag to my expected payload length, but unfortunately, after many hours of scouring the documentation regarding tags, messages and pdus, I have been unable to figure out how to do this.

Am I on the right track? I've attached my working flowgraph (with the "Tag Stream" block) as well as the non-working flowgraph (with the "Tag" block). I tried a number of things (Tagged Stream Align, Stream to Tagged Stream), but I couldn't get anything to work.

Working GRC: https://www.dropbox.com/s/ilv0ry1x4nvqelj/tag_stream_test.grc?dl=0

Non-working GRC (can't set length tag!):
https://www.dropbox.com/s/aoueiovuvj9ss8z/tag_test.grc?dl=0

Thanks for any help you can provide.
PC
I'm also hit by the same problem, and came up with &quot;Tag Rewrite&quot; python block to update the value.
https://gist.github.com/4a65be9c5139eb132f311b68808d36a6
However, even though I was able to update the length, &quot;Repack Bits&quot; block does not seem to pick it up. So while I was able to change the value of the tag, I still haven't accomplished my goal of taking the data out from the stream.