Developer guide

Updated at:

This topic describes the integration process for real-time recording and audio and video file recording.

Note

If you have technical questions about the product, you can contact us by joining the Tingwu consulting group on DingTalk. Search for group number 44604776.

Real-time recording

Usage notes

  • The supported input format is PCM (uncompressed PCM or WAV files) with a 16 bit audio bit depth and a mono sound channel.

  • Supported audio sampling rates are 16000 Hz and 8000 Hz.

  • The maximum duration for a single meeting is 24 hours.

  • You can configure the service to return intermediate transcription results.

  • The service supports recognition of Chinese, English, Cantonese, and mixed Chinese-English speech, including long segments of mixed languages.

  • You can set the target language for translation to Chinese, English, or both Chinese and English. This feature can be enabled or disabled during a meeting.

  • The service can synchronously transcode audio to the MP3 format with a bit rate of 128 kb/s. The transcoded audio is written to a specified OSS bucket in near real-time.

  • You can enable or disable valid audio segment detection and the saving of in-meeting transcription results. After the meeting, the service can intelligently extract keywords, key sentences, subtopics, and to-do items.

Interaction flow

image

Real-time recording

Step 1: Call the CreateMeetingTrans operation to create a real-time recording. This corresponds to steps 1-2 in the interaction flow.

Note

Transcription is managed at the meeting level. After you create a meeting, you can ingest the real-time audio stream and start transcription for that meeting.

Step 2: Call the GetMeetingTrans operation to query the status of the real-time recording. This corresponds to steps 18-19 in the interaction flow.

Step 3: Call the StopMeetingTrans operation to end the real-time recording. This corresponds to steps 20-22 in the interaction flow.

Note

After the recording ends, the service extracts intelligent minutes. A result notification is sent upon completion.

Real-time audio stream ingest

After you create the recording, you can use the Tingwu Java SDK or C++ SDK to ingest the real-time audio stream during the meeting and receive transcription results.

Step 1: Establish an ingest channel. This corresponds to steps 3-5 in the interaction flow.

Step 2: Push the audio for transcription. This corresponds to steps 6, 8, 10, and 12 in the interaction flow.

  • For offline meetings, you can use a single audio stream. The ingest input format is PCM.

  • For online meetings, you can use multiple audio streams. If you set the AudioPackage parameter to multi when you create the meeting, you must encapsulate the multiple audio streams in the Protobuf format that is defined by Tingwu. The encapsulation protocol is as follows:

syntax = "proto3";

message MultiAudioFrame {
    int32 frame_size = 1; // Audio duration of the packet, in milliseconds
    bytes mixed_data = 2; // Mixed audio packet, in PCM format
    repeated ActiveAudioFrame active_frame = 3; // Data of active channels
    int64 send_time = 4; // UNIX timestamp when the packet is sent, in milliseconds
}

message ActiveAudioFrame {
    bytes data = 2; // Speaker's data packet, in PCM format
    string speaker_id = 3; // Speaker ID from your service
}

Step 3: Receive transcription results. This corresponds to steps 7, 9, 11, and 13 in the interaction flow.

The client sends audio data in a loop and continuously receives transcription results:

  • SentenceBegin event

The SentenceBegin event indicates that the server-side has detected the start of a sentence. The Tingwu service uses its intelligent sentence segmentation feature to determine the start and end of a sentence. The following is an example.

{
	  "header": {
        "namespace": "SpeechTranscriber",
        "name": "SentenceBegin",
        "status": 20000000,
        "message_id": "a426f3d4618447519c9d85d1a0d1****",
        "task_id": "5ec521b5aa104e3abccf3d361822****",
        "status_text": "Gateway:SUCCESS:Success."
    },
    "payload": {
        "index": 0,
        "time": 0,
        "speaker_id": "User1"
    }
}

Parameter description:

Parameter

Type

Description

header

Object

Header information of the response.

namespace

String

The namespace to which the message belongs. The value is fixed to SpeechTranscriber.

