AbstractThis article describes the use of computer sound recording and Playback Technology, as well as the method of data transmission over the network, and combined with an instance to design a network voice communication program. KeywordsNetwork Communication, sound recording, sound playback, and GSM 610 voice compression Network voice communication is a very practical technology. Due to the small amount of data in this area, this article will introduce this in detail in conjunction with the program, to achieve network voice communication, the following problems and corresponding programming methods must be clarified: 1. how to record a computer; 2. how to play sound on a computer; 3. how to transmit data between computers; 4. how to compress and decompress audio data.
- Computer Recording principles
The computer uses a sound card to process sound. In Windows, the sound card is regarded as a combination of sound recording and sound recording devices. During recording, you must first prepare a recording queue, which contains the basic parameters of the recording, such as the recording. Data buffer address, buffer size, etc. In order to smooth the recording process, the queue contains at least two data buffers. After a buffer is recorded, the Windows system will give the application Send the End message of a recording and automatically transfer it to the next buffer zone for recording. After receiving the message, the application should release the queue containing the recording data, and retrieve the number of sounds in the buffer zone that the queue points. And then add the buffer zone to the recording queue again to continue recording. Windows uses these data buffers for Repeated input. The functions used are described as follows: Waveinopen () Enable the recording device Waveinprepareheader () Prepare the recording Buffer Waveinaddbuffer () adds the buffer to the recording queue Waveinstart () starts recording Waveinunprepareheader () releases the buffer from the recording queue Waveinreset () resets the recording device Waveinclose () disables the recording device
- Principle of playing sound on a computer
In the same way, there are sound queues and buffer zones for sound playback. When users need to play a sound, they first put the sound data into the data buffer zone and then add the buffer zone to the sound queue, and send it to the sound-releasing device. Write the Data command, and the sound card can play the sound in the buffer. After the data in the buffer zone is played, the system will send a sound-releasing message to the application. The application can repeat the previous work and release the completed team first. Column, then add new sound data to the buffer, and add the buffer to the sound queue again, so that the queue can continue to work. Waveoutopen () Enable the playing device Waveoutstart () starts to play Waveoutprepareheader () Prepare the playing Buffer Waveoutwrite () writes data to a sound-releasing device. Waveoutunprepareheader () releases the buffer from the playing queue Waveoutreset () resets the sound-releasing device. Waveoutclose () ........................................ ........... (Author: Yan Jianhua) Reprint from http://www.comprg.com.cn/detail.asp? Hw_id = 91
|