< graphic images, animations, multimedia > Reading Notes---sound effects

Source: Internet
Author: User

Audio multimedia files mainly store audio data information, audio files in the process of recording the sound signal, through the audio encoding, into the audio digital signal to save to some format file. During playback, the audio file is decoded, The decoded signals can be turned into sound waves by means of devices such as loudspeakers. audio files are very large in the encoding process, so some file formats compress the data, so the audio file can be divided into:


Lossless format, non-compressed data format, file is very large generally not suitable for mobile devices, such as: Wav,au,ape and other files

lossy format, the data is compressed, after compression lost some data, such as mp3,wma and other files.


1.WAV file

WAV files are now the most popular lossless compression format, the WAV file format is flexible, can store many types of audio data, because the file size is not suitable for mobile devices these small storage capacity devices


2.mp3 file

MP3 format is now very popular, MP3 is a lossy compression format, he as far as possible to remove the human ear can not feel the parts and not sensitive parts, MP3 is the use of MPEG Audio Layer 3 technology to 1:10 or even 1:12 of the compression rate, compressed into smaller capacity files, This high compression ratio is ideal for mobile devices with small storage capacity


3.WMA file

The WMA format is a file format that is published by Microsoft and is also lossy compression format. It is pitches with the MP3 format. In low bit rate rendering scenarios, the WMA format shows a lot more advantages than MP3, compression is higher than MP3, and better sound quality. But high bit still prevails in MP3 rate rendering.


4.CAFF file

The Caff file is an audio format that Apple has developed specifically for Mac OS X and iOS systems. It is designed to replace the old WAV format


5.AIFF

AIFF file is a professional audio file format developed by Apple. The compressed format of AIFF is Aiff-c, which compresses data at 4:1 compression rate, specifically for Mac OS X and iOS systems.


Speech synthesis

Avspeechutterance *utt = [avspeechutterance speechutterancewithstring:@ "Test text"];    Utt.rate = [Self.slider value];    [Self.speechsynthesizer Speakutterance:utt];


System Sound API

The System Sound API is subordinate to the C-oriented sub-level API in Core Audio (the book says so, but the code should include Audiotoolbox)


Play system Sound

Playback system sound is mainly played using the Audioservicesplaysystemsound function, which is mainly used for game sound and Operation Sound. His workflow is roughly:

1. Pre-play Prep phase: Create Systemsoundid using the Audioservicescreatesystemsoundid function, Then use Audioservicesaddsystemsoundcompletion to log off the sound playback event callback function.

2. Playback stage: Use Audioservicesplaysystemsound to play sound implementation.

3. Post-Play processing phase: Release the resource, unregister the event callback function, This includes using the Audioservicesdisposesystemsoundid function to release systemsoundid and use the Audioservicesremovesystemsoundcompletion logoff sound to play the event callback function .


Defines a callback function. Used to callback after the sound has finished playing.    void Soundfinishedplayingcallback (Systemsoundid sound_id, void* user_data) {//Logoff sound play completed event callback function.    Audioservicesremovesystemsoundcompletion (sound_id); Release Systemsoundidaudioservicesdisposesystemsoundid (sound_id);} @implementation viewcontroller-(ibaction) PlaySystemSound: (ID) Sender {nsurl* System_sound_url = [Nsurl Fileurlwithpat H:[[nsbundle Mainbundle] pathforresource:@ "Alertchordstroke" oftype:@        "WAV"];        Systemsoundid system_sound_id; Create Systemsoundid Audioservicescreatesystemsoundid ((cfurlref) Cfbridgingretain (Syst        Em_sound_url), &system_sound_id); Unregisters the Sound Playback completion event callback function.

Audioservicesaddsystemsoundcompletion (system_sound_id, NULL, NULL, SOUNDFINISHE Dplayingcallback, NULL); Playback system Sound Audioservicesplaysystemsound (system_sound_id); }



Vibration Equipment

Audioservicesplaysystemsound(ksystemsoundid_vibrate);


OpenAL

The process of playing sound

1. Obtaining Device information

2. Access to environmental information

3. Initializing buffers

4. Initiation of solidarity

5. Bind the buffer and the source

6. Initializing listeners

7. Play

8. Freeing up memory


The process of initializing the cache

1. Open File

2. Get the actual audio file size

3. Open up audio memory data space

4. Read the file into memory

5. Close the file

6. Obtaining the buffer ID from the OpenAL

7. In-memory audio data is copied to the buffer

8. Clear in-memory audio data



< graphic images, animations, multimedia > Reading Notes---sound effects

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.