There are two ways that can be used by speech recognition applications to provide recognized text to FAB Subtitler LIVE:
- By dictating directly into FAB Subtitler application
- By using the HTTP REST protocol over IP
Dictating directly into FAB Subtitler application
The speech interface which is integrated in FAB Subtitler LIVE was initially designed to work correctly with Dragon NaturallySpeaking speech recognition software. Other speech recognition programs may also work correctly with FAB Subtitler LIVE as long as they support dictating directly into any Windows application and they send the recognized text using the Windows message EM_REPLACESEL.
When the speech recognition software does not send the text using the message EM_REPLACESEL then dictating into the speech interface will probably still work. The only functionality that will probably not work correctly is always appending the recognized text at the end. This is a functionality that can be enabled in options for the speech interface.
Technical details
The speech recognition software send the recognized text to the speech Interface in FAB Subtitler LIVE by sending window messages which are then handled by the Subtitler’s editor window. The speech recognition software usually obtains the currently focused edit window to which it sends messages with the recognized text. The speech interface’s edit window class is ‘Edit_’ and is the same as the standard windows control class Edit for the Edit Control. The speech recognition software should send the text using the EM_REPLACESEL
When the speech recognition software works as described above this will enable text editing in the FAB speech interface while the recognized text is always appended at the end of the text. If the speech recognition software sends the recognized text in any other way and does not use the EM_REPLACESEL message, then the recognized text will probably be inserted at the cursor position.
Example of the code sending the text to the FAB Subtitler LIVE speech interface:
// find the editor control
editWnd := GetFocus;
if editWnd = 0 then
begin
editWnd := GetForegroundWindow;
if editWnd <> 0 then
begin
threadId := GetWindowThreadProcessId(editWnd, processId);
if AttachThreadInput(GetCurrentThreadId, threadId, True) then
begin
editWnd := GetFocus;
AttachThreadInput(GetCurrentThreadId, threadId, False);
end;
end;
end;
// check if it's an Edit control
GetClassName(editWnd, wndClass);
isEdit := (wndClass = 'Edit_') or (wndClass = 'Edit');
// send the message with text
if isEdit then
begin
SendMessage(editWnd, EM_REPLACESEL, 0, PWideChar('Hello.'));
SendMessage(editWnd, EM_REPLACESEL, 0, PWideChar(' How are you doing?'));
end
else
begin
// alternate method of sending text eg. WM_CHAR for sending each character at a time
end;
Using the HTTP REST protocol over IP
Any application can provide the recognized text to FAB Subtitler LIVE using the HTTP REST protocol. A HTTP GET or HTTP POST will work in the following way:
ip_address_of_fab_subtitler:8080/speechinterface?text=This text was recognized and contains some special characters ÄÖÜ.{2}This text is in a different color.
The HTTP DELETE command will delete the subtitle from the screen.
FAB Subtitler must be configured correctly so that HTTP REST calls will be processed and the speech interface window has to be open.
Special commands
The text received by the speech interface can contain special commands.
COMMAND | Description |
---|---|
{SEND} | Transmits all the text that was received previously |
{NL} | Adds a line break |
{1} | Changes the text color for the following text to color 1 |
{2} | Changes the text color for the following text to color 2 |
{3} | Changes the text color for the following text to color 3 |
{4} | Changes the text color for the following text to color 4 |
{5} | Changes the text color for the following text to color 5 |
{6} | Changes the text color for the following text to color 6 |
{7} | Changes the text color for the following text to color 7 |
{8} | Changes the text color for the following text to color 8 |