使用Audio Toolbox framework调用系统声音

本文根据http://bbs.9ria.com/thread-241240-1-1.html处的文章做的整理

一、使用三部曲

1、工程里加入Audio Toolbox framework这个库;

2、在需要调用的文件引入:#import <AudioToolbox/AudioToolbox.h>

3、在需要播放提示音的地方写上:AudioServicesPlaySystemSound(1106);

注:括号中为系统声音的id,详见最下面的列表。


二、将自己的音频转换为系统声音

1、获得音频文件的路径/文件名
2、声明一个SystemSoundID变量
3、获得音频文件的URL路径
4、使用AudioServicesCreateSystemSoundID()将音频文件转化为系统声音


//Get the filename of the sound file:

NSString *path = [NSString stringWithFormat:@"%@%@", [[NSBundle mainBundle] resourcePath], @"/jad0007a.wav"];

//declare a system sound

id SystemSoundID soundID;

//Get a URL for the sound file

NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];

//Use audio sevices to create the sound

AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID);

//Use audio services to play the sound

AudioServicesPlaySystemSound(soundID)


三、提示音列表

Sound ID    File name (iPhone)    File name (iPod Touch)    Category    Note   

1000

new-mail.caf

new-mail.caf

MailReceived


1001

mail-sent.caf

mail-sent.caf

MailSent


1002

Voicemail.caf

Voicemail.caf

VoicemailReceived


1003

ReceivedMessage.caf

ReceivedMessage.caf

SMSReceived


1004

SentMessage.caf

SentMessage.caf

SMSSent


1005

alarm.caf

sq_alarm.caf

CalendarAlert


1006

low_power.caf

low_power.caf

LowPower


1007

sms-received1.caf

sms-received1.caf

SMSReceived_Alert


1008

sms-received2.caf

sms-received2.caf

SMSReceived_Alert


1009

sms-received3.caf

sms-received3.caf

SMSReceived_Alert


1010

sms-received4.caf

sms-received4.caf

SMSReceived_Alert


1011

-

-

SMSReceived_Vibrate


1012

sms-received1.caf

sms-received1.caf

SMSReceived_Alert


1013

sms-received5.caf

sms-received5.caf

SMSReceived_Alert


1014

sms-received6.caf

sms-received6.caf

SMSReceived_Alert


1015

Voicemail.caf

Voicemail.caf

-

Available since 2.1

1016

tweet_sent.caf

tweet_sent.caf

SMSSent

Available since 5.0

1020

Anticipate.caf

Anticipate.caf

SMSReceived_Alert

Available since 4.2

1021

Bloom.caf

Bloom.caf

SMSReceived_Alert

Available since 4.2

1022

Calypso.caf

Calypso.caf

SMSReceived_Alert

Available since 4.2

1023

Choo_Choo.caf

Choo_Choo.caf

SMSReceived_Alert

Available since 4.2

1024

Descent.caf

Descent.caf

SMSReceived_Alert

Available since 4.2

1025

Fanfare.caf

Fanfare.caf

SMSReceived_Alert

Available since 4.2

1026

Ladder.caf

Ladder.caf

SMSReceived_Alert

Available since 4.2

1027

Minuet.caf

Minuet.caf

SMSReceived_Alert

Available since 4.2

1028

News_Flash.caf

News_Flash.caf

SMSReceived_Alert

Available since 4.2

1029

Noir.caf

Noir.caf

SMSReceived_Alert

Available since 4.2

1030

Sherwood_Forest.caf

Sherwood_Forest.caf

SMSReceived_Alert

Available since 4.2

1031

Spell.caf

Spell.caf

SMSReceived_Alert

Available since 4.2

1032

Suspense.caf

Suspense.caf

SMSReceived_Alert

Available since 4.2

1033

Telegraph.caf

Telegraph.caf

SMSReceived_Alert

Available since 4.2

1034

Tiptoes.caf

Tiptoes.caf

SMSReceived_Alert

Available since 4.2

1035

Typewriters.caf

Typewriters.caf

SMSReceived_Alert

Available since 4.2

1036

Update.caf

Update.caf

SMSReceived_Alert

Available since 4.2

1050

ussd.caf

ussd.caf

USSDAlert


1051

SIMToolkitCallDropped.caf

SIMToolkitCallDropped.caf

SIMToolkitTone


1052

SIMToolkitGeneralBeep.caf

SIMToolkitGeneralBeep.caf

SIMToolkitTone


1053

SIMToolkitNegativeACK.caf

SIMToolkitNegativeACK.caf

SIMToolkitTone


1054

SIMToolkitPositiveACK.caf

SIMToolkitPositiveACK.caf

SIMToolkitTone


1055

SIMToolkitSMS.caf

SIMToolkitSMS.caf

SIMToolkitTone


1057

Tink.caf

Tink.caf

PINKeyPressed


1070

ct-busy.caf

ct-busy.caf

AudioToneBusy

There was no category for this sound before 4.0.

1071

ct-congestion.caf

ct-congestion.caf

AudioToneCongestion

