QLab Manual Typewriter

Note: In QLab 4, the Titles cue was renamed to the Text cue. The downloadable example workspace opens and is fully functional in all versions of QLab 3.1.11 or later.**

This workspace simulates a manual typewriter, complete with typing sound effects, a line ending bell, and a carriage return, using a Titles cue and some scripting.

Here it is in action:

How It Works

Each typewriter cue is a Group cue containing a Titles cue with the text to be typed stored in its notes field. The Group cue also contains a Script cue which contains the cleverness. At the top of the Script cue are settings. The Titles cue must have a cue number, e.g. T1 and this number must be entered in a variable at the top of the script. The typing speed and the characters per line are also set here.

Here’s the script:

set thecuenumber to "T1" -- cue number of Titles cue this script controls
set speed to 0.2 -- gap between typed characters in seconds
set charPerLine to 48 -- Number of characters per line

tell application id "com.figure53.qlab.3" to tell front workspace
  stop cue thecuenumber
  set thetext to notes of cue thecuenumber
  set thecount to number of characters in thetext
  set the text of cue thecuenumber to " "
  start cue thecuenumber
  repeat with i from 1 to thecount
    set thechar to text i thru i of thetext
    set thetype to text 1 thru i of thetext
    set custom message of cue "LIVE" to "/cue/" & thecuenumber & "/liveText \"" & thetype & "\""
    delay speed
    if i is in {charPerLine \- 6, charPerLine * 2 - 6, charPerLine * 3 - 6, charPerLine * 4 - 6, charPerLine * 5 - 8} then start cue "BELL"
    if i is in {charPerLine, charPerLine * 2, charPerLine * 3, charPerLine * 4, charPerLine * 5} then
      start cue "CR"
      delay 0.2
    end if
    if thechar as string is not " " then
      start cue "SND"
    else
      start cue "SPC"
    end if
    start cue "LIVE"
  end repeat
end tell

The script sets the custom message of the OSC cue numbered LIVE:

/cue/T1/liveText

Then, starting with character 1 of the text in the notes field of the Titles cue set in thecuenumber, the script loops continuously, adding another character to the custom message until all characters are present.

Each time a letter is typed, a keystroke sound from the ‘start random child’ Group numbered SND is played. A few characters before the end of the line, a bell sound is played. When the end of the line is reached, the typing pauses for a second and the carriage of the typewriter is heard returning to the beginning of the next line.

The example workspace has two sample cues. The second one incorporates a great suggestion from Chris Mower which makes the typing more human by varying the delay time between typed characters. In the script above, replace set speed to 0.2 with:

set speedQuick to 0.02 -- short gap between typed characters in seconds set speedSlow to 0.2 -- longer gap between typed characters in seconds

Also replace delay speed with delay (random number from speedQuick to speedSlow).

You can, of course, adjust the times to suit your needs.