Resample audio in iOS - ios

I have a wave file recorded in 48000 sample rate. I need to play the recorded audio file in BLE device configured with 44100 sample rate. When the BLE device is disconnected from iPhone, i need to resume the playback in iPhone speaker which is configured by 48000 sample rate. So is it possible to resample the audio data to 44100 while sending data to connected BLE device
Please help

Yes, this is handled automatically for you if you use AVAudioPlayer.

Related

Send video stream by bluetooth on iPhone

I have a device with a camera and i want to connect to it using my iPhone via Bluetooth, so the question: is it possible to send real-time video stream by bluetooth using Swift/Objective - C?
It is not possible. The transmission speed of Bluetooth is not strong enough to stream a video in real-time to another device. If it was audio it is potentially a different story.
You can use bluetooth to transfer a video to another device, but not to stream as far as I know.

How to stream audio as data is downloaded?

How can I take data as it is being downloaded/received by my device and then play it through the iPhone speaker? I do not want to wait until the audio is fully downloaded.
Platform: iOS 8.0 +
File type: WAV
Sample Rate: 4000 Hz
Audio Type: PCM, 16 bit
Audio Channels: 1
To minimize latency, pre-enable the apps audio session and request very short buffer durations. Start the RemoteIO Audio Unit output running with the output callback polling a circular buffer, otherwise playing a bit of silence. Then format (resample if needed) and store samples of the wave file, as any portions of the wave file are received, in the circular buffer.

EZAudio doesn't work with Bluetooth devices

I am using EZAudio to playback streaming audio data. Here is the graph: AUConverter -> MultiChannelMixer -> Output. The converter is configured such that it converts audio data with a sampling rate of 48000 to device sampling rate (normally 44100). The audio data will be written into a converter node
AURenderCallbackStruct converterCallback;
converterCallback.inputProc = EZOutputConverterInputCallback;
converterCallback.inputProcRefCon = (__bridge void *)(self);
[EZAudioUtilities checkResult:AUGraphSetNodeInputCallback(self.info->graph,
self.info->converterNodeInfo.node,
0,
&converterCallback)
operation:"Failed to set render callback on converter node"];
This graph works well with iphone's speakers. But when I select a bluetooth device, the callback is no longer triggered and no audio is played.
If I remove the converter node, I can play the audio again with a bluetooth device, but the sound quality is terrible. Please help, what am I missing in order to play audio in a bluetooth device.
Thanks.

CoreBluetooth and audio stream

Can I transfer audio stream from one iOS device to other iOS device (for example from 4s to new iPad) using CoreBluetooth framework. Maybe BLE is too slow fo media streaming?
Bluetooth Low Energy (BLE) is not intended to stream data !
If you want to a stream you MUST use Bluetooth 2.X+EDR and an appropriate profile. Therefore, if you want to stream audio, you need a headset or A2DP profile.
CoreBluetooth API give only access to BLE devices.
Audio streaming wont work any good, since BLE can stream 20 byte packets at a time, with 37.5ms delay between each transfer on iOS5. So this would be laggy and as good as useless. There is always the possibility of buffering the data, but in the end, this is not a good way to stream audio.
|packet| --- 37.5ms --- |packet| --- 37.5ms --- |packet...

iOS: Route audio-IN thru jack, audio-OUT thru inbuilt speaker

My project involves a magnetic card reader device that plugs into the phono socket (ie only uses microphone)
Can I get my project to output sound through the inbuilt speaker while simultaneously listening for input from the device?
Research suggests this is not possible:
iPhone audio playback: force through internal speaker?
Force iPhone to output through the speaker, while recording from headphone mic
Audio Session Services: kAudioSessionProperty_OverrideAudioRoute with different routes for input & output
The only way round I can see is actually changing the audio session every time I wish to emit a sound.
Is this really the only option? And is it practical to do this? How long would it take for the audio session to reconfigure itself?

Resources