avaudioplayer

Sound of App running on iPhone too low

此生再无相见时 提交于 2019-12-23 12:26:00
问题 I've written an App supposed to BE run both on iPad and on iPhone. I'm using AVAudioPlayer for playing back sound. Now I've run into some problems with the volume levels. When running on the iPad, everything is fine, the volume level of the sound being played is fine, also when running in the iPad simulator. The problem arises when the app is being run on the iPhone: whereas the volume levels in the iPhone simulator are fine, the levels on the device are very low. Here's the code I'm using on

AVAudioRecorder in iOS 8 does not handle kAudioFormatMPEG4AAC

旧时模样 提交于 2019-12-23 10:00:53
问题 My code worked fine until iOS 8 kAudioFormatMPEG4AAC but now it creates an empty file. No errors are reported. When I changed it to kAudioFormatLinearPCM it works. This is my code: recordSettings = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:AVAudioQualityMin], AVEncoderAudioQualityKey, [NSNumber numberWithInt: kAudioFormatLinearPCM], AVFormatIDKey, [NSNumber numberWithInt:16], AVEncoderBitRateKey, [NSNumber numberWithInt: 1], AVNumberOfChannelsKey, [NSNumber

Volume changes during AVAudioPlayer playback

心不动则不痛 提交于 2019-12-23 09:47:16
问题 I am playing a short wav file using AVAudioPlayer . The sound is replayed every couple of seconds from an NSTimer method. The first time the sound is played, the volume is fine but on subsequent plays the volume is so low that it is almost inaudible. Occasionally the volume drop occurs halfway through the first play. This is happening on an iPad 3, so speaker selection isn't an issue. NSError *phoneCallError; NSURL *phoneCallUrl = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/phone

Volume changes during AVAudioPlayer playback

南楼画角 提交于 2019-12-23 09:46:08
问题 I am playing a short wav file using AVAudioPlayer . The sound is replayed every couple of seconds from an NSTimer method. The first time the sound is played, the volume is fine but on subsequent plays the volume is so low that it is almost inaudible. Occasionally the volume drop occurs halfway through the first play. This is happening on an iPad 3, so speaker selection isn't an issue. NSError *phoneCallError; NSURL *phoneCallUrl = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/phone

iphone利用AudioQueue播放音频文件(mp3,aac,caf,wav等)

核能气质少年 提交于 2019-12-23 08:31:22
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 。 在此分享出来,希望能帮助到真正需要的人,毕竟一个人的力量是有限的,还是要共同学习、共同进步。 1.playAudio.h 声明了一个Objective-C类 // // playAudio.h // ffmpegPlayAudio // // Created by infomedia xuanyuanchen on 12-3-26. // Copyright (c) 2012年 xuanyuanchen. All rights reserved. // #import <Foundation/Foundation.h> #import <AudioToolbox/AudioToolbox.h> #import <AudioToolbox/AudioFile.h> #define NUM_BUFFERS 3 @interface playAudio : NSObject{ //播放音频文件ID AudioFileID audioFile; //音频流描述对象 AudioStreamBasicDescription dataFormat; //音频队列 AudioQueueRef queue; SInt64 packetIndex; UInt32 numPacketsToRead; UInt32

AVAudioplayer: Volume drops after couple of seconds

江枫思渺然 提交于 2019-12-23 05:10:16
问题 I've implemented an audioplayer on iOS 10.2.1 with XCode Version 8.2.1 (8C1002) on Mac OS Sierra 10.12.3 When the song starts playing the volume drops quite a bit after a couple of seconds. Has anyone experienced such an effect? do { myAudioPlayer = try AVAudioPlayer(contentsOf: url!) myAudioPlayer.prepareToPlay() myAudioPlayer.volume = 1.0 } catch { print(error) } 来源: https://stackoverflow.com/questions/43076669/avaudioplayer-volume-drops-after-couple-of-seconds

Converting MPMediaItem to NSData

假如想象 提交于 2019-12-23 04:51:16
问题 I'm trying to convert an MPMediaItem to NSData object so I can play it with AVAudioPlayer. The following answer was posted a while back on a similar question, with steps on how to to that: MPMediaItems raw song data Of course you can access the data of a MPMediaItem. It's not crystal clear at once but it works. Here's how: Get the media item's URL from it's MPMediaItemPropertyAssetURL property Initialize an AVURLAsset with this URL Initialize an AVAssetReader with this asset Fetch the

How can I implement Equalizer in my iPhone application? [closed]

五迷三道 提交于 2019-12-23 04:45:55
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I am Developing the iPad app which has Equalizer functionality,which means sound play on three properties( Low, High, Medium). I googled it and found this link: iPhoneMixerEQGraphTest Its basically mixes the sound but I want to apply equalizer effects on my sound. Please help. 回答1

AVAudioPlayer do not play AMR files

人盡茶涼 提交于 2019-12-23 03:38:21
问题 I ad using below code to download an AMR file from web and playing by AVAudioPlayer but all times I get the unrecongnize selector sent to instance error. This is the method that start download and play: - (IBAction)DisplayAudioPlayView:(id)sender { [self InitializePlayer]; } -(void) InitializePlayer { // Get the file path to the doa audio to play. NSString *filePath = [[ServerInteraction instance] getAudio:audioData.ID]; // Convert the file path to a URL. NSURL *fileURL = [[NSURL alloc]

How to implement AVAudioPlayer Inside Singleton Method?

爱⌒轻易说出口 提交于 2019-12-22 12:31:52
问题 This is my code : class SomeAudioManager: NSObject { class var sharedInstance: SomeAudioManager{ struct Static { static var onceToken: dispatch_once_t = 0 static var instance: SomeAudioManager? = nil } dispatch_once(&Static.onceToken) { Static.instance = SomeAudioManager() } return Static.instance! } func audioView(songname: NSString,format: NSString) { let audioPlayer:ava audioPlayer=try AVAudioPlayer(contentsOfURL: NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource(songname,