name

String

The name of the message. SentenceBegin indicates the start of a sentence.

task_id

String

The GUID of the stream ingest task. Record this value for troubleshooting.

message_id

String

The ID of this message.

status

Integer

The status code. It indicates whether the request was successful. For more information, see Service status codes.

status_text

String

The status message.

payload

Object

The response payload.

index

Integer

The sentence number. The value increments from 0.

time

Integer

The duration of the audio that has been processed, in milliseconds.

speaker_id

String

The speaker corresponding to the transcription result. This parameter is not returned for single-channel or mixed-stream transcription.

  • TranscriptionResultChanged event

The TranscriptionResultChanged event indicates that the intermediate transcription result has changed. The following is an example.

{
    "header": {
        "namespace": "SpeechTranscriber",
        "name": "TranscriptionResultChanged",
        "status": 20000000,
        "message_id": "dc21193fada84380a3b6137875ab****",
        "task_id": "5ec521b5aa104e3abccf3d361822****",
        "status_text": "Gateway:SUCCESS:Success."
    },
    "payload": {
        "index": 0,
        "time": 1835,
        "result": "Beijing's sky",
        "words": [
            {
                "text": "Beijing",
                "startTime": 630,
                "endTime": 930
    	      },
            {
                "text": "'s",
                "startTime": 930,
                "endTime": 1110
            },
            {
                "text": "sky",
                "startTime": 1110,
                "endTime": 1140
            }
        ],
        "speaker_id": "User1"
    }
} 

Parameter description:

Parameter

Type

Description

header

Object

Header information of the response.

namespace

String

The namespace to which the message belongs. The value is fixed to SpeechTranscriber.

name

String

The name of the message. TranscriptionResultChanged indicates that the intermediate transcription result has changed.

task_id

String

The GUID of the stream ingest task. Record this value for troubleshooting.

message_id

String

The ID of this message.

status

Integer

The status code. It indicates whether the request was successful. For more information, see Service status codes.

status_text

String

The status message.

payload

Object

Response.

index

Integer

The sentence number. The value increments from 0.

time

Integer

The duration of the audio that has been processed, in milliseconds.

result

String

The current transcription result of the sentence.

words

List<Object>

The word information of the current sentence.

text

String

The text.

startTime

Integer

The start time of the word, in milliseconds.

endTime

Integer

The end time of the word, in milliseconds.

speaker_id

String

The speaker corresponding to the transcription result. This parameter is not returned for single-channel or mixed-stream transcription.

  • SentenceEnd event

The SentenceEnd event indicates that the server-side has detected the end of a sentence and returns the final transcription result for that sentence. The following is an example.

{
    "header": {
        "namespace": "SpeechTranscriber",
        "name": "SentenceEnd",
        "status": 20000000,
        "message_id": "c3a9ae4b231649d5ae05d4af36fd****",
        "task_id": "5ec521b5aa104e3abccf3d361822****",
        "status_text": "Gateway:SUCCESS:Success."
    },
    "payload": {
        "index": 0,
        "time": 1820,
        "begin_time": 0,
        "result": "Beijing's weather.",
        "words": [
            {
                "text": "Beijing",
                "startTime": 630,
                "endTime": 930
            },
            {
                "text": "'s",
                "startTime": 930,
                "endTime": 1110
            },
            {
                "text": "weather",
                "startTime": 1110,
                "endTime": 1380
            }
        ],
        "speaker_id": "User1"
    }
}

Parameter description:

Parameter

Type

Description

header

Object

Header information of the response.

namespace

String

The namespace to which the message belongs. The value is fixed to SpeechTranscriber.

name

String

The name of the message. SentenceEnd indicates the end of a sentence.

task_id

String

The GUID of the stream ingest task. Record this value for troubleshooting.

message_id

String

The ID of this message.

status

Integer

The status code. It indicates whether the request was successful. For more information, see Service status codes.

status_text

String