There was no category for this sound before 4.0.

1072

ct-path-ack.caf

ct-path-ack.caf

AudioTonePathAcknowledge

There was no category for this sound before 4.0.

1073

ct-error.caf

ct-error.caf

AudioToneError

There was no category for this sound before 4.0.

1074

ct-call-waiting.caf

ct-call-waiting.caf

AudioToneCallWaiting

There was no category for this sound before 4.0.

1075

ct-keytone2.caf

ct-keytone2.caf

AudioToneKey2

There was no category for this sound before 4.0.

1100

lock.caf

sq_lock.caf

ScreenLocked


1101

unlock.caf

sq_lock.caf

ScreenUnlocked


1102

-

-

FailedUnlock


1103

Tink.caf

sq_tock.caf

KeyPressed


1104

Tock.caf

sq_tock.caf

KeyPressed


1105

Tock.caf

sq_tock.caf

KeyPressed


1106

beep-beep.caf

sq_beep-beep.caf

ConnectedToPower


1107

RingerChanged.caf

RingerChanged.caf

RingerSwitchIndication


1108

photoShutter.caf

photoShutter.caf

CameraShutter


1109

shake.caf

shake.caf

ShakeToShuffle

Available since 3.0

1110

jbl_begin.caf

jbl_begin.caf

JBL_Begin

Available since 3.0

1111

jbl_confirm.caf

jbl_confirm.caf

JBL_Confirm

Available since 3.0

1112

jbl_cancel.caf

jbl_cancel.caf

JBL_Cancel

Available since 3.0

1113

begin_record.caf

begin_record.caf

BeginRecording

Available since 3.0

1114

end_record.caf

end_record.caf

EndRecording

Available since 3.0

1115

jbl_ambiguous.caf

jbl_ambiguous.caf

JBL_Ambiguous

Available since 3.0

1116

jbl_no_match.caf

jbl_no_match.caf

JBL_NoMatch

Available since 3.0

1117

begin_video_record.caf

begin_video_record.caf

BeginVideoRecording

Available since 3.0

1118

end_video_record.caf

end_video_record.caf

EndVideoRecording

Available since 3.0

1150

vc~invitation-accepted.caf

vc~invitation-accepted.caf

VCInvitationAccepted

Available since 4.0

1151

vc~ringing.caf

vc~ringing.caf

VCRinging

Available since 4.0

1152

vc~ended.caf

vc~ended.caf

VCEnded

Available since 4.0

1153

ct-call-waiting.caf

ct-call-waiting.caf

VCCallWaiting

Available since 4.1

1154

vc~ringing.caf

vc~ringing.caf

VCCallUpgrade

Available since 4.1

1200

dtmf-0.caf

dtmf-0.caf

TouchTone


1201

dtmf-1.caf

dtmf-1.caf

TouchTone


1202

dtmf-2.caf

dtmf-2.caf

TouchTone


1203

dtmf-3.caf

dtmf-3.caf

TouchTone


1204

dtmf-4.caf

dtmf-4.caf

TouchTone


1205

dtmf-5.caf

dtmf-5.caf

TouchTone


1206

dtmf-6.caf

dtmf-6.caf

TouchTone


1207

dtmf-7.caf

dtmf-7.caf

TouchTone


1208

dtmf-8.caf

dtmf-8.caf

TouchTone


1209

dtmf-9.caf

dtmf-9.caf

TouchTone


1210

dtmf-star.caf

dtmf-star.caf

TouchTone


1211

dtmf-pound.caf

dtmf-pound.caf

TouchTone


1254

long_low_short_high.caf

long_low_short_high.caf

Headset_StartCall


1255

short_double_high.caf

short_double_high.caf

Headset_Redial


1256

short_low_high.caf

short_low_high.caf

Headset_AnswerCall


1257

short_double_low.caf

short_double_low.caf

Headset_EndCall


1258

short_double_low.caf

short_double_low.caf

Headset_CallWaitingActions


1259

middle_9_short_double_low.caf

middle_9_short_double_low.caf

Headset_TransitionEnd


1300

Voicemail.caf

Voicemail.caf

SystemSoundPreview


1301

ReceivedMessage.caf

ReceivedMessage.caf

SystemSoundPreview


1302

new-mail.caf

new-mail.caf

SystemSoundPreview


1303

mail-sent.caf

mail-sent.caf

SystemSoundPreview


1304

alarm.caf

sq_alarm.caf

SystemSoundPreview


1305

lock.caf

sq_lock.caf

SystemSoundPreview


1306

Tock.caf

sq_tock.caf

KeyPressClickPreview

The category was SystemSoundPreview before 3.2.

1307

sms-received1.caf

sms-received1.caf

SMSReceived_Selection


1308

sms-received2.caf

sms-received2.caf

SMSReceived_Selection


1309

sms-received3.caf

sms-received3.caf

SMSReceived_Selection


1310

sms-received4.caf

sms-received4.caf

SMSReceived_Selection


1311

-

-

SMSReceived_Vibrate


1312

sms-received1.caf

sms-received1.caf

