Send custom data along with music (MP3) in iOS via Bluetooth - ios

AIM: I am trying to integrate my iPhone app with a bluetooth device that can play music and display some visualisation (yet to choose bluetooth hardware). There are three things that puzzles me:
I have seen some sample programs that generate visualisation data based on averagePowerForChannel using AVAudioPlayer. Is it possible to extract such information for a music stored in iPhone filesystem without actually (or before) playing the music? Since iPhone apps cannot execute in background infinitely, extracting this data realtime may not advised?
Once I create this "visualisation" data for an mp3, can how can I send the data to my bluetooth device? I know we can sent custom data only via BLE. Is there a possibility that I can send music data and visualisation data to the bluetooth device at the same time?(or sent visualisation data for a few seconds first and then start streaming the music) - This advice will help me to choose a proper hardware, provided iPhone supports this!
If I cannot sent music data and visualisation data at the same time over bluetooth, I am planning to extract visualisation data first from the mp3(how?), send it over to be stored in the bluetooth device and then display accordingly, in sync with the music data received in real time. Is this possible?

Related

Is there a way to communicate with smartphone remotely via a sensor without using internet?

I want to detect and send/recieve data from a smartphone in some vicinity without using internet.
I've always thought it would be fun to do this with audio. Most modern ways of modulating a signal (like OFDM) will sound like a white noise hiss over audio, and you should be able to get a few KB/s in a normal room environment if the phones are close to each other.
It also has the benefit that the user can always tell when it's transmitting.
Multiple methods are possible.
You could use a private (isolated) local area network that is not connected to the internet. Either ethernet cabled or over WiFi.
Airdrop might not require an internet connection (a WAN connected access point).
Bluetooth BLE communication doesn't require an internet connection. You could use an ESP32 or Raspberry Pi to read sensor data and have a mobile device connect over BLE to the ESP32 or Pi (or another mobile device).
You could use audio. Play FSK tones or Morse Code on one device and receive and decode the audio modulations on another device. (I've tried both of these methods successfully.) Or you could use a speech synthesizer on one device and a voice transcription app on another.
You could use light. Flash the flashlight (or LED) on one device, and receive and decode the light pulse sequences using the video camera another device. (There may be apps in the App store that can do this.) Or display a bar code or QR code on one device and use the camera on another to decode the data in the bar code or QR code.
You could use MIDI. Bluetooth MIDI over BLE from device to device. Or with MIDI cables, using a bunch of Lightning to USB and USB to Midi adapters.
You might be able to use vibrations from the Taptic engine on one device, and detect the vibration sequences using the motion sensor API on another device.
With many Android devices, you can connect a USB to serial port dongle, and use a long RS232 serial cable between devices.
With an iPhone, you could use a Lightning to Ethernet adapter, plus a fiber optic media converter, and send signals over several kilometers of (private) fiber optic cabling. etc.
You might want to use the IR sensor on your phone by using an IR sensor library. (Search it on a search engine). If the does not have that, you can use a QR code generator library (Search it on a search engine) to transfer your data.
You could use a raspberry pi (for example) to take readings from your sensor and store them. Make it run a webserver and create its own wifi network (not connected to the www) where you can access a webpage that displays the readings. Or you can set it up so that the Pi logs into the wifi hotspot from your phone whenever available and then uploads the data or sends it in an email or whatever.
You can use an internet module, for example the FONA 800 or 808 by Adafruit to let your Pi talk with the internet, via a SIM card from hologram.io for example. The Pi can talk to the FONA in Python. But to be honest that doens't really answer your question with the proximity thing - but if I were you I would drop that and do the following:
Read the data from the sensor and save it to a csv file on the Pi
Once every hour (or whatever), connect to the internet via FONA/hologram.io SIM
Insert the data from the previous hour to a remote mysql database
Use PHP or something to display the data from the database nicely and access via your phone
That way, you can have as many sensors as you want and access all from your phone. As I said the proximity thing is not relevant for me, it's easier imho to go through cellular (+ I wouldnt know how to do it over lets say bluetooth)

Get Audio Power Levels from Currently Playing Music on an iOS Device

I'm aiming to create an audio-visualisation app for iOS. I need to somehow tap into the current audio output from another app (such as Apple's music app, or Spotify) and get the amplitude of the signal for each sample of the music. I will then perform an FFT algorithm on the data to convert it to the frequency-domain and display the data visually.
Is it possible to read this data from the audio output of other apps? If so, what do I need to use to extract this data?
No. The iOS security sandbox will prevent the reading of any audio samples from other apps via any public API (unless the playing app was coded to explicitly export audio data via inter-app audio or other similar interface).

How to prevent recording of iOS screen using quicktime

So with iOS 8, we can now record the screen of iOS devices. I've searched extensively and cannot find a way to detect, let alone prevent, this recording. The app I'm working on deals with some potentially sensitive information and images and would like to prevent this if at all possible.
Thank you in advance for your responses and insights!
Anthony
Apparently, there is some way to detect whether a display or QuickTime streaming is connected, because the Netflix app will show an error when that is the case (which also means you can't just use an iOS device and stream to your computer to watch it in big). The app works perfectly if QuickTime streaming is off with the cable is plugged in.
Maybe it just detects whether an external display is connected, and screen recording behaves like that, so basically you might have some success with these APIs and notifications.
Also, you could use an encrypted HTTP Live Stream according to Apple which would be blacked out in the stream / the recording.

Send audio to bluetooth device with AVPlayer IOS

Hey I have a video app which uses AVPlayer, I received an email from a user saying he couldn't use his car's bluetooth anymore since I updated the app some time ago.
Now, I didn't tried to support bluetooth back then, but apparently this functionality came along with MPMoviePlayerController which I used before.
Is there a way to check if there's a bluetooth device connected and to send audio to it?
I've seen this question, but it didn't help, the volume control shows but no button letting me chose the output.
Do I have to do something else in order to use bluetooth as output?
I've only tested with my car's bluetooth, which works with phone calls and also other apps like Viber.

iOS accessory SDK - 3.5mm jack control

I want to create a project which will interact with the iPhone/iPad via the 3.5mm jack. There are a bunch of these accessories on kickstarter.com. Although, I could't find any SDK that will provide me the possibility to get data from jack input.
I have seen that some people at progical.com have a sort of SDK that can manage this kind of connection but they haven't answered me yet (I applied for their SDK few months ago). Is there any alternative for that? I want to make this project in order to get my degree so the Apple MFI won't apply.
The project will consist in a bunch of sensors that will send data to my app using 3.5 audio jack. Using my app, I will process the received data.
The 3.5" Jack connector is originally supposed to send and receive audio data. It means that if a connection is plugged in, the OS will automatically redirect all audio signals to it (with a few exceptions). Thus, you can access the data using the built-in audio processing APIs of iOS, for example CoreAudio and audio queues.
As an example, you can generate and receive signals of different frequencies, which can be used to control and get information from external devices (you'll need some kind of electrical engineering for this to work, though - filtering, separating control frequencies, etc.).

Resources