The status message.

payload

Object

The result that is returned.

index

Integer

The sentence number. The value increments from 0.

time

Integer

The duration of the audio that has been processed, in milliseconds.

result

String

The current transcription result of the sentence.

words

List<Object>

The word information of the current sentence.

text

String

The text.

startTime

Integer

The start time of the word, in milliseconds.

endTime

Integer

The end time of the word, in milliseconds.

speaker_id

String

The speaker corresponding to the transcription result. This parameter is not returned for single-channel or mixed-stream transcription.

  • ResultTranslated event

If translation is enabled, the ResultTranslated event indicates that the server-side has translated a transcription result into the target language. The following is an example.

{
    "header": {
        "namespace": "SpeechTranscriber",
        "name": "ResultTranslated",
        "status": 20000000,
        "message_id": "c3a9ae4b231649d5ae05d4af36fd****",
        "task_id": "5ec521b5aa104e3abccf3d361822****",
        "status_text": "Gateway:SUCCESS:Success.",
      	"source_message_id": "d4a9ae4b231649d5ae05d4af36fd****",
    },
    "payload": {
      	"speaker_id": "xxx",
        "source_lang": "cn",
        "target_lang": "en",
        "translate_result": [
          {
            "text": "At that time.",
            "index": 110,
            "beginTime": 123000,
            "endTime": 125000
          },
          {
            "text": "xxx",
            "index": 111,
            "partial": true
          }
        ]
    }
}

Parameter description:

Parameter

Type

Description

header

Object

Header information of the response.

namespace

String

The namespace to which the message belongs. The value is fixed to SpeechTranscriber.

name

String

The name of the message. ResultTranslated indicates a translated transcription result.

task_id

String

The GUID of the stream ingest task. Record this value for troubleshooting.

message_id

String

The ID of this message.

source_message_id

String

The message ID of the source transcription result for this translation.

status

Integer

The status code. It indicates whether the request was successful. For more information, see Service status codes.

status_text

String

The status message.

payload

Object

The operation returns the result.

speaker_id

String

The speaker ID corresponding to the transcription result. This is the same as the speaker ID passed in the Protobuf message during stream ingest. If this field is absent, it indicates a translation for single-channel or mixed-stream transcription.

source_lang

String

The source language of the translation.

target_lang

String

The target language of the translation.

translate_result

List<Object>

Information about the translated transcription result.

text

String

The translated text.

index

Integer

The number of the translated sentence. The value increments from 0.

partial

Boolean

If true, this is the translation result for content that is not from a SentenceEnd event.

beginTime

Integer

The start time of the translated sentence, in milliseconds. This is returned when translating a result from a SentenceEnd event.

endTime

Integer

The end time of the translated sentence, in milliseconds. This is returned when translating a result from a SentenceEnd event.

  • UpdateConfigAck event for in-recording configuration updates

After the client sends an UpdateConfig instruction, the Tingwu server-side returns an ACK message. The following is an example.

{
	  "header": {
        "namespace": "SpeechTranscriber",
        "name": "UpdateConfigAck",
        "status": 20000000,
        "message_id": "a426f3d4618447519c9d85d1a0d1****",
        "task_id": "5ec521b5aa104e3abccf3d361822****",
        "status_text": "Success."
    },
    "payload": {
        "instruction_id": "9d139c48057ee287e0efe7e*****",
        "error_code": "***",
        "error_message": "***"
    }
}

Parameter description:

Parameter

Type

Description

header

Object

Header information of the response.

namespace

String

The namespace to which the message belongs. The value is fixed to SpeechTranscriber.

name

String

The SentenceBegin message indicates the start of a sentence.

task_id

String

The GUID of the stream ingest task. Record this value for troubleshooting.

message_id

String

The ID of this message.

status

Integer

The status code. It indicates whether the request was successful. For more information, see Service status codes.

status_text

String

The status message.

payload

Object

The returned result.

instruction_id

String

The instruction ID. The value of instruction_id from the in-meeting UpdateConfig instruction is returned.

error_code

String

If the parameters of the in-meeting UpdateConfig instruction are abnormal, this field returns an error code.

error_message

String

If the parameters of the in-meeting UpdateConfig instruction are abnormal, this field returns an error description.

Step 4: Pause the stream ingest and transcription. This corresponds to steps 14-15 in the interaction flow.

  • Detection Completion Event

Parameter

Type

Description

header

Object

Header information of the response.

namespace

String

The namespace to which the message belongs. The value is fixed to SpeechTranscriber.

name

String

The name of the message. TranscriptionCompleted indicates that the stream ingest and transcription are complete. TaskFailed indicates that the stream ingest and transcription were interrupted by an exception.

task_id

String

The GUID of the stream ingest task. Record this value for troubleshooting.

message_id

String

The ID of this message.

status

Integer

The status code. It indicates whether the request was successful. For more information, see Service status codes.

status_text

String

The status message.

payload

Object

The result that is returned.

Step 5: Resume the stream ingest and transcription. This corresponds to steps 16-17 in the interaction flow.

  • If you set MeetingResultEnabled to true when you create the meeting, the service calculates the meeting time offset for resuming transcription based on the audio that has already been transcoded.

  • If you set MeetingResultEnabled to false when you create the meeting, you must set the meeting time offset for resuming transcription using the tw_time_offset parameter (in milliseconds) before you start pushing audio for transcription.

Result notifications

Step 1: Receive post-recording task processing event notifications. This corresponds to step 23 in the interaction flow.

If you set MeetingResultEnabled to true when you create the meeting, you will receive task status change events at the project webhook address that you configured in the console. The data format is as follows:

Parameter

Type

Description

Code

String

The status code.

Message

String

The status description.

Data

Object

The result object.

MeetingId

String

The meeting ID.

MeetingStatus

String

The meeting status.

NEW: New meeting.

ONGOING: Meeting transcription is in progress.

PAUSED: Meeting transcription is paused.

PRE_COMPLETE: Post-meeting intelligent extraction is in progress after transcription ends.

COMPLETED: The meeting is complete.

FAILED: Post-meeting intelligent extraction failed after transcription ended.

INVALID: Invalid meeting.

MeetingKey

String

The meeting identifier set when the user created the meeting.

Step 2: View the post-recording intelligent minutes result.

If you set MeetingResultEnabled to true when you create the meeting, you can retrieve the task processing result from the MeetingResultOssPath address that you set in the CreateMeetingTrans operation call. The JSON data structure is as follows:

Parameter

Type

Description

MeetingId

String

The meeting ID.

MeetingKey

String

The meeting identifier set when the user created the meeting.

AudioDuration

Integer

The duration of the transcribed audio, in milliseconds.

KeywordLabResults

List<Object>

Detailed information about the intelligently extracted keywords. The detailed structure of the Object in KeywordLabResults is described in (1) below.

KeySentenceLabResults

List<Object>

Detailed information about the intelligently extracted key sentences. The detailed structure of the Object in KeySentenceLabResults is described in (2) below.

TopicLabResults

List<Object>

Detailed information about the intelligently extracted subtopics. The detailed structure of the Object in TopicLabResults is described in (3) below.

ActionLabResults

List<Object>

Detailed information about the intelligently extracted to-do items. The detailed structure of the Object in ActionLabResults is described in (4) below.

KeywordSimpleLabResults

List<Object>

Overview of the intelligently extracted keywords. This is a concise list of keywords, simpler than the content in KeywordLabResults.

The detailed structure of the Object in KeywordSimpleLabResults is described in (1) below.

AudioSegments

List<List<Integer>>

The ranges of valid audio segments. Example:

[

[480,4410], // The interval from 480 ms to 4410 ms is a valid audio segment

[4930,9830], // The interval from 4930 ms to 9830 ms is a valid audio segment

......

]

DocResult

Object

