how to access recorded voices that recorded with Voice Memos or other Recorder Apps in swift 3 - ios

I read Similar questions like this question
I have an app that should access to recorded sound (with voice Memos or other Recording apps) - I don't want to record sound in my app - I just want to access the recorded sound - I know that there are some limits in Ios for doing this But I think It is possible please help me
Remember That I read Similar questions But My question is different because I don't want to record sounds in my app

Why don`t you try to use AVAudioPlayer of AVFoundationFramework?
You could also try some third-party framework like SwiftySound
https://github.com/adamcichy/SwiftySound
Just to mention: there is also a plenty of system sounds which is sometimes quite useful.
You can see the list at the following link
https://github.com/TUNER88/iOSSystemSoundsLibrary
You can play them by implementing AudioToolbox framework in your project.
Add this into a file (if you are using Objective-c)
#import <AudioToolbox/AudioToolbox.h>
Then run AudioServicesPlaySystemSound(PUT_SOUND_ID_HERE); somewhere.

Related

How protect music file downloaded by my music app?

I am need a solution for protect music file downloaded in an music app.
We have all rights for the audios, so, we need to garante only our app is able to play this audios.
This music app actually is only for streaming. The next update is for implement the functionality for download e play music offline.
I know Spotify , for example, use DRM protection, but it is a little bit controvercious for some people, and I think this is not what we need now.
During my researches, I dont find any concrete solution. So, my questions are which functionalities, libraries or resources can I use to protect the downloaded files.
Maybe I need to encrypt/decrypt the files? But, Swift have a native functionality for this, and have some documentation available?
So, what can I use to protect the audios with Swift, and keep playing the audio only in my own app?
This question gets asked almost daily and the answer is, and will always be, the same - if a user can play your audio on their device, then they can also extract and keep a copy of that audio - no amount of DRM, encryption or any other naive concept anyone dreams up can change this.
You can prevent "script kiddies" from just copying the files off their phone by embedding an encryption key in your app and streaming files through a stream cipher before playing them, but again, it's trivial to reverse engineer and get the key.
You can transcode your .mp3 files to HLS file which will generate one master playlist and several segment files and then you can apply ALS encryption on it using ffmpeg or Apple Media segmenter.
For More Info:
https://www.theoplayer.com/blog/content-protection-for-hls-with-aes-128-encryption

Can an iOS app passivly listen for a certain sound?

I know the iPhone responds to "hey Siri". Is there similar features that I can use in my app to listen for certain sounds? If so what is the name of the iOS framework to use?
No, there is no API for that. Hey Siri is part of the OS and has hardware-level support. Your app can only use the microphones while it’s running; there is support for keeping the app alive while it’s recording audio, but the battery impact would be severe—the device can’t go to sleep—so it would be extremely unlikely to pass app review. That said, if you’d like API support to be added in future, please file an enhancement request with the use case you have in mind.
Yes sure, you can implement a recorder that records from the microphone and then you check anything you may need from recorded files.
Btw, what do you mean by certain sounds?
I think it sounds a bit tricky so please elaborate on your question. What's the business reason? How will you perform "listen for certain sounds"? How do you check it for being "certain". I think it's quite a hard thing to do using iOS but maybe I got your question wrong.
UPDATE: According to your comment: yeah it's possible but not like "hey ios check if it's a gunshot" :)))
But I think you can do it by checking the volume of the sound. If it is loud then it's a gunshot. I think it will work since user will use it on purpose. Check this link.
Also, I saw a similar app for gun shooters. So I'm sure it's doable:)
So shortly: find the way to: 1. use microphone. 2. Listen to sounds. 3. Check the sound for volume/length 4. Try detecting by testing
PS: Be careful with shooting while coding :)
If your "certain" sounds are referring to spoken words. Apple has the Speech Recognition framework for determining particular words.
If you are trying to measure perhaps a particular frequency however, Like many guitar tuner apps use or other music recording type app, I would recommend checking in depth AVFoundation 's guide to audio engineering.

How to get another app's currently playing audio [duplicate]

This question already has an answer here:
Audio Information of Current Track iOS Swift
(1 answer)
Closed 6 years ago.
How can I access another app's currently playing audio - the actual audio item but metadata is welcome too. I can see that this question has been asked a lot but with few solutions being offered over the years. I understand apple's philosophy for probably not wanting an app to be able to do this. I also understand that such a request is probably outside of the iOS API. With that being said, I would really like some kind of solution.
Logically, I feel that
MPNowPlayingInfoCenter.defaultCenter().nowPlayingInfo
should return the info for whatever is currently playing; however, as others have mentioned, this value is always nil for audio being played outside of your app. Notably, popular audio apps seem to fail to use the MPNowPlayingInfoCenter class, making such audio fail to appear.
If using the default music app, one can use
MPMusicPlayerController.systemMusicPlayer().nowPlayingItem
However, what is a more consistent way to access audio playing through the podcasts app, Spotify, Pandora, Safari, etc?
Has anyone found a solution to this? Are there any old Objective-C frameworks that support this functionality?
One approach might be viable if there is there some way I can access the audio path of the item currently being played. For example, if I could get the path of the currently playing item, I could create an AV object from it:
AVAudioPlayer(contentsOfURL: audioUrl)
So is there a way I can get the audio url of the currently playing item and use it that way?
Is another approach better?
If a native solution does not exist, is it possible to bodge something together for it to work? Any advice or ideas welcome.
Edit: I don't believe anybody has been able to achieve this; however, I think a lot of people would like to. If this has been addressed, please link it! :)
This isn't currently possible in iOS. Just changing your AVAudioSession category options to .MixWithOthers, what will be an option to get info Song Info from other apps, causes your nowPlayingInfo to be ignored.
iOS only considers non-mixing apps for inclusion in MPNowPlayingInfoCenter, because there is uncertainty as to which app would show up in (e.g.) Control Center if there are multiple mixing apps playing at the same time.
Proposal: An option would be to use a music fingerprinting algorithm to recognize what is being played by recording it from your App.
Some interesting projects in this direction:
Gracenote https://developer.gracenote.com/ Gracenote (which is owned by Sony) has opened up it's SDKs and APIs and has a proper dev portal.
EchoNest & Spotify API http://developer.echonest.com/ Fusioned with Spotify since March 2016
ACRCloud https://www.acrcloud.com/ offers ACR solutions for custom files such as TV commercials, music tec

Does Media Player Framework need audio sessions to be managed?

I'd like to include a simple media player in my iOS 7+ app, and I've found some posts dealing with Media Player Framework and the MPMusicPlayerController, and I think that can meet my needs. However, I couldn't find the related documentation in Apple's docs, and instead I found that there are several frameworks related to managing audio in iOS apps.
I've taken a look into the Core Audio Overview and the "Sound" section in iOS Human Interface Guidelines, and I need to clarify if it is also needed to manage audio sessions when using Media Player Framework.
Thanks in advance
I finally found the answer in the Audio Session Programming Guide:
If your app is using a movie player only, or a music player only—and you are not playing your own sounds—then you should not configure an audio session.

Possible to use Apple system sounds in my iOS app?

Can you use the system sounds in your iOS app? I'm looking to have the same list that is used in the default timer app (Marimba, Alarm, Doorbell etc).
Reason i'm asking is that in Apple's own Multimedia docs it says:
Note: System-supplied alert sounds and system-supplied user-interface sound effects are not available to your application. For example, using the kSystemSoundID_UserPreferredAlert constant as a parameter to the AudioServicesPlayAlertSound function will not play anything.
Then i've come across this list of system sound ID's.
So can you use access and use these sounds in your own apps which will pass Apple's review process? If not are similar sounds available open source?
Actually if you use AudioToolbox/AudioToolbox.h framework and import it in your header file for the view controller, you can play Apple system sounds without jailbreaking. For example, putting
AudioServicesPlaySystemSound(0x450);
under an IBAction will play the Apple 'click' sound on the execution of the action.
Also, to hear the system sounds referenced earlier, there is a great app available on github that works on your iPhone (not the iOS simulator) that has the sounds for you to click and hear, as the documentation references them, but you cannot hear them. The app is nice to listen to and then find the corresponding reference number.
No, you are not able to access this sounds, until jailbreak, after jail break you can access this sounds like below.
AudioServicesPlaySystemSound(1000);
i hope this files are copyrighted.

Resources