s-macke / SAM

Software Automatic Mouth - Tiny Speech Synthesizer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

it gets stuck/frozen on some sentences and cant handle big strings

lever1209 opened this issue · comments

i was making a wav file for the entire bee movie script to annoy some friends on a bluetooth speaker
i ran into two problems so far,

one is if you hand over a big string, it will create phonemes, but for some reason will stop after a certain amount and use only what it had generated so far

another thing is it freezes up on special characters sometimes, i had to use a regex preprocessor to filter the characters and build about 1000 separate commands to run with it, so i could have the bee movie script spoken with this program

this is what i used, for a filter, its probably ass code because i threw it together in 5 mins, but it should work

StringBuilder sB = new StringBuilder();
		Scanner myReader;
		try {
			myReader = new Scanner(new File("input file path containing the bulk text"));
			while (myReader.hasNextLine()) {
				sB.append(myReader.nextLine());
			}
		} catch (FileNotFoundException e1) {
			e1.printStackTrace();
		}
		String[] nin = String.valueOf(sB).split("\\s+");
		FileWriter myWriter;
		try {
			myWriter = new FileWriter(new File("output file"));
			int count = 0;
			StringBuilder s = new StringBuilder();
			StringBuilder si = new StringBuilder();
			int batchCount = 0;
			for (String i : nin) {
				for (char j : i.toCharArray()) {
					if (!String.valueOf(j).matches("\\W")) {
						si.append(j);
					}
				}
				count++;
				if (count >= 10) {
					s.append(si + " ");
					myWriter.write("samcommand -wav subfolder\\" + batchCount + ".wav " + s);
					count = 0;
					batchCount++;
					s.delete(0, s.length());
				} else {
					s.append(si + " ");
				}
				si.delete(0, si.length());
			}
			myWriter.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

I hope this starts a trend of using the Bee Movie script to test speech synthesis engines.

the character limitation is a limitation coming from SAM on the c64 itself, and i suppose this repo only intends for it to be as close to the original disassembly as possible