2017년 2월 5일 일요일

MS의 SpVoice를 임포트하여 글 읽어 주기를 구현했네요.

목소리가 별로 네요... 예전에 구글 API 이용 했었는데 그걸로 돌아 갈까....
음성을 선택 할 수 있는데 별반 차이가 없네요.

procedure TfrmStudyLaw2.FormCreate(Sender: TObject);
var
FileName: String;
SOTokenVoice: ISpeechObjectToken;
SOTokenVoices: ISpeechObjectTokens;
....
begin
// speech
SpVoice1.EventInterests:= SVEAllEvents;
SOTokenVoices:= SpVoice1.GetVoices('','');
for i := 0 to SOTokenVoices.Count-1 do begin
SOTokenVoice:= SOTokenVoices.Item(i);
ComboBoxVoices.Items.AddObject(SOTokenVoice.GetDescription(0), TObject(SOTokenVoice));
SOTokenVoice._AddRef;
end;
if ComboBoxVoices.Items.Count > 0 then begin
ComboBoxVoices.ItemIndex := ComboBoxVoices.Items.IndexOf(SpVoice1.Voice.GetDescription(0))
end;
end.


procedure TfrmStudyLaw2.Button5Click(Sender: TObject);
const iSpeechFlags: integer = SVSFlagsAsync + SVSFPurgeBeforeSpeak + SVSFIsXML;
var
idx, jdx, kdx: Integer;
begin
SpVoice1.Rate:= tbRate.Position;
for idx := 0 to SpinEdit1.Value-1 do begin
if CBStopSpeechA.Checked then Break;
for jdx := 0 to ListBox1.Items.Count-1 do begin
if CBStopSpeechA.Checked then Break;
if ListBox1.Checked[jdx] then
for kdx := 0 to SpinEdit2.Value-1 do begin
if CBStopSpeech1.Checked then Break;
SpVoice1.Speak(ListBox1.Items[jdx],iSpeechFlags);
repeat
Application.ProcessMessages;
until (SpVoice1.WaitUntilDone(10));
end;
CBStopSpeech1.Checked:= False;
end;
end;
CBStopSpeechA.Checked:= False;
end;

tensorflow gpu 사용하기에서

 tensorflow 설치시 주의해야 한다. # Anything above 2.10 is not supported on the GPU on Windows Native python - m pip install "tensorflow<2.11...