mathr / blog / #

Phones At Home

accedes guidera crady wildey reads,
deline dobbie wiedeman speedily:
derouin andresen dweeb maltreated freed’s,
directors’ dwelley moldy hardegree.
kedrowski dumpty bady audio,
retired repealed debussy dirtiest;
divinely ludcke mead’s dimeglio,
abbreviated trudy handiest.
richaud d’ivoire restaged shaheed ardeen,
kolodziej streed comedians denyse?
dravecky leonid adhesives dean,
convened demeanours daughtery devries!
restricted doshi defect kneading diel:
intrepidly succeed rashid madill.

A sonnet is a poetry form with a certain meter and rhyme. The meter (aka rhythmic stress) is iambic pentameter, which means there are five pairs of weak-strong stress in each line. There are 14 lines, and alternate pairs of lines rhyme with each other, in the pattern AbAb CdCd EfEf GG. Traditionally sonnets have a thematic form too, but that's harder to encode algorithmically so I skipped that part.

muhammed glenwood goulden nationhood,
durante fullwood woodell isherwood:
dimuro gooding’s lurid ravenswood,
muhammad’s woodpile goodroe likelihood.
decook demurely goodyear’s hollywood’s,
honduras watwood fluoride waldenbooks;
badour hondurans longwood neighborhoods,
muhamed woodsmen’s debuhr buddenbrooks.
midura durant footed arwood boord,
amdura goodyear bullied fulford boord?
damour boyhood endure suhud obscured,
gourdine datura kerwood boord ensured!
moored lueders detours woolard neighborhoods:
muhammed’s detours murad footed good’s.

The Carnegie Mellon University Pronouncing Dictionary is an open-source machine-readable pronunciation dictionary for North American English, says their website. Each word is spelled with 39 phones (individual sounds like vowels and consonants), and the vowels have stress indications. I used it to generate sonnets, each with a focal pair of phones.

designs editions frenzied exercised,
defoe’s adviser’s hyde’s davanzo mead’s:
lozada shoulders lloyds’ democratized,
disclaims deserving ceredase accedes.
pandora’s medgar’s towards thalidomide’s,
withstands blonds border’s bethards teased deplores;
renditions herbicides directives chides,
demarzo deal’s dapuzzo underscores.
agendas notepads doze surrounds arcades,
commodities mcalexander digges?
offends dubrovnik’s designation jades,
medusas soundings sowards hundreds digs!
d’souza gaydos fairgrounds equalized:
pedroza downey’s wilds securitized.

The algorithm is stochastic. It fills words starting from the end of the line (constrained by rhyme) and works back towards the start of the line. Only words containing both phones are allowed, and words are weighted by how well they fit with the meter. Lines that deviate too far from the meter are rejected and retried; this means that sometimes it can take a long time to emit a complete poem. Some pairs of phones seem to have no poems possible at all, these pairs are forbidden when choosing phones.

arcuri surely juries bulkeley,
qureshi pussycat tellurium:
curie securely bookie woodmansee,
purina pulleys bully pulliam.
duryea woodie bogie livelihoods,
manchuria mercuri likelihood;
furini youri heathwood hollywood’s,
bijur duryea beechwood hollywood.
duryea reinsure centurion,
venturi pussyfoot missourians?
curie create-a-book venturian,
mcgourty storybooks missourians!
missouri woodby beechwood whoopdedoo:
assemblywoman pussy whoopdedoo.

I emit the poems as LaTeX source code, for typesetting into a zine of 8 pages (6 poems as all pairs from 4 phones) or a book of 68 pages (66 poems as all pairs from 12 phones). Page counts are sometimes overshot because some poems have long words that cause line wrapping and page breaks. I set up a couple of cron jobs for these, publishing the PDFs in podcast RSS feeds with HTML index too.

zalesky knees gene’s airfields refsnes g.s,
mulroney’s orleans jimmy’s finkelstein’s:
achieves asean freas celebrity’s,
removes repositories jees vaccines.
jarriel’s viens evens legionaries skis,
monzingo hargreaves brienza cassidy’s;
falzone rustys cynthia’s degrees,
louise pianos quito’s speakes’s ease.
ariza antibodies shear’s mczeal,
henriques entries manganese louisette?
mackenzie licensees toshiba’s zele,
analyses mcnees fifteens louisette!
livan’s concedes farinas meehans z.’s:
kathleen’s lamine’s bikinis carberry’s.

Then I added a plain text output mode, and used Festival Lite (flite) to do text-to-speech, and DarkIce to do internet streaming radio, with ALSA loopback device connecting the two (things like JACK and PipeWire are too complex for me to configure on my headless Raspberry Pi). Thanks to Lurk for the IceCast streaming server. Flite has a few voices to choose from, so I made each successive poem be read by a different one. The final touch was using CURL to set track title metadata.

missouri’s goodyear’s murals fuller’s luehrs,
curators busch’s tour’s moore’s bookmobiles:
hondurans football’s tour’s chargeurs matures,
nomura’s kuras wildwoods bookmobiles.
durations voorhies bureau’s hoods endures,
matures bookcellars fuller’s rookies full’s;
muhammad’s bushings butchers jurors’ tour’s,
bulldoze azura smoshes bush’s pulls.
huzzah missouri’s goody’s cottonwoods,
shultz’s curators tours brochures huzzah?
secures erzurum voorhees moorland’s woods,
curator’s lures missourian huzzah!
durazo woolsey luhrs securities’:
muhammed’s winwood’s wools securities.

You can check out the project and its source code here: