audiotoolbox

Schedule buffer with AVAudioPCMBuffer int16 data

那年仲夏 提交于 2021-01-29 14:58:04
问题 I'm trying to play music from byte array which is coming from the network in pcmInt16 data format. // formats let format1 = AVAudioFormat(commonFormat: AVAudioCommonFormat.pcmFormatFloat32, sampleRate: 48000, channels: 1, interleaved: false)! let format2 = AVAudioFormat(commonFormat: AVAudioCommonFormat.pcmFormatInt16, sampleRate: 48000, channels: 1, interleaved: false)! // byte array buffer var byteArray: [Int16]! // one packet size is 512 ... // 1. create / attach / connect engine engine

Change Sample rate with AudioConverter

南楼画角 提交于 2020-03-21 06:55:51
问题 I am trying to re-sample the input audio 44.1 kHz to 48 kHz. using AudioToolbox's AUAudioUnit.inputHandler writing out the input 44.1 kHZ to a wav file (this is working perfectly) converting the 44.1 kHz to 48 kHz and writing out this converted bytes to file. https://developer.apple.com/documentation/audiotoolbox/1503098-audioconverterfillcomplexbuffer The problem is in the 3rd step. After writing out to a file the voice is very noisy. here is my code: // convert to 48kHz var

(OSStatus) error = -1500 in AudioToolbox Framework

狂风中的少年 提交于 2020-01-15 10:17:27
问题 I am unable to play sound using AudioToolbox Framework. My line of code : SystemSoundID soundID; CFURLRef soundFileURLRef; OSStatus error = AudioServicesCreateSystemSoundID((__bridge CFURLRef)(aFileURL), &aSoundID); After debug Show error ((OSStatus) error = -1500) . 回答1: The error code -1500 represents the constant kAudioServicesSystemSoundUnspecifiedError , which has the description "An unspecified error has occurred.". I'd double check that the URL can be read by your program, that the

Stopping and Quickly Replaying an AudioQueue

匆匆过客 提交于 2020-01-13 16:26:50
问题 I've got an audio queue that I've got playing, stopping, pausing correctly but I'm finding the AudioQueueStop() function to be taking a long time to execute. I'd like to immediately stop and then restart playing an audio queue and was wondering what the quickest way to do so would be. In my project I have multiple audio queues that I keep around to play specific sounds over and over. There is a situation where I must stop some of those sounds and then immediately play them and many more at

Record Internal Sound iPhone SDK

北城余情 提交于 2020-01-06 11:54:05
问题 I am making a app that requires internal sound to be recorded, any solutions? 回答1: The is no public iOS API that will allow you to record all internal sound that an app or the device can make. Only certain types of internal sound can be recorded, for instance sounds produced by an app using Audio Queues or the RemoteIO Audio Unit. For recording external sound, Apple's SpeakHere sample code might be appropriate. 来源: https://stackoverflow.com/questions/7620131/record-internal-sound-iphone-sdk

Sound does only work on Device but not in Simulator

隐身守侯 提交于 2020-01-04 08:05:14
问题 I am playing some short sounds on my iPad like so: Play a short sound in iOS I am using a caf file which I can successfully play from the Finder. Now I went through quite a bit of a hassle trying to achieve the playback of the sound and I am curious what might be the problems which I don't seem to understand: Option 1: When I create the SystemSoundID and then play it right away I don't hear anything on the device and the simulator. Option 2: When I create an instance variable for the

How to get System Volume iOS?

夙愿已清 提交于 2020-01-04 04:18:07
问题 I found an example here, but it does not work on ios6.1.3 (iphone 4s). always return 0.187500 Code: Float32 volume; UInt32 dataSize = sizeof(Float32); AudioSessionInitialize (NULL, NULL, NULL, NULL); AudioSessionGetProperty ( kAudioSessionProperty_CurrentHardwareOutputVolume, &dataSize, &volume ); NSLog(@"%f", volume); [AVAudioSession sharedInstance].outputVolume - also return 0.187500 回答1: You need to initialize the audio session with: AudioSessionInitialize (NULL, NULL, NULL, NULL); in

AudioServicesPlaySystemSound not working on iPad device

大兔子大兔子 提交于 2020-01-02 03:41:06
问题 I'm in the early stages of developing my first iPad application, and for simplicity I have so far been using AudioServicesPlaySystemSound and the associated functions to play sounds. My code is based the SoundEffect class from Apple's Metronome example. The specific symptom is that I can hear the sounds in the simulator but not on the device, though I have verified that I can hear sounds in other applications on the device. AudioServicesCreateSystemSoundID is returning valid sound identifiers