What would the best method be for mixing background iPod music with sound effects? The sound effects need to be adjustable and sometimes much louder than the background music. When I use MPMusicPlayerController the volume is system-wide and reduces the effects volume as well. I have been reading about AVPlayer and AVAudipPlayer but can't seem to locate a viable solution.
Any help and suggestions would be greatly appreciated.
The problem is that you cannot play much louder sound over iPod music library because as you wrote iPod music use system volume. Unless the music files in your iPod library is compressed with very low volume.
Cocos 2D framework integrates very nice way how to mix-up more sound sources, but again it uses AVAudioPlayer for background music and Open AL for other sounds.
Have you looked at AVAudioSession Categories? I think that could help you with your problem. The docs at Apple.
Related
Here (link) can be found a method (related to AVAudioSession) to force playing audio through iPhone speaker. However, on macOS, there seems no such a class AVAudioSession. Is it possible to force playing audio through speaker on macOS (btw also with the max volume)? Thank you.
In iOS I can play a system sound with the following code:
// import this
import AVFoundation
// create a sound ID, in this case its the tweet sound.
let systemSoundID: SystemSoundID = 1016
// to play sound
AudioServicesPlaySystemSound (systemSoundID)
There is this link https://github.com/TUNER88/iOSSystemSoundsLibrary to a list of available system sounds in iOS
My question is are system sounds available in tvOS? and which ones are available.
SO I found the Answer. . .
The above code works fine on an actual Apple TV. It does not work in the simulator. (It plays no system sounds in the Simulator.) Must be a bug.
I'm using Xcode version 7.3 and the 9.3 tvOS Simulator.
The above link to a list of sound files seems to work. I've tried 5 different systems sounds that work.
If the sound doesn't play in the simulator but does play on a live Apple TV, it might be that you've disabled user interface sounds.
To enable, load the System Preferences, select Sounds, and then tick the Play user interface sound effects checkbox (and also increase the Alert volume)
When you play the system sound, it should play in the simulator now.
I tried setting the iPod volume level before, but it affected the volume of my app, which uses MPMusicPlayer. Any solution to this?
If your app is playing music locally (not affecting the iPod app) you can use MPMusicPlayerController to create an application music player and then set the volume property to whatever you want.
MPMusicPlayerController Class Reference
I'm making a sound for the iPhone and I'm interested in adding background music and background sounds.
Is CoreAudio right for the job?
And if so, how do I use it?
If you're just playing background music and doesn't need advanced controls, try AVAudioPlayer.
For sound effects, use AudioServicesPlaySystemSound.
I need to develop some sort of application featuring Editing Movie slices, Adding and editing images, Adding sound . recording movie, Adding effects, setting transitions between movie clips and images.
so is there any provision in SDK 3.0? I will use iPhone 3GS
Please Help Me.
Thanks
Unfortunately, there isn't a lot of support for a program like this on the iPhone yet. With the 3GS and OS 3.0, your program can let the user record a video and trim it, but everything after that is left to you to do from scratch. You get the filename of the recorded video, but there are no OS calls to even do something as simple as find out how many seconds of video there are.