Unity - audio files play badly on iPhone and iPad - ios

Suddenly all my sounds sound really weird on the iphone and ipad, but they still sound ok in the Editor.
On the devices they sound similar to if they were played through a bad telephone connection over speaker - or if they were recorded with poor quality. And again, this only happens on the iPhone and iPad devices, in Unity itself it's all fine.
Things I tried already:
I have 3D sound disabled on the audio files
on the AudioSource, I have Bypass Effects, ByPass Listener Effects and Bypass Reverb Zones all set to 'true'
Doppler Level is set to 0
A while ago this was all good, and it may have happened when I updated to Unity 4.5.4 and XCode 6.0.1.
But I can't say that for sure.
Any ideas what that could be?

found it!
The problem was that in the Audio Settings 'Volume' was set 100 for some strange reason.
So - on the MAC the volume was set to small that's why it played ok - but on the iPhone it tried playing the loud sound so the speakers just went mad....

Related

No sound on some devices

I have a soundboard app that uses an AVAudioSession. I attach AVAudioPlayerNodes to an AVAudioEngine to play the audio files.
Everything works great on iOS 9.2, however a lot of my reviews say the sound doesn't work. And I just tried on an iPhone 5s running iOS 8 and the sounds do not work.
I cannot figure out why this is, given the app worked fine before I updated it. And I did not make any major changes to how the sound is produced. Is there any compatibility issues with AVFoundation and iOS8 or older devices I am not aware of?
Update: When I decreased the number of nodes attached to my engine, the sound works again. It seems some devices can't handle the amount of nodes I am attaching? Wondering if a workaround for this would be to make multiple engine objects instead of just one?

why is video volume low using MPMoviePlayerController on iPhone

My app uses MPMoviePlayerController to record videos and play them back. It works fine on iPad, but the volume is very low on iPhone. I tried setting up a AVAudioSession as well and setting the path to speaker, but that doesn't seem to help. How can I fix this? I am running iOS 7 devices

Music plays when volume turn off

I have next issue:
I use AudioServicesPlaySystemSound to play short sound in my app. But something happens wrong: when I turn off volume on the device - sound still playing.
I found this issue on devices with iOS 6.0 and greater. On iOS 5 device all right.
Can anybody point me what I do wrong?
Thanks.

iOS Simulator Sound

Is there a way to tell the iOS simulator which audio device connected to your computer you want it to use?
The simulator seems to pick whatever audio device is last connected to your machine. I've got a USB audio device (fasttrack pro) I use for my main sound playback and then a USB headset I use for my skype calls. More often than not, the simulator's audio is played on the headset instead of my main speakers.
Ok, I found that both the input and output device much match in system sound settings. Often I have them set to different devices. If they don't match, the simulator seems to default to the last connected audio device selected among the input and output devices.
On a related note: if you're like me and don't like interface sounds and therefore uncheck the preference "Play user interface sound effects" (Sound > Sound Effects), you'll need to check it to get sound out of the simulator.
I doubt the simulator has a setting for that, but you can set the main output device in System Preferences > Sound.
Don't know if this will fix your issue, but it fixed mine.
I wanted the iOS simulator to output sound through a device I had connected and not the internal speakers. When I select the System Prefs Sound and selected my device as output, it would not work.
So, I selected the Sound Effects tab from the Prefs - Sound window and selected my device under Play Sound effects Through and presto it worked.
Don't know the in-outs of iphone sound, but apparently mine were being treated as sound effects.
Hope that helps, if not, I gave it a shot.
Open iOS Simulator, under Hardware toolbar you can control Audio Input, Audio Output, and volume as well!
I think it was added at Xcode 9.2, and that it's available only when running simulator with iOS 11 and above
func vibratePhone() {
if (UIDevice.current.model == "iPhone") {
AudioServicesPlaySystemSound(1352)
} else {
AudioServicesPlayAlertSound(1105)
}
}
1352 Is the system sound ID for Vibration and 1105 is for Tock.caf if the user's device is an iPad or an iPod Tock.caf will be played in place of vibration.
Working on an audio project on my studio and still didn't got it working on MOTU Hardware with everything pointing to the interface! All system sounds route properly except the iOS Sim!
Did this workaround:
iOS Sim/OS X -> SoundFlower virtual I/O -> (Any audio program like Logic/Live) -> MOTU HW
This might give you the freedom to route your audio as you please ;)

iPad MoviePlayer refuses to play video until device restart

I have a very strange bug in a shipping iPad/iPhone app that I can't fix/track down.
My app plays video in a standard MPMoviePlayerController but with the interface hidden and my own buttons to play and stop.
That works fine but sometimes, after a few times of use, my app refuses to play any further video. This happens only on the iPad (in iOS 3.2.x), on the iPhone (in iOS 4.x) everything works fine all the time. Strangely enough, even after I quit my app, after I start it again it still refuses to play video. It doesn't save the video state, and it does reload the video. Only after I restart the iPad it starts working again.
If my iPad is in a "don't play video" state I can debug my app from Xcode and there isn't anything different other than the fact that the movie doesn't play but stays paused indefinitely.
The loadState property reports as MPMovieLoadStatePlayable, but the playbackState property stays MPMoviePlaybackStatePaused however many times I sent it a "play" command.
There is nothing I can do in my app (like choosing another video) to make the video work again.
The videos are 600 x 400 H.264 and are played in a view that is larger than full screen so I can show them full screen (without black bars) on the iPad without needing two different versions for iphone/ipad, because the devices have different aspect ratios.
There is plenty of RAM available (> 60 MB). Other apps that play video (iTunes/YouTube/streamToMe) play fine, but use the standard MoviePlayer interface/controls and don't of course don't play bigger than full screen.
This all makes me suspect this is an Apple bug. I haven't yet tested this in a beta version of iOS, and if so I couldn't talk about it either.
Anybody seen this behaviour? And has a possible solution? Thanks!
In this thread Ipad MPMovieplayerController video loads but automatically pauses when played it appears they solved the issue by using player.useApplicationAudioSession = NO;. Give it a try!
This is a quite common bug with MPMoviePlayerController on iPad OS 3.2.x
After a few runs of any app, the movies fail to play and if you move the scrubber you can see the frames but you can't still play the video for more than one frame at a time!
Besides you may notice a great memory consumption, due to the fact that some apps start receiving memory warnings more often than normal.
Finally you may prove this is a system problem (and not specifically an app problem) buy trying to run other apps that use the same framework, e.g. "ABC News". The issues cannot be seen with other apps that use UIWebView for instance (e.g. the ones based on You Tube videos).
The only solution is to re-boot the device. This works until next reboot.
Carlo

Resources