JAVA voice processing method (transferred from an Eid)

Source: Internet
Author: User
JAVA sound processing method
Author: Bat vs fallen editor: violet
JAVA sound processing
There are many digital audio formats. Their quality is related to the sampling frequency and sampling accuracy. The unit of frequency is Hz (Hz), which indicates the number of samples per second. The higher the sampling frequency, the better the sound quality. The sampling accuracy is the amount of data stored for each sampling. It determines the amount of discrete amplitude that each digital signal can represent. The more data each sample is stored, the better the sound quality. However, high-quality sound requires a large amount of memory and disk space. Considering the network bandwidth, it takes a long time to transmit data over the Internet. For the Applet, it is extremely important to minimize the number of audio files.
Java supports the following four sound formats:
◆ AU
◆ AIFF
◆ WAVE
◆ MIDI
The first sound format, AU, is the only sound format supported by the previous Java 1.1 version. The sampling frequency is 8000Hz and the sampling accuracy is 8 bits. The formats of AIFF and WAVE are the same as those of AU. They are used to represent digital sounds. Among them, the WAVE format provides a wider range of sound quality. The MIDI format is used to describe the sound with notes and instruments rather than digital sounds.
Sound creation: the key sound tool is the standard application-recorder in Windows9X. The recording format is WAVE. There are also many professional applications, sampling and editing digital sounds, and format conversion.
Resource requirements:
■ Hardware resource requirements:
(1) sound card
(2) speaker
# If you need to record the sound, you need a microphone.
■ Software resource requirements:
(1) windows9X operating system
(2) web browser
(3) Java plug-in/runtime environment
Solution 1
Java language supports the above four sound formats. The simple method is to load the sound in java through the AudioClip () interface of the Applet class. This interface is used to obtain the most useful method for playing audio clips.
This interface defines the following methods:
■ Play ()
Syntax: void play ()
Function: starts playing audio clips.
Whether or not the sound clip is already playing, it is played from the beginning. Play once but not repeatedly.
■ Loop ()
Syntax: void loop ()
Function: Loop playback of audio clips.
You can call this method to play a sound clip from the beginning, no matter whether it is already playing.
■ Stop ()
Syntax: void stop ()
Function: stops playing audio clips.
You can use the getAudioClip () and getCodeBase () methods to obtain audio clips and
URL. You can use this method to play a specified sound clip on a Web page.
# Requirement: a development environment based on JDK or later. If you only play audio files in AU format, JDK1
. 1.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.