SMSReceived_Selection


1313

sms-received5.caf

sms-received5.caf

SMSReceived_Selection


1314

sms-received6.caf

sms-received6.caf

SMSReceived_Selection


1315

Voicemail.caf

Voicemail.caf

SystemSoundPreview

Available since 2.1

1320

Anticipate.caf

Anticipate.caf

SMSReceived_Selection

Available since 4.2

1321

Bloom.caf

Bloom.caf

SMSReceived_Selection

Available since 4.2

1322

Calypso.caf

Calypso.caf

SMSReceived_Selection

Available since 4.2

1323

Choo_Choo.caf

Choo_Choo.caf

SMSReceived_Selection

Available since 4.2

1324

Descent.caf

Descent.caf

SMSReceived_Selection

Available since 4.2

1325

Fanfare.caf

Fanfare.caf

SMSReceived_Selection

Available since 4.2

1326

Ladder.caf

Ladder.caf

SMSReceived_Selection

Available since 4.2

1327

Minuet.caf

Minuet.caf

SMSReceived_Selection

Available since 4.2

1328

News_Flash.caf

News_Flash.caf

SMSReceived_Selection

Available since 4.2

1329

Noir.caf

Noir.caf

SMSReceived_Selection

Available since 4.2

1330

Sherwood_Forest.caf

Sherwood_Forest.caf

SMSReceived_Selection

Available since 4.2

1331

Spell.caf

Spell.caf

SMSReceived_Selection

Available since 4.2

1332

Suspense.caf

Suspense.caf

SMSReceived_Selection

Available since 4.2

1333

Telegraph.caf

Telegraph.caf

SMSReceived_Selection

Available since 4.2

1334

Tiptoes.caf

Tiptoes.caf

SMSReceived_Selection

Available since 4.2

1335

Typewriters.caf

Typewriters.caf

SMSReceived_Selection

Available since 4.2

1336

Update.caf

Update.caf

SMSReceived_Selection

Available since 4.2

1350

-

-

RingerVibeChanged


1351

-

-

SilentVibeChanged

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: Matlab音频工具箱是一个用于音频处理和分析的Matlab工具箱。它包含了许多用于音频信号处理的函数和工具,例如滤波、频谱分析、音频压缩和解压缩等。Matlab音频工具箱可以帮助用户进行音频信号处理和分析,以及开发音频应用程序。 ### 回答2: Matlab是一种功能强大的编程语言,可以通过其专业的音频工具箱(Audio Toolbox)进行音频信号分析和处理。这个工具箱包括各种各样的函数和工具,可以用于处理音频文件,进行时域分析,频域分析,以及频谱分析等等。它允许用户对音频信号进行各种操作,包括信号滤波,降噪,均衡化,特征提取,以及声音合成等等。 Matlab音频工具箱的使用非常方便。用户可以通过简单的命令行语句打开音频文件,对其进行各种处理,然后保存修改后的文件。比如,可以使用函数audioread()和audiowrite()读取和写入音频文件,函数resample()进行声音重构等。 音频信号分析是Matlab音频工具箱中最常用的功能之一。用户可以使用函数fft()和ifft()计算信号的傅里叶变换和逆变换,获得信号的频域信息。另外,Matlab还提供了spectrogram()函数,可以计算出信号的短时频谱信息,以及stft()函数,可以计算出信号的短时傅里叶变换。 Matlab音频工具箱还包括许多其他的函数和工具,比如滤波器设计函数fir1()和butter(),用于设计低通、高通、带通和带阻滤波器,函数wavrecord()和wavplay(),可以对实时录音和信号回放进行控制等。 总之,Matlab音频工具箱为音频信号处理提供了丰富的功能和工具,极大地方便了对音频信号的处理和分析。它是音频研究、开发和制作的快捷途径。 ### 回答3: MATLAB Audio Toolbox是MATLAB软件中的一个功能强大的工具箱,它提供了许多用于音频处理、分析和合成的函数和工具。Audio Toolbox提供了实时信号处理的能力,可以在接收到音频信号时实时处理它,输出处理后的声音信号。该工具箱也可以用来生成音频信号,并将其保存为文件,以备将来使用使用MATLAB Audio Toolbox,可以进行多种音频处理,包括滤波(低通、高通、带通和带阻滤波)、声音特征提取(如幅度、能量、频率和相位)和音频合成(如音乐合成、语音合成和声音合成)等。此外,该工具箱还提供了音频信号的可视化和分析功能,可用于帮助用户更好地了解信号的特征和结构。 MATLAB Audio Toolbox还提供了各种音频格式的支持,包括多种文件格式(如WAV、MP3、AAC等),以及常见音频设备(如麦克风和扬声器)的支持。用户可以利用这些支持,方便地处理这些音频文件和音频设备,并在开发中集成音频功能。 总之,MATLAB Audio Toolbox是一个非常强大的工具箱,可用于各种音频处理、分析和合成任务。对于想要处理音频信号的MATLAB用户来说,它是一个非常有用的工具箱,可以大大提高工作效率和准确性。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值