Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Speech.Synthesis;
- namespace Glossolalia
- {
- class Program
- {
- static string BuildString()
- {
- string consonants = "cdfghllllllmmmnnnpssswwwy";
- string vowels = "aaaaeeeioou";
- List<string> sounds = new List<string>();
- foreach (char vowel in vowels)
- {
- foreach (char consonant in consonants)
- {
- sounds.Add(vowel.ToString() + consonant.ToString());
- }
- }
- Random random = new Random();
- string result = "";
- int repeatChance = 3;
- for (int i = 0; i < random.Next(200, 500); i++)
- {
- string syllable = sounds[random.Next(0, sounds.Count)];
- result += syllable;
- // Random repetition
- if (random.Next(0, repeatChance) == 0)
- {
- result += syllable;
- repeatChance++;
- }
- if (!result.EndsWith(" ") &&
- !result.EndsWith(",") &&
- !result.EndsWith("."))
- {
- // Random space
- if (random.Next(0, 3) == 0)
- {
- result += " ";
- repeatChance = 3;
- }
- // Random comma
- else if (random.Next(0, 10) == 0)
- {
- result += ", ";
- repeatChance = 3;
- }
- // Random full stop
- else if (random.Next(0, 20) == 0)
- {
- result += ". ";
- repeatChance = 3;
- }
- }
- }
- return result + sounds[random.Next(0, sounds.Count)] + ".";
- }
- static void Main(string[] args)
- {
- SpeechSynthesizer synthesizer = new SpeechSynthesizer();
- string say = BuildString();
- Console.Write(say);
- synthesizer.Speak(say);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement