← 제작기

쉼표에서 쉬지 않는다는 판단은 표의 한 칸에서 나왔다

매일 아침 날씨와 옷, 일정과 나설 시각을 비서 목소리로 들려주는 브리핑을 만들고 있습니다. 맥에서 도는 로컬 모델이 글을 쓰고, 음성 합성 모델이 그 글을 읽습니다. 지난 글 「글로는 맞던 문장이 소리로는 끊겼다」에서 합성기가 쉼표에서 쉬지 않는다고 적었고, 그래서 긴 문장을 쉼표에서 조각으로 나눠 따로 읽힌다고 했습니다.

그 글을 올린 날 밤 이 판단을 뒤집었고, 지난 글에는 짧은 정정 문단을 붙였습니다. 이 글은 그 정정을 풀어 쓴 것으로, 무엇을 바꿨는지보다 왜 처음에 잘못 읽었는지와 무엇을 단서로 다시 찾았는지를 적습니다. AI 와 함께 재고 고치는 동안 잘못 읽은 것이 두 번 있었습니다. 한 번은 숫자 표였고, 한 번은 제가 귀로 듣고 한 말이었습니다.

표에는 쉼 칸이 둘 있었다

처음 판단의 근거는 전후 비교 도구가 내는 표였습니다. 지시문이나 읽는 방식을 고칠 때마다 같은 가짜 자료로 소리를 만들고, 소리 속 무음을 길이별로 셉니다. 칸은 둘입니다. 0.3초 넘게 쉰 횟수, 그리고 0.12~0.3초 사이로 짧게 쉰 횟수입니다. 짧은 칸을 세는 코드 줄에는 '문장 안 숨 쉬는 자리(쉼표 등)'라는 주석이 달려 있었습니다. 쉼표에서 쉰다면 그 칸에 들어올 것이라고 도구를 만들 때부터 정해 둔 셈입니다.

쉼표 셋이 든 글을 읽힌 소리에서 짧은 칸은 0 이었고, 이것을 보고 쉼표에서 쉬지 않는다고 적었습니다. 같은 줄의 다른 칸에는 0.3초 넘는 쉼이 7번이라고 찍혀 있었습니다. 그 글은 다섯 문장이라 문장 사이 이음매가 넷입니다. 이음매 넷에 쉼표 셋을 더하면 일곱입니다. 합성기는 쉼표에서도 쉬었고, 그 쉼이 생각보다 길어서 쉼표 몫으로 마련한 칸을 넘어 긴 쉼 칸에 들어가 있었습니다.

숫자는 처음부터 표에 있었습니다. 긴 쉼이 몇 번 나와야 맞는지 먼저 세어 두었다면, 7 이 4 보다 셋 많다는 것이 바로 보였을 것입니다.

들어 보니 호흡이 어색했다

다시 보게 된 계기는 표가 아닌 귀였습니다. 그날 저녁 브리핑을 다시 들으니 문장 사이 연결과 문장 안 호흡이 어색했습니다. 그때 소리는 문장마다, 긴 문장은 쉼표 조각마다 따로 합성해 이은 것이었습니다. 이을 때 넣은 무음은 아무 소리도 없는 구간이라, 그 자리를 경계로 소리를 갈라 조각마다 쟀습니다. 조각 열 개의 말 빠르기가 초당 5.1~7.4음절, 목소리 높이 가운데 값이 158~200Hz 로 제각각이었습니다. 쉼은 문장 사이 0.25초, 쉼표 0.12초로 어디서나 같았습니다. 조각마다 높낮이가 새로 시작된 것을 호흡이 어색했던 까닭 가운데 하나로 봅니다. 이 부분은 추정입니다.

쉼표 판단도 처음부터 다시 확인했습니다. 문장 하나를 열 번 읽히니 쉼표에서 0.42~0.61초씩 쉬었고, 예전 표의 잣대로 재도 0.44초였습니다. 같은 문장을 네 번씩 읽혀 보니 높이 가운데 값의 폭이 온도 0.7 에서 17Hz, 0.4 에서 6Hz 여서 온도를 0.4 로 낮췄습니다.

이틀 전에 정한 '합성에는 한 문장씩 넘긴다'도 같은 저녁에 다시 쟀습니다. 두 문장을 한 번에 넘기면 가끔 첫 문장만 읽고 끝난다는 관찰에서 나온 규칙이었고, 목소리를 본뜨는 시험 다섯 번 가운데 두 번이었습니다. 이번에 여러 문장을 한 번에 읽힌 23번은 받아 적은 글과 대조해 모두 끝까지 읽었고, 모델은 쉼표와 문장 끝에서 스스로 0.4~0.9초 쉬었습니다. 지금은 잘림을 소리 길이로 가려 다시 읽힙니다.

