(Teletype) 2.1 Firmware Beta (rc2: EVERY et al.)

Teletype 2.1 is around the corner, so it’s time for the beta thread!

Latest build: Release Candidate 2

This time around, I’ll be rolling most of my recent work together for a few bug fixes and a few new features.

Here are the bug fixes:

  • Issue 35: SCENE in an I script won’t run on first load
  • Issue 38: AVG and Q.AVG round ties away from zero
  • Issue 80: Recursive delays (DEL + SCRIPT) now function
  • Issue 93: KILL will now clear TR outputs
  • Issue 94: The I variable is now local to the L mod. I is no longer general-purpose.

Here are the new features:

  • Script commands can now be disabled in EDIT mode with ALT-/. Disabled lines persist across scene save/load.
  • Lines can now be inserted in PRESET WRITE mode with SHIFT-ENTER.
  • Tracker data entry now buffered (won’t change until you hit ENTER).
  • CTRL-F1 through CTRL-F8 mutes/unmutes scripts
  • CTRL-F9 enables/disables the METRO

And the new operators:

  • BPM [x] (was MSPB): gets the number of milliseconds per beat for x BPM.
  • LAST: gets the last time since a script was last called (Tap tempo: M LAST SCRIPT)
  • SCRIPT: with no arguments gets the current script number
  • BREAK: stops executing the current script and any subsequent
  • W [x]: - a while loop mod that uses a condition instead of a counter like L.
  • @, the Turtle operator

All of these features have been somewhat vetted by the community, and all (except maybe W?) have been okayed by @tehn.

This thread will focus on the aforementioned features and operators, and the testing thereof. If you have things you’d like to see in later firmware revisions, check out the New Operators & Features thread.

Testers Wanted!

Testing Instructions:

  • Try out your favourite scenes.
  • Try new scenes with the new features.
  • Try out your most complex scenes
  • Build new complex scenes
  • If anything is unclear about any feature or op, just ask!
  • If anything breaks, document the script and post it in the thread with the symptoms

Here’s to a well-tested release candidate!


i approve of W (the mod command, that is)

furthermore, all volunteers welcome who are willing to catch the docs up with any changes confirmed here!


Haven’t forgot about the docs site changes (life got in the way for a bit).

I believe that I’ve got the bulk of things ready in my branch and could do some cleanup this evening and prep that for merge.

As far as actually putting things up online…I can investigate that again and come up with a quick plan of action to see what you think, if that works.

1 Like

As promised, the beta-1 firmware is now cleanly merged, properly tested, and available for testing!

Testing Instructions:

  • Try out your favourite scenes.
  • Try new scenes with the new features.
  • Try out your most complex scenes
  • Build new complex scenes
  • If anything is unclear about any feature or op, just ask!
  • If anything breaks, document the script and post it in the thread with the symptoms
1 Like

Example Snippets

1: Set the metronome to 120 BPM

M BPM 120

2: Tap tempo (Updated for beta2)


3: New L / I behaviour

1: B 2
   L 1 4: A I; SCRIPT 2
2: L 1 2: B ADD B MUL I B

RESULT: A = 4, B = 26

4: Fixed DEL / SCRIPT behaviour: Tap a rhythm out with temporal recursion

1: TR.P 1
   DEL BPM 120: SCRIPT 1

Tracker Data Entry Behaviour

  • Beginning data entry with a numeral enters cell edit mode.
  • While in this mode, you may edit the number without disturbing the underlying data.
  • Increment and decrement ( [ and ] ) keystrokes, as well as negate ( - ) still work.
  • Numbers that are too large are blocked from entry.
  • The data is stored in the pattern when you press <ENTER> to set the cell or <SHIFT>-<ENTER> to insert the new data in the sequence.
  • All other navigation keys abort data entry and return to cell select mode.

these new methods are a joy to use. way more natural. thank you!

is the new timer code in this beta? i’m getting dropped metro executions with the simplest setup:

TR.TIME 1 20
M 100

TR.P 1

No sir. I don’t know what’s going on there, maybe an initialization problem with the execution stack. I’ll look at it this afternoon. Thanks for the report.

just switched back to 2.0 and confirmed it’s working, back to 2.1 and the missed M executions are back.

i’m assuming this is branch “beta1” in your repo? i can do a quick glance at the changes…

wow, you’ve even updated the docs! much respect.

also, commenting (alt-/) is super rad.

interesting use case (with not very elaborate example script):

TR.P 1
TR.P 2
TR.P 3
TR.P 4

toggling comment on BREAK is like a partial-mute of the script. when commented you get all four triggers, when muted, just the first.


I’m at home now, confirmed the bevaiour, and am looking into it.

Yes, it’s the beta1 branch on my repo. You can check it out if you like, I’m sure the relevant code is between teletype.c and state.c

Think I know what it is. The fix for P.RM was applied to the wrong place. I’m going to clear up the script number fencepost questions by making an enum for valid script numbers.

thanks! also just found that external trigger inputs at a regular tempo also have occasional missed script executions.

feature change discussion regarding LAST. i feel that it’s useful for scripts to be able to get the LAST time for other scripts. ie, the metro checking when the last time input 1 was triggered, and doing something if that time is greater than a threshold. there’s currently no way to do this with LAST always reading the script it’s on. i’d like to propose the LAST x where x is script 1-8 (we can roll in 0 and 9 for I and M).

of possible use, i propose SELF which simply returns the script number. ie, SELF run from script 1 returns a 1. so LAST SELF would do the current behavior in 2.1beta1. i can imagine the further possible use of THIS when copying the same line to several scripts, ie TR.P SELF onto scripts 1-4 (again, mundane application, but there are more complex cases).



Ha! I just thought this same thing on the drive home, although my keyword for the current script was THIS. I agree wholeheartedly.

YES. WHAT? like a cascade effect, instead of having to string together DELs! that’d be rad.

side q: DELs are expensive, yes? if so, would something like LAST be less expensive?

This didn’t fix it. I had indeed made the P.RM bugfix in the correct place. I’m going to add bounds checking to all the code that uses a script number from userspace. I don’t think any of my changes should have had this impact, but the merge process was bumpy and maybe es_init, es_push, and es_pop need a second set of eyes. I’ll have a peek there after I’m done.

What does it return if it isn’t run from a script? (e.g. live mode, a delay…) 0?

You’ll need to make sure that 0 doesn’t cause issues if it’s passed to SCRIPT or LAST, etc, etc. (I don’t think it does though… as scripts are 1-indexed).

1 Like

Yeah, I’m on it. :slight_smile:

I can add live mode as a pseudo-script and track the last time a command was run from live mode, I guess?

aha. when i thought of the change while doing chores i also thought THIS, and then forgot while writing up the forum post. THIS is much better!

Found the bug: wasn’t calling es_push() after es_init() in run_script().

I’m going to make the changes to LAST, add THIS, then release beta2.


I hate bugs like that, then I love them when I find the fix…