Teletype ER pattern - How to script this?

I’m working through some ER patterns and having a brain freeze on the following:

12/8 time

|x-x|-xx|-x-|x-x|

Any suggestions for how to script this? It is #3 and #4 in the image below (from wikipedia):

For the upper pattern I would try:

T = 0 (step number)

ER 7 12 SUB T 3