我有一个使用iPod Library API访问iOS中歌曲数据库的应用程序.随着iTunes Match的发布,任何不在设备上的歌曲都将无法加载.有没有办法要求下载这首歌?也许使用新的iCloud API?
编辑: 要明确我不会问如何使用iPhone下载iTunes Match歌曲.iOS SDK允许通过MPMediaQuery/MPMediaItems访问iPod库.在具有iTunes Match功能的iOS设备上,通过MPMediaQuery返回iTunes匹配库中但不在设备本地的歌曲,但MPMediaItems的'exportable'标志设置为false.当我在音乐应用程序中访问这些歌曲时,它们会自动下载.我想通过MPMediaItem触发相同的自动下载.
我已经看到iTunes Match中的项目被视为iCloud的一部分,并且iOS 5 SDK中有一个新的iCloud部分.但据我了解,我只能上传我的应用程序数据.我希望通过MPMediaItem或通过iCloud使用URL来触发iTunes Match下载.
现在,我已经在墙上敲了一会儿.我的Xcode项目在重构时变得有点乱,并拒绝构建.我已经压制了所有其他错误,除了最后一个链接时错误:
Framework not found AudioUnit
Run Code Online (Sandbox Code Playgroud)
我有AudioUnit标题,AudioUnit.framework包含在我之前的项目中(目标>获取信息>常规>链接库> +),但我无法弄清楚它为什么现在不起作用.AudioToolbox.framework也包括在内.
我正在编写一个记录音频的应用程序.我正在研究在录音时支持多任务的可行性(在后台).
答案似乎是一个没有从我到目前为止阅读,特别是因为该方案是为了释放任何系统资源在使用时切换出.
所以我想知道,当我的应用程序继续在后台捕获音频时,是否可以让用户切换到iOS中的另一个应用程序?
我在Google和StackOverflow上做了很多研究.我发现的所有答案在iOS 7中都不起作用.我开始在iOS 7 SDK中使用Xcode 5编写新的应用程序.
我所要做的就是从应用程序包中存储的文件(而不是音乐库)中播放应用程序中的音频.我希望在后台播放音频并在屏幕锁定时控制(除控制中心外).
我将APPNAME-Info.plist密钥设置UIBackgroundModes为音频.它不处理app委托中的内容; 一切都在ViewController中完成
@interface ViewController : UIViewController <AVAudioPlayerDelegate>
Run Code Online (Sandbox Code Playgroud)
在实现的viewDidAppear:方法中,我调用super,然后是以下代码:
// Once the view has loaded then we can register to begin receiving controls and we can become the first responder
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self becomeFirstResponder];
Run Code Online (Sandbox Code Playgroud)
在我的实现viewWillDisappear:方法中,我有以下代码:
// End receiving events
[[UIApplication sharedApplication] endReceivingRemoteControlEvents];
[self resignFirstResponder];
Run Code Online (Sandbox Code Playgroud)
我还实现了canBecomeFirstResponder方法,返回YES.接下来,我实现了该remoteControlReceivedWithEvent:方法:
- (void)remoteControlReceivedWithEvent:(UIEvent *)event {
// If it is a remote control …Run Code Online (Sandbox Code Playgroud) 我想在iphone上编写一个简单的音频音序器,但我无法获得准确的时序.最后几天我在iphone上尝试了所有可能的音频技术,从AudioServicesPlaySystemSound和AVAudioPlayer以及OpenAL到AudioQueues.
在我的最后一次尝试中,我尝试了使用openAL的CocosDenshion声音引擎,并允许将声音加载到多个缓冲区中,然后在需要时播放它们.这是基本代码:
在里面:
int channelGroups[1];
channelGroups[0] = 8;
soundEngine = [[CDSoundEngine alloc] init:channelGroups channelGroupTotal:1];
int i=0;
for(NSString *soundName in [NSArray arrayWithObjects:@"base1", @"snare1", @"hihat1", @"dit", @"snare", nil])
{
[soundEngine loadBuffer:i fileName:soundName fileType:@"wav"];
i++;
}
[NSTimer scheduledTimerWithTimeInterval:0.14 target:self selector:@selector(drumLoop:) userInfo:nil repeats:YES];
Run Code Online (Sandbox Code Playgroud)
在初始化中,我创建声音引擎,将一些声音加载到不同的缓冲区,然后使用NSTimer建立音序器循环.
音频循环:
- (void)drumLoop:(NSTimer *)timer
{
for(int track=0; track<4; track++)
{
unsigned char note=pattern[track][step];
if(note)
[soundEngine playSound:note-1 channelGroupId:0 pitch:1.0f pan:.5 gain:1.0 loop:NO];
}
if(++step>=16)
step=0;
}
Run Code Online (Sandbox Code Playgroud)
这就是它,它应该工作,但它的时机是不稳定和不稳定的.一旦发生其他事情(在视图中绘制),它就会失去同步.
据我所知,声音引擎和openAL缓冲区已加载(在初始化代码中),然后准备立即启动alSourcePlay(source);- 所以问题可能出在NSTimer?
现在appstore中有几十个声音序列器应用程序,它们具有准确的计时.当变焦和绘图完成时,Ig"idrum"在180 bpm时具有完美的稳定节拍.所以必须有一个解决方案.
有人有什么想法吗?
在此先感谢您的帮助!
最好的祝福,
Walchy
感谢您的回答.它让我更进一步,但不幸的是没有达到目的.这是我做的:
nextBeat=[[NSDate alloc] initWithTimeIntervalSinceNow:0.1]; …Run Code Online (Sandbox Code Playgroud) 我有一个儿童的iPhone应用程序正在编写,我需要能够使用Core Audio移动声音样本的音高.有没有人有任何示例代码,我可以看看这是完成的.应用程序商店中有很多音乐和游戏应用程序,所以我知道我不是第一个.但是,我找不到任何有关它的例子.
我正在使用afconvert命令行实用程序将音频文件转换.caf为.mp3格式.我用过afconvert:
afconvert -f 'MPG3 ' -d '.mp3' -v input.caf output.mp3
Run Code Online (Sandbox Code Playgroud)
但这给了我以下错误:
Input file: input.caf, 19008 frames
Error: ExtAudioFileSetProperty ('cfmt') failed ('fmt?')
Run Code Online (Sandbox Code Playgroud)
我也尝试过以下方法:
afconvert -f 'MPG3 ' -d LEI32@44100 -v input.caf output.mp3
Run Code Online (Sandbox Code Playgroud)
这也给了我错误:
Input file: min.caf, 19008 frames
Error: ExtAudioFileCreateWithURL failed ('fmt?')
Run Code Online (Sandbox Code Playgroud)
我无法弄清楚为什么这会给出错误.
任何人都可以指导我解决这个问题吗?
谢谢你提前.
我已经创建了一些使用CoreAudio封装的封装函数,目标是创建一个可以与一些命令行C++工具一起使用的C库.到目前为止,事情进展顺利.我拿了一个示例项目,对其进行了修改,然后在XCode中构建并运行.我想完全跳过XCode并使用gcc和Makefile构建库.
如何链接Apple Framework?框架是否只是共享库,我可以包含在gcc的-l和-L选项中?
我正在开发iphone 3GS上的低音吉他音高检测应用程序.我发现使用RemoteIO无法获得低于150Hz的声音数据.然而,低音吉他可能会产生低于50hz的音调.根据报告"iPhone 4耳机输入频率响应",http://blog.faberacoustical.com/2010/iphone/iphone-4-audio-and-frequency-response-limitations/ 150以下急剧下降赫兹.
这里显示了我如何设置AudioUnit.
// set audio unit
{
// create AudioUnit
{
AudioComponentDescription desc;
desc.componentType = kAudioUnitType_Output;
desc.componentSubType = kAudioUnitSubType_RemoteIO;
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
desc.componentFlags = 0;
desc.componentFlagsMask = 0;
AudioComponent comp = AudioComponentFindNext(NULL, &desc);
OSAssert(AudioComponentInstanceNew(comp, &m_AudioUnit));
}
//enable input on the remote I/O unit (output is default enabled, but input is not)
{
UInt32 one = 1;
OSAssert(AudioUnitSetProperty(m_AudioUnit, kAudioOutputUnitProperty_EnableIO,
kAudioUnitScope_Input, 1, &one, sizeof(one)));
}
//set render callback function
{
AURenderCallbackStruct callbackInfo;
callbackInfo.inputProc=staticPerformThru;
callbackInfo.inputProcRefCon=this;
OSAssert(AudioUnitSetProperty(m_AudioUnit,
kAudioUnitProperty_SetRenderCallback,
kAudioUnitScope_Input,
0, …Run Code Online (Sandbox Code Playgroud) 
如何在iOS中录制语音时以编程方式生成音频波形?
我正在研究iOS中的语音调制音频...一切正常......只需要一些最简单的方法就可以在检测噪声上生成音频波形...
请不要参考我的代码教程... speakhere和auriotouch ...我需要一些来自本机应用程序开发人员的最佳建议.
我录制了音频,录制后我播放了它.我创建了波形和附加截图.但它必须在视图中被描绘为录音正在进行中
-(UIImage *) audioImageGraph:(SInt16 *) samples
normalizeMax:(SInt16) normalizeMax
sampleCount:(NSInteger) sampleCount
channelCount:(NSInteger) channelCount
imageHeight:(float) imageHeight {
CGSize imageSize = CGSizeMake(sampleCount, imageHeight);
UIGraphicsBeginImageContext(imageSize);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [UIColor blackColor].CGColor);
CGContextSetAlpha(context,1.0);
CGRect rect;
rect.size = imageSize;
rect.origin.x = 0;
rect.origin.y = 0;
CGColorRef leftcolor = [[UIColor whiteColor] CGColor];
CGColorRef rightcolor = [[UIColor redColor] CGColor];
CGContextFillRect(context, rect);
CGContextSetLineWidth(context, 1.0);
float halfGraphHeight = (imageHeight / 2) / (float) channelCount ;
float centerLeft = halfGraphHeight;
float centerRight = (halfGraphHeight*3) ; …Run Code Online (Sandbox Code Playgroud) core-audio ×10
iphone ×7
ios ×3
audio ×2
objective-c ×2
audiotoolbox ×1
audiounit ×1
avfoundation ×1
avplayer ×1
frameworks ×1
gcc ×1
icloud ×1
ios7 ×1
ipod ×1
linker ×1
macos-carbon ×1
openal ×1
pitch ×1
timing ×1