The speech-to-text result.

sc

List<Object>

segment content, an array of segments.

tc

String

The text of the segment, at the word level.

id

Integer

The segment ID.

si

Integer

The ordinal number of the sentence ID for the segment.

bt

Integer

The start timestamp of the segment relative to the audio, in milliseconds.

et

Integer

The end timestamp of the segment relative to the audio, in milliseconds.

ui

String

The user ID.

(1) The data structure of the Object in KeywordLabResults and KeywordSimpleLabResults is as follows:

Parameter

Type

Description

value

String

The content of the keyword.

(2) The data structure of the Object in KeySentenceLabResults and TopicLabResults.titleKeySentences is as follows:

Parameter

Type

Description

value

String

The content of the key sentence.

bt

Integer

The start timestamp of the key sentence relative to the audio, in milliseconds.

et

Integer

The end timestamp of the key sentence relative to the audio, in milliseconds.

si

List<Integer>

The ordinal numbers of the sentence IDs associated with the key sentence.

(3) The data structure of the Object in TopicLabResults is as follows:

Parameter

Type

Description

value

String

The content of the subtopic.

bt

Integer

The start timestamp of the subtopic relative to the audio, in milliseconds.

et

Integer

The end timestamp of the subtopic relative to the audio, in milliseconds.

si

List<Integer>

The ordinal numbers of the sentence IDs associated with the subtopic. The first value is the ID of the start sentence, and the second value is the ID of the end sentence.

topicId

Integer

The ordinal number of the subtopic.

titleKeySentences

List<Object>

A list of key sentences associated with the subtopic. The detailed structure of the Object in titleKeySentences is described in (2) above.

qaPairs

List<Object>

A list of Q&A pairs within a topic.

The detailed structure of the Object in qaPairs is described in (5) below.

(4) The data structure of the Object in ActionLabResults is as follows:

Parameter

Type

Description

value

String

The content of the to-do item.

bt

Integer

The start timestamp of the to-do item relative to the audio, in milliseconds.

et

Integer

The end timestamp of the to-do item relative to the audio, in milliseconds.

si

List<Integer>

The ordinal numbers of the sentence IDs associated with the to-do item.

(5) The data structure of the Object in qaPairs is as follows:

Parameter

Type

Description

questionSentenceIds

List<Integer>

A list of sentence IDs for the question in the Q&A pair.

answerSentenceIds

List<Integer>

A list of sentence IDs for the answer in the Q&A pair.

Audio and video file recording

Usage notes

  • Supported audio formats include MP3, WAV, M4A, WMA, AAC, OGG, AMR, FLAC, and MP4.

  • The file size cannot exceed 4 GB.

  • The audio duration cannot exceed 4 hours.

  • Supported audio sampling rates are 8 kHz, 16 kHz, 24 kHz, and 48 kHz.

  • The recording files to be transcribed must be stored in an OSS bucket that you have authorized Tingwu to access.

  • Supported invocation methods are polling and callbacks.

  • The service supports recognition of Chinese, English, Cantonese, and mixed Chinese-English speech, including long segments of mixed languages.

Interaction flow

image

Task management

Step 1: Call the CreateFileTrans operation to create a file recording task. This corresponds to steps 3-4 in the interaction flow.

Step 2: Call the GetFileTrans operation to query the status of the file recording task. This corresponds to steps 5-6 in the interaction flow.

Result notifications

Step 1: Receive task processing event notifications. This corresponds to step 10 in the interaction flow.

You can receive transcription completion events at the project webhook address that you configured in the console. To configure the address, go to the console, create a project, and select the callback method. The data format is as follows:

Parameter

Type

Description

Code

String

The status code.

Message

String

The status description.

Data

Object

Returns an object.

TransId

String

The task ID.

TransStatus

String

The task status.

ONGOING: The task is in progress.

COMPLETED: The task is complete.

FAILED: The task failed.

INVALID: Invalid task.

TransKey

String

