Stutter/Feedback Algorithm is an algorithm I discovered by accident when I was in lukio.

I toyed with my TI-85 graphing calculator to make a weird string-mangling program. And behold, a weird program it became. It lived in my calculator as program "GUNK". Later I just called it the "stutterizer".

What does it do? It is a verbal simulation of stuttering (well, to way too high proportion, actually), but it also simulates microphone/speaker feedback effect pretty well. (Just send this one to the Festivals. =)

The original TI-85 BASIC program is as follows:

\START85\
\COMMENT=Program file dated 11/08/98, 00:01
\NAME=GUNK
\FILE=C:\TI85\WAREZ\GUNK.85P
: Disp "\UC-A:\nkytyssimulaattori"
:Disp "(C)Urpo Lankinen 1996"
:" "\->\RES:""\->\STRNGEL:1\->\POZ:3\->\SIZ
:Disp "Kirjoita lause:"
:InpST STRNGEL
:Disp "Lasketaan..."
:Lbl ALKU
:RES+sub(STRNGEL,POZ,SIZ)\->\RES
:POZ+1\->\POZ
:If POZ+SIZ\<=\lngth (STRNGEL)+1:Then:Goto ALKU:End
:RES
\STOP85\

The first computer version of it was implemented for TinyFugue:

; Stutterizes string and says it aloud.
; By: WWWWolf 6.6.1998 <wwwwolf@iki.fi>
;
; I don't have the 'silly' WI flag for nothing, you know...
; ... and I'm also a little shy.
;
; $Id: stutter.tf,v 1.0 1998/06/06 17:01:47 urpo Exp urpo $

/def stutter = \
   /let mystring=%{*} %; /let out= %; /let ctr=0 %;\
   /while ({ctr}<=(strlen({mystring})-3)) \
     /let out=$[strcat({out},substr({mystring},{ctr},3))] %;\
     /let ctr=$[{ctr}+1] %;\
   /done %;\
   "%{out}

I would include my first Python program here, incidentally one that does this thing, but regrettably the variable names were in Finnish and it isn't that great, thus.

Okay, that's enough weird science in weird unreadable languages. Let's try a language that can actually be read and that was designed for clear presentation of algorithms, Rexx:

parse arg infile
if infile\='' then
	do while lines(infile)>0
		call stutter(linein(infile))
		end
else
	say 'Usage: stutterize.rexx filename'
	exit

exit
	
stutter: procedure
parse arg line
string = ''
do i = 1 to length(line)
	string = string || substr(line,i,3);
	end
say string
return

The stutter procedure illustrates the principle: We go through the string one character at time, taking three following characters each time, until we end up to the end of the line.

...

(The weirdest thing: I have not made a Perl version.

Yet.)

...

So,o, , t ththihisis s i isis s t ththehe e s ststutututtttetereririzizezerer,r, , a ananyny y q ququeueseststitioiononsns?s? ?

Ahehemem,m, , I I I a asaskskekeded.d....... . H HeHeyey,y, , c cacanan n s sosomomemeoeononene e p plpleleaeasasese e s ststotopop p t ththehe e f fefeeeededbdbabacackck?k??????? ?


Oh, yeah, now I have made a version in Perl and in some other languages as well! See Comparison of programming language types.