다른 사람 같다는 말을 반대로 옮겼다

덩어리 하나를 통째로 이어 읽히는 판을 먼저 만들었습니다. 들어 보니 전보다 나았지만, 중간에 높낮이가 미묘하게 높아지면서 다른 사람 같았습니다. 이 말을 높게 튀는 구절 탓으로 읽었습니다. 재 보니 덩어리와 문장의 첫 구절이 196~207Hz 로 높게 나오고 있어서, 그 구절을 낮추는 방법을 차례로 세 가지 해 봤습니다.

첫째는 앞 덩어리 소리와 글을 참고 음성 뒤에 이어 붙여 방금 한 말처럼 보여 주는 것이었습니다. 첫 구절은 내려왔지만 뒤 덩어리로 갈수록 계속 내려가 덩어리 가운데 높이가 185Hz 에서 129Hz 가 됐습니다. 둘째는 앞 덩어리 마지막 문장을 붙여 읽혔다가 잘라 내는 것이었습니다. 덩어리 안 문장 첫머리는 그대로 200Hz 안팎이었고, 자를 쉼을 잘못 고르면 말이 남거나 빠질 수 있었습니다. 셋째로 180Hz 넘는 구절을 다시 표본화해 낮추고 길이는 되돌렸는데, 들어 보니 너무 낮았고 다른 사람 느낌도 그대로였습니다.

재는 도구도 이 차이를 잡지 못했습니다. 합성 모델의 화자 인코더로 같은 사람인 정도를 재면 모든 덩어리가 0.97~0.99 였습니다. 숫자로는 처음부터 끝까지 한 사람이었습니다.

몇 초 구간인지부터 물었어야 했다

셋째 방법을 들은 뒤에야 구간을 짚었습니다. 가짜 브리핑의 0~10초는 괜찮고 11~18초에서 목소리가 바뀐다고 말했습니다. 그 구간을 문장별로 재니 원인은 높은 구절과 반대쪽에 있었습니다. 세 문장, 78음절을 한 번에 읽힌 날씨 덩어리에서 첫 문장은 190Hz·초당 6.4음절인데, 둘째와 셋째 문장이 140·147Hz, 초당 5.9·5.3음절로 가라앉아 있었습니다. 같은 글을 한 번 더 읽힌 판도 141·146Hz 로 같았습니다. 제 귀에 다른 사람으로 들린 것은 낮고 느려진 뒷문장이었습니다. 190~201Hz 의 높은 구절은 오히려 괜찮은 쪽이었습니다. 세 방법은 모두 버렸고 코드에도 남기지 않았습니다.

한 번에 읽히는 단위를 두 문장, 55음절까지로 줄였습니다. 둘째 문장부터 높이가 참고 음성 가운데 높이의 0.9배, 그때 비서 목소리로 154Hz 밑으로 내려가면 가라앉은 것으로 보고 세 번까지 다시 읽힙니다. 같은 가짜 브리핑을 두 번 읽히니 모든 문장이 159~194Hz, 초당 5.8~6.8음절이었고, 가라앉던 두 문장은 182~192Hz 로 올라왔습니다. 가라앉아서 다시 읽은 것은 한 번이었고 150Hz 에서 178Hz 가 됐습니다. 들어 보고 이대로 두기로 했습니다. 이튿날 아침 이 방식으로 처음 저절로 돈 브리핑은 글이 첫 시도에 검사를 통과했고, 21.9초짜리 소리를 받아 적어 대조한 오류율이 0 이었습니다. 가라앉음 기준과 단위 크기는 가짜 브리핑 두 판과 진짜 브리핑 한 판으로만 정한 값입니다.

한 칸만 본 일은 또 있었다

같은 날 지시문을 고칠 때도 비슷한 일이 있었습니다. 바람 이야기가 따로 떨어져 나오는 것을 고치려고 "둘째 문장은 까닭을 먼저 말하고 권한다", "조심하라는 말만 따로 한 문장으로 말하지 않는다" 두 줄을 지시문에 더했습니다. 고치지 않은 덩어리가 흔들렸습니다. 비가 없는 맑은 날 자료에서 첫 시도에 마스크가 세 번 다 빠져, 첫 시도 통과가 고치기 전 3/3 에서 0/3 이 됐습니다. 두 줄을 빼고 바람 문장의 본보기 하나만 두자 5/5 로 돌아왔습니다. 지금은 본보기를 고칠 덩어리에만 주고, 맑은 날 자료로 함께 잽니다.

날씨 자료에서도 칸 하나만 믿을 수 없었습니다. 그날 예보는 오전 9~11시 강수확률이 54~100% 인데, 같은 시간의 날씨 코드는 구름 조금이나 맑음이었고 강수량은 0 이었습니다. 비 코드는 8시 하나, 0.1mm 의 약한 이슬비뿐이었습니다. 확률 칸으로는 비 오는 날이고 코드 칸으로는 맑은 날입니다. 비 종류는 비가 올 수 있는 시간 가운데 비 코드가 있는 시간에서만 고르고, 없으면 그냥 '비'라고 말하게 했습니다.

정리하면

  • 표의 숫자는 칸 하나보다 합으로 맞춰 봅니다. 이음매가 넷인데 긴 쉼이 일곱이면, 남는 셋이 어디서 왔는지부터 찾습니다.
  • 재는 도구에는 만든 쪽의 짐작이 들어 있습니다. 쉼표 몫으로 만든 칸은 쉼표의 쉼을 담지 못했고, 같은 사람인지 재는 값은 귀에 들린 차이를 잡지 못했습니다.
  • 귀로 들은 말은 몇 초 구간인지부터 묻습니다. 구간을 모른 채 세 가지를 고쳤고, 구간을 듣고 나서야 원인이 반대쪽에 있는 것을 알았습니다.
  • 뒤집은 판단은 처음 적은 곳에도 적습니다. 지난 글에 정정 문단을 붙였고, 저장소 문서의 그 항목도 처음 문장과 바로잡은 날을 남긴 채 고쳤습니다.

처음 판단을 적은 글은 글로는 맞던 문장이 소리로는 끊겼다에 있습니다.

I am building a briefing that reads me the weather, what to wear, my events and when to leave every morning in an assistant's voice. A local model running on the Mac writes the text, and a speech synthesis model reads it. In the previous post, Sentences That Worked on the Page Broke When Spoken, I wrote that the synthesiser did not pause at commas, and that long sentences were therefore split into pieces at their commas and read separately.

The night that post went up, I reversed this judgement and added a short correction paragraph to the previous post. This post spells that correction out. Rather than what I changed, it records why I misread things in the first place and what clue led me to find the answer again. While measuring and fixing things with the AI, I misread something twice. Once it was a table of numbers, and once it was something I myself said after listening.

The table had two pause columns

The basis for the first judgement was a table put out by the before-and-after comparison tool. Every time I change the instructions or the way it reads aloud, it makes audio from the same fake data and counts the silences in the audio by length. There are two columns: the number of pauses longer than 0.3 seconds, and the number of short pauses between 0.12 and 0.3 seconds. The line of code that counts the short column carried the comment "a place to breathe inside a sentence (commas, etc.)". In effect, it had been decided from the moment the tool was built that any pause at a comma would land in that column.

In the audio read from a text with three commas, the short column was 0, and from that I wrote that it did not pause at commas. Another column on the same row showed 7 pauses over 0.3 seconds. That text had five sentences, so there were four joins between sentences. Four joins plus three commas makes seven. The synthesiser did pause at commas, and those pauses were longer than expected, so they went past the column set aside for commas and into the long-pause column.

The numbers were in the table from the start. Had I first counted how many long pauses there ought to be, it would have been obvious at once that 7 is three more than 4.

When I listened, the breathing sounded off

What made me look again was the ear, not the table. When I listened to the briefing again that evening, the joins between sentences and the breathing inside them sounded off. The audio at the time had been synthesised separately for each sentence, and for each comma piece of a long sentence, then joined. The silence inserted at the joins was a stretch with no sound at all, so I split the audio at those points and measured each piece. Across ten pieces, the speaking rate ranged from 5.1 to 7.4 syllables per second and the median voice pitch from 158 to 200 Hz, all different. The pauses were the same everywhere: 0.25 seconds between sentences and 0.12 seconds at commas. I take the rise and fall of pitch starting afresh in every piece to be one of the reasons the breathing sounded off. This part is a guess.

I also rechecked the comma judgement from scratch. When I had one sentence read ten times, it paused 0.42–0.61 seconds at its comma, and measured with the old table's yardstick it was 0.44 seconds. Reading the same sentence four times at each setting, the spread of median pitch was 17 Hz at a temperature of 0.7 and 6 Hz at 0.4, so I lowered the temperature to 0.4.

