Based on stm32 IoT development board (3)--SYN6288 voice module

Based on stm32 IoT development board (3) - SYN6288 voice module

1. SYN6288 voice module demonstration example

SYN6288 voice module

2. Overview

  SYN6288-A speech synthesis module is a mid-to-high-end speech synthesis technology with higher cost performance and more natural effect. SYN6288-A receives the text to be synthesized through the asynchronous serial port, and realizes the conversion of text to sound (TTS).
  The launch of SYN6288-A, the first speech synthesis evaluation board in China, inherits the excellent features of OSYNO6188-A module: the smallest size, simple hardware interface, and high cost performance; in addition, SYN6288-A text recognition is more intelligent, speech synthesis is more Naturally, the effects of speech synthesis and intelligent recognition have been greatly improved, and it is a speech synthesis technology for mid-to-high-end applications.

2.1 Product application scope

◆ Vehicle-mounted information terminal voice broadcast, vehicle dispatching, vehicle navigation
◆ Bus station announcement device, attendance machine ◆
Queuing call machine, cashier toll machine
◆ Vending machine, information machine, POS machine
◆ Smart toys, smart
watches ◆ Electric bicycles
◆ Voice E-book, color screen story book, audio electronic dictionary, audio electronic guide
◆ short message playback, news playback
◆ electronic map

insert image description here
insert image description here

  • Hardware interface:
pin illustrate
TXD Send data pin PA3
RXD Receive data pin PA2
BUSY Busy signal detection pin PC5, high level means busy

3. Communication protocol

  The SYN6288 module adopts the serial port communication method, and the data format is as follows: the
  default baud rate is 9600, 1 start bit, 8 data bits, 1 stop bit, no parity bit, and no hardware flow control.

3.1 Command frame format

  The chip supports the following command frame format: "frame header FD + data area length + data area" format. (Maximum 206 bytes) All commands and data sent by the host computer to the SYN6288-A module need to be encapsulated and transmitted in the form of "frame".
insert image description here

  • Data length: command word + command parameter + data content + check value;
  • Check value: the total number of bytes starting from the frame header;
  • In the same frame of data, the direct sending interval of each byte cannot exceed 8ms, and the direct sending interval of data frames must exceed 8ms;
  • The default initial baud rate is 9600bps; if you need to change the baud rate, you need to send other command frames at an interval of 16 milliseconds after sending the command frame for setting the baud rate.
  • Both 9600bps and 19200bps baud rate communication transmissions are very stable (no matter the chip is synthesizing broadcasting or idle).
  • When the module is synthesizing text, if it receives another effective synthesis command frame, the chip will immediately stop the text currently being synthesized and synthesize the newly received text instead.
  • The length of the text to be sent must be less than or equal to 200 bytes. If the actual sent length is greater than 200 bytes, the chip will report failure to receive.

3.2 Description of control commands

insert image description here

3.3 Data frame example

  (1) Example without background sound
insert image description here
  (2) Example with background sound
insert image description here
  (3) Volume setting
insert image description here
  (4) Baud rate setting
insert image description here
  (5) Stop synthesis command
insert image description here
  (6) Resume synthesis command
insert image description here
  (7) Status query command
insert image description here

3.4 Text control tags

insert image description here

  • illustrate:

  ① All control signs are half-width characters.
  ② The control flag needs to be sent in the format of the speech synthesis command, and the special control mark is synthesized as text, that is, the synthesis command is in the format of "frame header + data area length + synthesized command word + text encoding format + special control mark text".
  ③ The control flag is a global control flag, that is, as long as it is used once, all text sent to the chip will be under its control unless the corresponding [d] is used to restore it. default setting.
  ④ When the chip is powered off or reset, the chip will return to all default values, and the original set flags will lose their effect and need to be reset.
  ⑤ Those that do not conform to the above recognizable "control marks" or have incorrect formats shall be treated as ordinary characters and numbers.

3.5 Prompt sound effect

  The chip provides 25 segments of sound prompts, which can be selected as information prompts according to the application occasion. The following list is the name and sound type of the built-in prompt sound of the current chip:
insert image description here

3.6 List of chord prompts

  The chip provides 23 pieces of polyphonic music as prompts, which can be widely used in public information broadcasting occasions. The following list is the name and playing length of the current built-in prompts of the chip.
insert image description here
  Polyphonic ringtones can be used as polyphonic ringtones as well as background music material.
  Note: There is no particularity in the use of the prompt tone, which is the same as the synthesis command for synthesizing ordinary text. However, it should be noted that when there are English letters before or after the name of the prompt sound, punctuation marks, spaces, carriage returns, etc. need to be used to separate it from other letters, so that the chip can automatically recognize it. For example, if you send the text "sounda, hello!", sounda can synthesize the corresponding SMS prompt tone, but if you send the text "soundahello!", sounda cannot synthesize the prompt tone, but directly read the letter "SOUNDA".

3.7 Data frame combination example

/*
函数功能:SYN6288语音播报(单条语音不超过206字节)
形参:str --播放语音
      cmd --命令(0~15)0为无背景,1~15为背景音
      vol --音量(0~16)0为静音,16为最大音量
公司:北京万邦易嵌
作者:IT_阿水
*/
void SYN6288_SendData(uint8_t *str,int cmd,int vol)
{
    
    
  uint8_t dat_xor=0;
  uint8_t buffer[206];
  uint16_t i=0;
  char temp[10];
  int j=0;
  int str_len=0;
  SYN6288_GetStat();
  Delay_Ms(10);

  /*音量设置*/
  str_len=snprintf(temp,sizeof(temp),"[v%d]",vol&0x1f);
  uint16_t len=strlen((char *)str);//发送是内容长度
  str_len+=len;
  str_len+=3;//加上命令字,命令参数和校验值

  buffer[i]=0xFD;//帧头
  dat_xor^=buffer[i++];
  /*数据长度,两个字节,,高位在前*/
  buffer[i]=(str_len>>8)&0xff;
  dat_xor^=buffer[i++];
  buffer[i]=str_len&0xff; 
  dat_xor^=buffer[i++];
  
  buffer[i]=0x01;//语音合成播放命令
  dat_xor^=buffer[i++]; 
  
  buffer[i]=((cmd&0xf)<<3)|0;//命令参数
  dat_xor^=buffer[i++];
  
  j=0;
  while(temp[j]!='\0')
  {
    
    
    buffer[i++]=temp[j];
    dat_xor^=temp[j++];
  }
  for(j=0;j<len;j++)
  {
    
    
    buffer[i++]=str[j];
    dat_xor^=str[j];
  }
  buffer[i++]=dat_xor;
  USARTx_SendData(&huart2,buffer,i);
  Delay_Ms(10);//8ms以上的间隔时间
}

Guess you like

Origin blog.csdn.net/weixin_44453694/article/details/130693864