The task identifier set when the user created the task.

Step 2: View the task processing result. This corresponds to steps 11-12 in the interaction flow.

You can retrieve the task processing result from the TransResultOssPath address that you set in the CreateFileTrans operation call. The JSON data structure is as follows:

Parameter

Type

Description

TransId

String

The transcription ID.

TransKey

String

The transcription identifier. This is the same as the request parameter.

AudioSize

Integer

The file size, in bytes.

AudioDuration

Integer

The duration of the transcribed audio, in milliseconds.

DocResult

Object

The speech-to-text result.

pg

List<Object>

An array of paragraphs.

pi

String

paragraph id. The paragraph ID.

ui

String

The user ID.

sc

List<Object>

segment content, an array of segments.

tc

String

The text of the segment, at the word level.

id

Integer

The segment ID.

si

Integer

The ordinal number of the sentence ID for the segment.

bt

Integer

The start timestamp of the segment relative to the audio, in milliseconds.

et

Integer

The end timestamp of the segment relative to the audio, in milliseconds.

KeywordLabResults

List<Object>

Detailed information about the intelligently extracted keywords. The detailed structure of the Object in KeywordLabResults is described in (1) below.

KeySentenceLabResults

List<Object>

Detailed information about the intelligently extracted key sentences. The detailed structure of the Object in KeySentenceLabResults is described in (2) below.

TopicLabResults

List<Object>

Detailed information about the intelligently extracted subtopics. The detailed structure of the Object in TopicLabResults is described in (3) below.

ActionLabResults

List<Object>

Detailed information about the intelligently extracted to-do items. The detailed structure of the Object in ActionLabResults is described in (4) below.

KeywordSimpleLabResults

List<Object>

Overview of the intelligently extracted keywords. This is a concise list of keywords, simpler than the content in KeywordLabResults.

The detailed structure of the Object in KeywordSimpleLabResults is described in (1) below.

(1) The data structure of the Object in KeywordLabResults and KeywordSimpleLabResults is as follows:

Parameter

Type

Description

value

String

The content of the keyword.

(2) The data structure of the Object in KeySentenceLabResults and TopicLabResults.titleKeySentences is as follows:

Parameter

Type

Description

value

String

The content of the key sentence.

bt

Integer

The start timestamp of the key sentence relative to the audio, in milliseconds.

et

Integer

The end timestamp of the key sentence relative to the audio, in milliseconds.

si

List<Integer>

The ordinal numbers of the sentence IDs associated with the key sentence.

(3) The data structure of the Object in TopicLabResults is as follows:

Parameter

Type

Description

value

String

The content of the subtopic.

bt

Integer

The start timestamp of the subtopic relative to the audio, in milliseconds.

et

Integer

The end timestamp of the subtopic relative to the audio, in milliseconds.

si

List<Integer>

The ordinal numbers of the sentence IDs associated with the subtopic. The first value is the ID of the start sentence, and the second value is the ID of the end sentence.

topicId

Integer

The ordinal number of the subtopic.

titleKeySentences

List<Object>

A list of key sentences associated with the subtopic. The detailed structure of the Object in titleKeySentences is described in (2) above.

qaPairs

List<Object>

A list of Q&A pairs within a topic.

The detailed structure of the Object in qaPairs is described in (5) below.

(4) The data structure of the Object in ActionLabResults is as follows:

Parameter

Type

Description

value

String

The content of the to-do item.

bt

Integer

The start timestamp of the to-do item relative to the audio, in milliseconds.

et

Integer

The end timestamp of the to-do item relative to the audio, in milliseconds.

si

List<Integer>

The ordinal numbers of the sentence IDs associated with the to-do item.

(5) The data structure of the Object in qaPairs is as follows:

Parameter

Type

Description

questionSentenceIds

List<Integer>

A list of sentence IDs for the question in the Q&A pair.

answerSentenceIds

List<Integer>

A list of sentence IDs for the answer in the Q&A pair.