The rule set two days earlier, "pass the synthesiser one sentence at a time", was measured again the same evening. It came from the observation that when two sentences were handed over at once, it sometimes read only the first and stopped; that had happened in two of five voice-cloning trials. This time, all 23 runs that read several sentences at once read to the end when checked against a transcription, and the model paused 0.4–0.9 seconds on its own at commas and sentence ends. Now a reading that stops short is detected from the audio length and read again.

I took "like a different person" the wrong way round

I first made a version that reads a whole block in one go. Listening, it was better than before, but partway through the pitch rose subtly and it sounded like a different person. I read this as the fault of phrases jumping up high. Measuring showed the first phrase of blocks and sentences coming out high, at 196–207 Hz, so I tried three ways of bringing those phrases down, one after another.

The first was to append the previous block's audio and text after the reference voice, presenting it as something just said. The first phrase came down, but it kept dropping toward the later blocks, and a block's median pitch went from 185 Hz to 129 Hz. The second was to prepend the previous block's last sentence, have it read along, and then cut it off. The starts of sentences inside the block stayed around 200 Hz, and picking the wrong pause to cut at could leave words in or drop them. Third, I resampled phrases above 180 Hz to lower them and restored their length; listening, it was too low, and the different-person feel was still there.

The measuring tool did not catch this difference either. Scoring how much each block sounded like the same person with the synthesis model's speaker encoder, every block came out at 0.97–0.99. By the numbers, it was one person from start to finish.

I should have asked which seconds first

Only after hearing the third method did I pin down the stretch. I said seconds 0–10 of the fake briefing were fine and the voice changed at 11–18 seconds. Measuring that stretch sentence by sentence, the cause was on the opposite side from the high phrases. In the weather block, where three sentences and 78 syllables were read in one go, the first sentence was 190 Hz at 6.4 syllables per second, while the second and third had sunk to 140 and 147 Hz, at 5.9 and 5.3 syllables per second. Another reading of the same text came out the same, at 141 and 146 Hz. What sounded to my ear like a different person was the later sentences going low and slow. The high phrases at 190–201 Hz were, if anything, the good part. All three methods were dropped, and none of them was left in the code.

I cut the unit read in one go down to two sentences, up to 55 syllables. From the second sentence on, if the pitch falls below 0.9 times the reference voice's median pitch, a threshold that came to 154 Hz for the assistant voice at the time, it is treated as having sunk and read again, up to three times. Reading the same fake briefing twice, every sentence was 159–194 Hz at 5.8–6.8 syllables per second, and the two sentences that used to sink came up to 182–192 Hz. One sentence was re-read for sinking, going from 150 Hz to 178 Hz. I listened and decided to keep it this way. The next morning, in the first briefing run automatically this way, the text passed the check on the first try, and the 21.9-second audio had an error rate of 0 against its transcription. The sinking threshold and the unit size are values set from only two fake briefings and one real one.

Reading only one column happened again

Something similar happened the same day while changing the instructions. To stop the wind coming out as a separate remark, I added two lines to the instructions: "The second sentence gives the reason first, then the advice" and "Do not say a warning on its own as a separate sentence." A block I had not touched wobbled. On the clear-day data with no rain, the mask went missing on the first try all three times, and first-try passes went from 3/3 before the change to 0/3. When I removed the two lines and kept just one example of the wind sentence, it went back to 5/5. Now examples are given only to the block being fixed, and the clear-day data is measured along with it.

In the weather data, too, a single column could not be trusted. That day's forecast gave a 54–100% chance of rain from 9 to 11 a.m., yet the weather code for the same hours was partly cloudy or clear, and precipitation was 0. The only rain code was at 8 a.m., a light drizzle of 0.1mm. By the probability column it was a rainy day; by the code column it was a clear day. The kind of rain is now chosen only from the hours that have a rain code among the hours when rain is possible, and if there are none, it just says "rain".

In short

  • Check the numbers in a table against a sum rather than a single column. With four joins and seven long pauses, start by finding where the extra three came from.
  • A measuring tool carries the guesses of whoever built it. The column made for commas could not hold the comma pauses, and the same-person score did not catch the difference the ear heard.
  • For what was heard by ear, first ask which seconds it was. I fixed three things without knowing the stretch, and only after hearing the stretch did I learn the cause was on the opposite side.
  • Write a reversed judgement where it was first written, too. I added a correction paragraph to the previous post, and also fixed that entry in the repository document, keeping the original sentence and the date it was corrected.

The first judgement is written up in Sentences That Worked on the Page Broke When Spoken.