在几个与音频相关的Apple示例代码的'iPublicUtility'文件夹中有许多帮助文件,例如aurioTouch:http: //developer.apple.com/library/ios/#samplecode/aurioTouch/Introduction/Intro.html
我可以很好地建造这些样品.但每当我创建一个用于测试的新项目并包含来自'iPublicUtility'文件夹的文件时,我得到:'CADebugPrintf.h:'CADebugMacros.h'文件中没有这样的文件或目录...'错误.
我将我的测试项目的设置与Apple样本一致,但这个错误并没有消失.有什么建议吗?
SDK:iOS 4.2,iMac OSX 10.6.6
谢谢大家.
SY
我想在iPhone中播放合成声音.我不想使用预先录制的声音并使用SystemSoundID播放现有的二进制文件,而是想合成它.部分地,这是因为我希望能够连续播放声音(例如,当用户的手指在屏幕上时)而不是一次性声音样本.
如果我想合成一个中A + 1(A4)(440Hz),我可以使用sin()计算正弦波; 我不知道的是如何将这些位安排到CoreAudio随后可以播放的数据包中.网上存在的大多数教程都只关注简单地播放现有的二进制文件.
任何人都可以用440Hz的简单合成正弦声波来帮助我吗?
我正在播放几种声音:AudioServices
AudioServicesPlaySystemSound(aSystemSoundID);
当我在连接到机器的iPhone 3G上测试项目时,我收到以下消息:
> 2010-09-16 17:29:29.672
> myProject[6528:6def] [17:29:29.672
> <0x85d400>] PlaySound posting message
> to kill mediaserverd (5958) [Switching
> to thread 13059]
Run Code Online (Sandbox Code Playgroud)
和/或:
> 2010-09-16 17:30:28.316
> myProject[6528:6def] [17:30:28.316
> <0x85d400>] AudioQueueNew posting
> message to kill mediaserverd (0)
> Error: AudioQueueNewInput failed
> (0x10004003)
Run Code Online (Sandbox Code Playgroud)
知道为什么吗?
谢谢.
顺便说一句,在模拟器上一切正常.
我正在使用该MusicSequenceFileCreate函数来保存midi文件以确保数据正确.我没有收到任何错误,但我想查看保存的文件,但不知道如何做到这一点.
我知道我可以尝试在iOS中阅读它,但我想在桌面上查看它(并测试它).
此文件是否存储在我可以访问的某些模拟器缓存中?
我在语音聊天应用程序中使用RemoteIO.为了启用回声消除,在将"kAudioSessionCategory_PlayAndRecord"设置为会话类型后,我将"kAudioUnitSubType_RemoteIO"更改为"kAudioUnitSubType_VoiceProcessingIO".现在回声消除工作,但输出音量水平相对于之前的RemoteIO输出水平显着下降.有没有人知道如何在使用VoiceProcessingIO时获得与使用RemoteIO时相同的输出音量?
我在使用AVAudioPlayer时遇到问题,我想重置一个播放器,如果它正在播放并重新播放.
我试着以下没有运气:
声音播放一次,但第二次我选择按钮停止声音,第三次再次启动声音.
//Stop the player and restart it
if (player.playing) {
NSLog(@"Reset sound: %@", selectedSound);
[player stop];
[player play];
} else {
NSLog(@"playSound: %@", selectedSound);
[player play];
}
Run Code Online (Sandbox Code Playgroud)
我也尝试过使用player.currentTime = 0来表示会重置播放器,这不起作用,我也尝试重置currentTime = 0然后调用不起作用的播放.
//Stop the player and restart it
if (player.playing) {
NSLog(@"Reset sound: %@", selectedSound);
player.currentTime = 0;
[player play];
} else {
NSLog(@"playSound: %@", selectedSound);
[player play];
}
Run Code Online (Sandbox Code Playgroud) 我正在寻找使用音频队列服务的示例.
我想用数学方程创造一个声音,然后听到它.
我目前正试图弄清楚如何MPNowPlayingInfoCenter在iOS上指定经过的时间.
当我开始播放时,我将经过时间设置为0并将播放速率设置为1.这样可以正常工作.
然后我暂停音频.这可以通过MPNowPlayingInfoCenter正确检测到,并暂停接口上的已用时间.
只有当我恢复播放时才会出现问题:时间显示就好像暂停时一直播放.例:
1. Start playback
2. Let it play for 10 seconds
3. Pause for 5 seconds
4. Resume playback
Run Code Online (Sandbox Code Playgroud)
此时,轨道中的实际时间为10秒.然而,信息中心显示15.
我试图在暂停时将播放速率设置为0,但这会导致一种奇怪的行为:显示的时间随机变为较低的值.
此外,我没有机会在恢复歌曲之前更新已用时间,因为我在收到play活动后才有机会这样做.
tl; dr:如何处理MPNowPlayingInfoCenter中的暂停及其时间特征?
HEJ.我想用AVAudioEngineSwift中的new实现一个实时音频应用程序.有人有新框架经验吗?实时应用程序如何工作?
我的第一个想法是将(已处理的)输入数据存储到一个AVAudioPCMBuffer对象中,然后让它AVAudioPlayerNode在我的演示类中看到:
import AVFoundation
class AudioIO {
var audioEngine: AVAudioEngine
var audioInputNode : AVAudioInputNode
var audioPlayerNode: AVAudioPlayerNode
var audioMixerNode: AVAudioMixerNode
var audioBuffer: AVAudioPCMBuffer
init(){
audioEngine = AVAudioEngine()
audioPlayerNode = AVAudioPlayerNode()
audioMixerNode = audioEngine.mainMixerNode
let frameLength = UInt32(256)
audioBuffer = AVAudioPCMBuffer(PCMFormat: audioPlayerNode.outputFormatForBus(0), frameCapacity: frameLength)
audioBuffer.frameLength = frameLength
audioInputNode = audioEngine.inputNode
audioInputNode.installTapOnBus(0, bufferSize:frameLength, format: audioInputNode.outputFormatForBus(0), block: {(buffer, time) in
let channels = UnsafeArray(start: buffer.floatChannelData, length: Int(buffer.format.channelCount))
let floats = UnsafeArray(start: channels[0], length: Int(buffer.frameLength))
for var i …Run Code Online (Sandbox Code Playgroud) 我有一些录音代码正常工作,但录制的音频(来自iPod touch内置麦克风)非常嘈杂.
这是我的配置:
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
NSError *err = nil;
[audioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:&err];
if (err) {
NSLog(@"audioSession: %@ %d %@", [err domain], [err code], [[err userInfo] description]);
return;
}
[audioSession setActive:YES error:&err];
err = nil;
if (err) {
NSLog(@"audioSession: %@ %d %@", [err domain], [err code], [[err userInfo] description]);
return;
}
recordSetting = [[NSMutableDictionary alloc] init];
// We can use kAudioFormatAppleIMA4 (4:1 compression) or kAudioFormatLinearPCM for nocompression
[recordSetting setValue:[NSNumber kAudioFormatLinearPCM] forKey:AVFormatIDKey];
// We can use 44100, …Run Code Online (Sandbox Code Playgroud) core-audio ×10
ios ×5
audio ×3
iphone ×3
objective-c ×3
audiounit ×1
avfoundation ×1
cocoa ×1
real-time ×1
remoteio ×1
swift ×1