FMUSER更轻松地传输视频和音频!

[电子邮件保护] WhatsApp的+ 8618078869184
语言

    如何设计带有以太网的数字语音广播系统?

     

    This article provides an embedded Ethernet digital voice broadcasting system solution, which can easily realize the regional broadcasting function of the broadcasting system.本文提供了一种嵌入式以太网数字语音广播系统解决方案,可以轻松实现广播系统的区域广播功能。 The system is based on the arm architecture and adopts the method of system playback terminal arbitration to control the realization of regional broadcast, and the broadcast content can be played and saved simultaneously.该系统基于arm架构,采用系统回放终端仲裁的方法来控制区域广播的实现,广播内容可以同时播放和保存。

    ,或者在服务器端建立一个复杂的映射表,以维持播放终端的状态来实现区域广播,实现起来更加复杂。

    1结构设计

    该系统采用C / S结构,由广播系统服务器端和广播系统广播终端两部分组成,如图1所示。

    The server of the broadcast system is implemented on a PC, and it is a program of voice signal collection, storage, and network transmission realized by VC++.广播系统的服务器是在PC上实现的,它是通过VC ++实现的语音信号收集,存储和网络传输程序。 This part collects and stores the voice signal through a microphone, and then transmits the voice data to the Ethernet via UDP to realize the network transmission function of voice data.该部分通过麦克风收集并存储语音信号,然后通过UDP将语音数据传输到以太网,以实现语音数据的网络传输功能。

    广播系统回放终端是基于LM3S8962的嵌入式终端,可以接收从以太网发送给它的IP语音数据包,音频解码芯片MS6336完成语音数据的数字/模拟转换和回放。

    2广播系统广播终端的硬件设计

    The main control chip of the broadcast system broadcast terminal adopts the microcontroller LM3S8962 provided by LuminaryMicro.广播系统广播终端的主控芯片采用LuminaryMicro提供的微控制器LM3SXNUMX。 This series of chips is the first ARM CortexTM-MXNUMX-based controller with an internal integrated Ethernet controller.该系列芯片是第一个基于ARM CortexTM-MXNUMX的控制器,具有内部集成的以太网控制器。 It is the industry's first ARM chip that supports Industrial Ethernet (IEEE) and can easily implement network functions.它是业界第一个支持工业以太网(IEEE)并可以轻松实现网络功能的ARM芯片。

    MS6336控制接口采用I16C总线,该接口易于设置。 DAC部分具有准确和稳定的电流,再加上出色的对称解码方法,可以再现高质量的音频信号。

    LM3S8962为音频解码器芯片MS45提供控制信号和语音数据信号。 LM3S8962支持I6336C功能。 PB3和PB8962端口分别提供I2C时钟和数据信号。 LM2S3不支持MS2要求的数据输入格式。 The data input format of MS2 in the system adopts I6336S.系统中MS3的数据输入格式采用I8962S。 Therefore, to provide voice data to MS6336, it is necessary to use GPIO port software of LM6336S2 to simulate the I6336S data input format required by MS3.因此,要向MS8962提供语音数据,必须使用LM2S6336的GPIO端口软件来模拟MS5所需的I6S数据输入格式。 In the design, PA7, PA2, and PA2 ports are used to simulate this function.在设计中,PA6336,PAXNUMX和PAXNUMX端口用于模拟此功能。 The three pins correspond to the IXNUMXS channel selection signal, clock signal and data signal respectively.这三个引脚分别对应于IXNUMXS通道选择信号,时钟信号和数据信号。 Connect these three pins to the IXNUMXS function pin of MSXNUMX.将这三个引脚连接到MSXNUMX的IXNUMXS功能引脚。

    以太网数字语音广播系统的回放终端的硬件结构如图2所示。

    3广播系统软件设计

    广播系统软件分为两部分:广播系统服务器软件和广播终端软件。

    This design realizes the real-time playback of voice data, so the real-time performance of voice data transmission is required to be guaranteed, but the requirements for data integrity are not too strict, and a small amount of packet loss will not affect the overall playback effect, so the voice data of the system The transmission adopts UDP transmission mode.该设计实现了语音数据的实时回放,因此需要保证语音数据传输的实时性能,但对数据完整性的要求不是太严格,少量的丢包不会影响语音数据的传输。总体播放效果好,所以系统的语音数据传输采用UDP传输方式。 At the same time, the system works in the local area network and there are few temporary users.同时,该系统可在局域网中运行,并且临时用户很少。 Therefore, the static IP address allocation is adopted to simplify the realization of the playback terminal software.因此,采用静态IP地址分配来简化回放终端软件的实现。

    3.1在广播系统服务器端收集,存储和传输语音数据

    The collection of voice data is implemented using low-level WAVE audio API functions.语音数据的收集是使用低级WAVE音频API函数实现的。 In order not to cause the loss of voice data, the design uses double buffering to store voice data.为了不造成语音数据丢失,该设计使用双缓冲来存储语音数据。 The implementation process is shown in Figure 3.实现过程如图XNUMX所示。

    When one recording buffer is full, the system immediately sends another recording buffer to the recording device to continue recording, and the application program should read the data in the full recording buffer and process it.当一个记录缓冲区已满时,系统会立即将另一个记录缓冲区发送到记录设备以继续记录,并且应用程序应读取已满记录缓冲区中的数据并进行处理。 Then call the waveInAddBuffer function to re-assign the buffer to the recording device for recycling.然后,调用waveInAddBuffer函数将缓冲区重新分配给记录设备以进行回收。

    In order to prevent the loss of voice data in the recording process, it is not enough to simply use double buffering.为了防止在录制过程中丢失语音数据,仅使用双重缓冲是不够的。 It should also be noted that when one buffer is full, the application will process the data in the buffer and the second The buffer is used for recording, and the data processing time must be less than the time required for the second buffer to be fully recorded, otherwise the first buffer has not been re-assigned to the recording device after the second buffer is full, which will cause Loss of voice data.还应注意的是,当一个缓冲区已满时,应用程序将处理该缓冲区中的数据,而第二个缓冲区将被使用。该缓冲区用于记录,并且数据处理时间必须小于第二个缓冲区已满的时间录音,否则在第二个缓冲区已满后,第一个缓冲区尚未重新分配给录音设备,这将导致语音数据丢失。 When the sample rate of the voice signal is large, increasing the size of the buffer appropriately can effectively solve this problem.当语音信号的采样率较大时,适当增加缓冲区的大小可以有效地解决此问题。

    WAV文件具有固定的标头格式。 Before saving voice data, you need to set the header of the WAV file, otherwise the saved WAV file cannot be played.保存语音数据之前,需要设置WAV文件的标题,否则无法播放保存的WAV文件。 Every time the recording buffer is full, first find the end of the WAV file, and then write the collected data at the end of the file in turn.每次记录缓冲区已满时,首先找到WAV文件的结尾,然后将收集的数据依次写入文件的结尾。 When the entire broadcast process is over, all the voice data are saved in the WAV file, realizing the storage of voice data.整个广播过程结束后,所有语音数据都保存在WAV文件中,从而实现了语音数据的存储。

    When a recording buffer is full, it is necessary to send the collected voice data through the network.当记录缓冲区已满时,有必要通过网络发送收集的语音数据。 In the design, first use the Csocket class to create a socket, and then only need to encapsulate the collected data into an IP packet and send it out.在设计中,首先使用Csocket类创建一个套接字,然后只需要将收集的数据封装到IP数据包中并发送出去。 The sampling rate of the voice signal in this design is 44.1 kHz, 16-bit dual-channel.此设计中语音信号的采样率为1024 kHz,XNUMX位双通道。 In order to avoid the loss of voice data, the size of the recording buffer is set to XNUMXB.为了避免语音数据丢失,将记录缓冲区的大小设置为XNUMXB。

    3.2实现区域广播

    An important application of the Ethernet digital voice broadcasting system is not only to realize the whole area broadcasting, but also to realize the local broadcasting function, that is, to broadcast to the designated terminal.以太网数字语音广播系统的重要应用不仅是实现全区域广播,而且是实现本地广播功能,即向指定终端广播。 Therefore, the UDP multicast packet is used for data transmission in the network transmission of voice IP data packets.因此,UDP多播分组用于语音IP数据分组的网络传输中的数据传输。 Using multicast packets to transmit data, all terminals included in the group in the local area network can receive the data, realizing the whole area broadcast.使用组播数据包传输数据,局域网中组中包含的所有终端都可以接收数据,从而实现了整个区域的广播。 In order to realize the local broadcast function, a structure is added in front of the voice data in the design, as shown below, and a configuration file is used to store the IP address of each terminal of the system.为了实现本地广播功能,在设计中在语音数据之前添加了一个结构,如下所示,并使用一个配置文件存储系统每个终端的IP地址。

    02广播系统广播终端硬件设计

    The main control chip of the broadcast system broadcast terminal adopts the microcontroller LM3S8962 provided by LuminaryMicro.广播系统广播终端的主控芯片采用LuminaryMicro提供的微控制器LM3SXNUMX。 This series of chips is the first ARM CortexTM-MXNUMX-based controller with an internal integrated Ethernet controller.该系列芯片是第一个基于ARM CortexTM-MXNUMX的控制器,具有内部集成的以太网控制器。 It is the industry's first ARM chip that supports Industrial Ethernet (IEEE) and can easily implement network functions.它是业界第一个支持工业以太网(IEEE)并可以轻松实现网络功能的ARM芯片。

    MS6336控制接口采用I16C总线,该接口易于设置。 DAC部分具有准确和稳定的电流,再加上出色的对称解码方法,可以再现高质量的音频信号。

    LM3S8962为音频解码器芯片MS45提供控制信号和语音数据信号。 LM3S8962支持I6336C功能。 PB3和PB8962端口分别提供I2C时钟和数据信号。 LM2S3不支持MS2要求的数据输入格式。 The data input format of MS2 in the system adopts I6336S.系统中MS3的数据输入格式采用I8962S。 Therefore, to provide voice data to MS6336, it is necessary to use GPIO port software of LM6336S2 to simulate the I6336S data input format required by MS3.因此,要向MS8962提供语音数据,必须使用LM2S6336的GPIO端口软件来模拟MS5所需的I6S数据输入格式。 In the design, PA7, PA2, and PA2 ports are used to simulate this function.在设计中,PA6336,PAXNUMX和PAXNUMX端口用于模拟此功能。 The three pins correspond to the IXNUMXS channel selection signal, clock signal and data signal respectively.这三个引脚分别对应于IXNUMXS通道选择信号,时钟信号和数据信号。 Connect these three pins to the IXNUMXS function pin of MSXNUMX.将这三个引脚连接到MSXNUMX的IXNUMXS功能引脚。

    以太网数字语音广播系统的回放终端的硬件结构如图2所示。

     

    3广播系统软件设计

    广播系统软件分为两部分:广播系统服务器软件和广播终端软件。

    This design realizes the real-time playback of voice data, so the real-time performance of voice data transmission is required to be guaranteed, but the requirements for data integrity are not too strict, and a small amount of packet loss will not affect the overall playback effect, so the voice data of the system The transmission adopts UDP transmission mode.该设计实现了语音数据的实时回放,因此需要保证语音数据传输的实时性能,但对数据完整性的要求不是太严格,少量的丢包不会影响总体播放效果好,所以系统的语音数据传输采用UDP传输方式。 At the same time, the system works in a local area network with fewer temporary users.同时,该系统可在具有较少临时用户的局域网中工作。 Therefore, static IP address allocation is adopted to simplify the realization of the playback terminal software.因此,采用静态IP地址分配来简化回放终端软件的实现。

    3.1在广播系统服务器端收集,存储和传输语音数据

    The collection of voice data is implemented using low-level WAVE audio API functions.语音数据的收集是使用低级WAVE音频API函数实现的。 In order not to cause the loss of voice data, the design uses double buffering to store voice data.为了不造成语音数据丢失,该设计使用双缓冲来存储语音数据。 The implementation process is shown in Figure 3.实现过程如图XNUMX所示。

     

    When one recording buffer is full, the system immediately sends another recording buffer to the recording device to continue recording, and the application program should read the data in the full recording buffer and process it.当一个记录缓冲区已满时,系统会立即将另一个记录缓冲区发送到记录设备以继续记录,并且应用程序应读取已满记录缓冲区中的数据并进行处理。 Then call the waveInAddBuffer function to re-assign the buffer to the recording device for recycling.然后,调用waveInAddBuffer函数将缓冲区重新分配给记录设备以进行回收。

    In order to prevent the loss of voice data in the recording process, it is not enough to simply use double buffering.为了防止在录制过程中丢失语音数据,仅使用双重缓冲是不够的。 It should also be noted that when one buffer is full, the application will process the data in the buffer and the second The buffer is used for recording, and the data processing time must be less than the time required for the second buffer to be fully recorded, otherwise the first buffer has not been re-assigned to the recording device after the second buffer is full, which will cause Loss of voice data.还应注意的是,当一个缓冲区已满时,应用程序将处理该缓冲区中的数据,而第二个缓冲区将被使用。该缓冲区用于记录,并且数据处理时间必须小于第二个缓冲区已满的时间录音,否则在第二个缓冲区已满后,第一个缓冲区尚未重新分配给录音设备,这将导致语音数据丢失。 When the sample rate of the voice signal is large, increasing the size of the buffer appropriately can effectively solve this problem.当语音信号的采样率较大时,适当增加缓冲区的大小可以有效地解决此问题。

    WAV文件具有固定的标头格式。 Before saving voice data, you need to set the header of the WAV file, otherwise the saved WAV file cannot be played.保存语音数据之前,需要设置WAV文件的标题,否则无法播放保存的WAV文件。 Every time the recording buffer is full, first find the end of the WAV file, and then write the collected data at the end of the file in turn.每次记录缓冲区已满时,首先找到WAV文件的结尾,然后将收集的数据依次写入文件的结尾。 When the entire broadcast process is over, all the voice data are saved in the WAV file, realizing the storage of voice data.整个广播过程结束后,所有语音数据都保存在WAV文件中,从而实现了语音数据的存储。

    When a recording buffer is full, it is necessary to send the collected voice data through the network.当记录缓冲区已满时,有必要通过网络发送收集的语音数据。 In the design, first use the Csocket class to create a socket, and then only need to encapsulate the collected data into an IP packet and send it out.在设计中,首先使用Csocket类创建一个套接字,然后只需要将收集的数据封装到IP数据包中并发送出去。 The sampling rate of the voice signal in this design is 44.1 kHz, 16-bit dual-channel.此设计中语音信号的采样率为1024 kHz,XNUMX位双通道。 In order to avoid the loss of voice data, the size of the recording buffer is set to XNUMXB.为了避免语音数据丢失,将记录缓冲区的大小设置为XNUMXB。

    3.2实现区域广播

    An important application of the Ethernet digital voice broadcasting system is not only to realize the whole area broadcasting, but also to realize the local broadcasting function, that is, to broadcast to the designated terminal.以太网数字语音广播系统的重要应用不仅是实现全区域广播,而且是实现本地广播功能,即向指定终端广播。 Therefore, the UDP multicast packet is used for data transmission in the network transmission of voice IP data packets.因此,UDP多播分组用于语音IP数据分组的网络传输中的数据传输。 Using multicast packets to transmit data, all terminals included in the group in the local area network can receive the data, realizing the whole area broadcast.使用组播数据包传输数据,局域网中组中包含的所有终端都可以接收数据,从而实现了整个区域的广播。 In order to realize the local broadcast function, a structure is added in front of the voice data in the design, as shown below, and a configuration file is used to store the IP address of each terminal of the system.为了实现本地广播功能,在设计中在语音数据之前添加了一个结构,如下所示,并使用一个配置文件存储系统每个终端的IP地址。

    结构STRING

    {字符串IPNO1;

    字符串IPNO2;

    ...

    字符串IPNO9;

    字符串IPNO10};

    When it is necessary to perform regional broadcasting on certain terminals, select the corresponding numbers of these terminals on the panel of the server side of the broadcasting system (as shown in Figure 4).当需要在某些终端上进行区域广播时,请在广播系统服务器端的面板上选择这些终端的相应编号(如图XNUMX所示)。 At this time, the IP address of the selected terminal is read from the configuration file and assigned to the corresponding variable in the structure.此时,将从配置文件中读取所选终端的IP地址,并将其分配给结构中的相应变量。 When the terminal receives an IP multicast packet, it first judges whether the structure has the same variable as its own IP address, if there is, then the data is received and played, if not, the data is discarded, thus realizing the area Broadcast function.当终端接收到一个IP组播数据包时,首先判断该结构是否具有与其自身IP地址相同的变量,如果存在,则接收并播放数据,否则将数据丢弃,从而实现广播区域。功能。 Compared with the method of using a control signal to control the playback terminal to join or leave the multicast group, or to dynamically maintain a complex mapping table to implement the regional broadcast function.与使用控制信号控制回放终端加入或退出组播组,或者动态维护复杂的映射表来实现区域广播功能的方法相比。 This method does not need to interactively control the playback terminal before each broadcast, nor does it need to dynamically track the state of the terminal.此方法无需在每次广播之前交互式地控制回放终端,也不需要动态跟踪终端的状态。 It only needs to write the terminal's corresponding IP address into the configuration file when the terminal joins the system for the first time.终端首次加入系统时,只需将终端的对应IP地址写入配置文件即可。 The function is simple to implement .该函数易于实现。

    3.3广播系统广播终端软件的实现

    The broadcast system broadcast terminal is divided into two parts to realize, the audio data receiving part is used to receive the voice data and store and forward, and the audio decoder realizes the D/A conversion and playback of the voice signal.广播系统广播终端分为两部分来实现,音频数据接收部分用于接收语音数据并进行存储和转发,音频解码器实现语音信号的D / A转换和回放。 The audio data receiving part adopts Socket programming to receive voice data from the Ethernet.音频数据接收部分采用Socket编程,从以太网接收语音数据。 After receiving the voice data packet, it must first judge whether the data packet is for itself.收到语音数据包后,必须首先判断该数据包是否适合自己。 The terminal compares the member variable of the structure struct STRING in the IP packet with its own IP address, and if any member variable is equal to its own IP address, it stores the data in the packet, otherwise discards it.终端将IP数据包中结构STRING的成员变量与其自己的IP地址进行比较,如果任何成员变量等于其自己的IP地址,则它将数据存储在数据包中,否则将其丢弃。

    The voice data is received and stored in a circular queue.语音数据被接收并存储在循环队列中。 Due to the disorder of UDP data transmission, the voice data packets need to be sorted after the voice data is received at the voice data receiving end to ensure the sequential processing of the voice data and the correct restoration Voice signal.由于UDP数据传输的混乱,需要在语音数据接收端接收到语音数据后对语音数据包进行分类,以确保对语音数据和正确的还原语音信号进行顺序处理。 At the same time, in order to avoid network jitter, the data is processed every time when there are at least 5 packets in the circular queue.同时,为了避免网络抖动,每次在循环队列中至少有XNUMX个数据包时都要处理数据。

    I6336S时序图如图2所示。

    LM40S600向MS3提供语音数据,并根据采样点通过GPIO端口实现串行传输。 Each sampling point contains four bytes, and the data sending process of a sampling point is shown in Figure 8962.每个采样点包含四个字节,采样点的数据发送过程如图6336所示。

    4结果分析

    The size of the voice data packet transmitted by the system via Ethernet is 1024B.系统通过以太网传输的语音数据包的大小为5B。 In order to avoid network jitter, the terminal starts broadcasting when receiving 30 data packets.为了避免网络抖动,终端在接收到10个数据包时开始广播。 The broadcasting delay time is about XNUMX ms, which meets the functional indicators.广播延迟时间约为XNUMX毫秒,符合功能指标。 The server side can control the work of XNUMX broadcasting terminals at the same time.服务器端可以同时控制XNUMX个广播终端的工作。 By selecting the corresponding terminal number on the server side, the whole area broadcasting and local broadcasting functions of the broadcasting system can be successfully realized.通过在服务器侧选择相应的终端号,可以成功地实现广播系统的整个区域广播和本地广播功能。

    5结论

    Starting from actual needs, we design and implement an Ethernet digital voice broadcasting system.从实际需求出发,我们设计并实现了以太网数字语音广播系统。 The experimental results show that the system's playback terminal decides whether to perform voice broadcasting to realize regional broadcasting is a simple and effective way to realize global broadcasting and regional broadcasting of voice signals.实验结果表明,系统的回放终端决定是否进行语音广播以实现区域广播,是实现语音信号的全球广播和区域广播的一种简单有效的方法。 The system player terminal adopts GPIO port software simulation to realize the I2S function, which can accurately realize the I2S timing, complete the data transmission of the voice signal, and realize the real-time broadcast of the voice signal.系统播放器终端采用GPIO端口软件仿真来实现IXNUMXS功能,可以准确实现IXNUMXS时序,完成语音信号的数据传输,实现语音信号的实时广播。 The design structure is reasonable, and can easily realize the expansion of functions, such as timing broadcast, music playback, remote management, real-time monitoring, etc. This design has important practical significance and provides a foundation for solving large and complex Ethernet broadcast systems.该设计结构合理,可以轻松实现定时广播,音乐播放,远程管理,实时监控等功能的扩展。该设计具有重要的现实意义,为解决大型复杂的以太网广播提供了基础。系统。

     

     

     

     

    列出所有问题

    昵称

    电邮

    有疑问吗?

    我们的其他产品:

    专业调频电台设备包

     



     

    酒店IPTV解决方案

     


      输入电子邮件以获取惊喜

      fmuser.org

      es.fmuser.org
      it.fmuser.org
      fr.fmuser.org
      de.fmuser.org
      af.fmuser.org ->荷兰语
      sq.fmuser.org ->阿尔巴尼亚人
      ar.fmuser.org ->阿拉伯语
      hy.fmuser.org - >亚美尼亚
      az.fmuser.org ->阿塞拜疆
      eu.fmuser.org ->巴斯克
      be.fmuser.org ->白俄罗斯语
      bg.fmuser.org - >保加利亚
      ca.fmuser.org ->加泰罗尼亚语
      zh-CN.fmuser.org ->中文(简体)
      zh-TW.fmuser.org - >中国(繁体)
      hr.fmuser.org ->克罗地亚语
      cs.fmuser.org ->捷克
      da.fmuser.org ->丹麦语
      nl.fmuser.org - >荷兰
      et.fmuser.org ->爱沙尼亚语
      tl.fmuser.org ->菲律宾
      fi.fmuser.org ->芬兰语
      fr.fmuser.org - >法国
      gl.fmuser.org ->加利西亚语
      ka.fmuser.org ->乔治亚
      de.fmuser.org ->德语
      el.fmuser.org - >希腊
      ht.fmuser.org ->海地克里奥尔语
      iw.fmuser.org ->希伯来语
      hi.fmuser.org ->印地语
      hu.fmuser.org - >匈牙利
      is.fmuser.org ->冰岛语
      id.fmuser.org ->印尼语
      ga.fmuser.org ->爱尔兰
      it.fmuser.org - >意大利
      ja.fmuser.org ->日语
      ko.fmuser.org ->韩文
      lv.fmuser.org ->拉脱维亚
      lt.fmuser.org - >立陶宛
      mk.fmuser.org ->马其顿语
      ms.fmuser.org ->马来语
      mt.fmuser.org ->马耳他语
      no.fmuser.org - >挪威
      fa.fmuser.org ->波斯语
      pl.fmuser.org ->波兰语
      pt.fmuser.org ->葡萄牙语
      ro.fmuser.org - >罗马尼亚
      ru.fmuser.org ->俄语
      sr.fmuser.org ->塞尔维亚语
      sk.fmuser.org ->斯洛伐克
      sl.fmuser.org - >斯洛文尼亚
      es.fmuser.org ->西班牙语
      sw.fmuser.org ->斯瓦希里语
      sv.fmuser.org ->瑞典语
      th.fmuser.org - >泰国
      tr.fmuser.org ->土耳其语
      uk.fmuser.org ->乌克兰语
      ur.fmuser.org ->乌尔都语
      vi.fmuser.org - >越南
      cy.fmuser.org ->威尔士语
      yi.fmuser.org - >意第绪语

       
  •  

    FMUSER更轻松地传输视频和音频!

  • 联系我们

    地址:
    305广州市环浦路273号汇兰大厦510620室

    电子邮箱:
    [电子邮件保护]

    电话/ WhatApps:
    +8618078869184

  • 分类目录

  • 订阅电子邮件

    名字或全名

    邮箱

  • 贝宝的解决方案  西联汇款中国银行
    电子邮箱:[电子邮件保护]   WhatsApp:+8618078869184 Skype:sky198710021 跟我聊天
    版权所有2006-2020技术支持 www.fmuser.org

    联系我们