playSoundFileNamed: // SKAction: Error playing sound resource

s0 = [SKAction playSoundFileNamed:@"JJF0A3007.caf" waitForCompletion:YES];



I am loading several sounds into instance variables to be used in a rapid fire situation. I want the entire file to play. It worked in iOS 9 but iOS 10 some (not all) of the sounds are getting cut short and I am wondering why?


According to the documentation the function is supposed to be used for short sounds (all of these sounds are about a second in length)


In the log, it says: SKAction: Error playing sound resource


What is also odd about this is that the game is similar to simon says with numbers and recites the numbers using the same iVar's (obj-c) before the user does.

When the user touches a tile, it creates a few sequence items and sandwiches the actions in between two blocks.

It's not the greatest structure but up until now it has worked.


working example is on the app store ( free download) its called japanese tiles

Replies

Hi


We experience the same issues right now.. 😟

It uses high memory as well. And SKAudioNode is buggy too.. What a mess..


Maybe AVAudioPlayer will work

Bugs in a new version of Sprite Kit? Without Apple response?


That's never happened before.... right?


Well, not except for every release of Sprite Kit.


Dear Apple Management:


1. Hire more programmers

2. Empower programmers to manage their projects

2.a) empower them to speak on behalf of their projects, and pay them enough to spend some time willing doing it

3. Hire writers to discuss and articulate how/what are best practices and massively improve the "documentation".

4. Hire other programmers to write unit tests, demos and examples of the above


It's not rocket science. And you've got more than enough money to do this for all frameworks, and still make billions in profit each couple of weeks.

I answered this thread: http://stackoverflow.com/questions/39534902/sprite-kit-why-does-playing-sound-return-error/39538947#39538947

I guess that you have about the same scenario. But there is a bug. Please report it. I've filed a bug report.

Can you file a bug report and attach a sample app that reproduces the issue so we can investigate/debug?


Thank you

I have already filed a bug report (28350796) with a link to the SO thread, but you rejected it because of lack of information. I've now updated the bug report with a zipped project that does exactly what I described in the SO thread. Hope that will do...

Can someone at Apple that deeply knows Sprite Kit make a range of little micro demos that showcase the right/best/ideal way to use each part/feature of Sprite Kit, and then someone else setup a script that uses these as unit tests for the rest of time?


This will save everyone a lot of time.

I have the same problem. I tried removing the pre-loading as suggested in the Stackoverflow thread, but it doesn't help. Sounds don't play even once.


All the games I created with SpriteKit have this error now. The apps are deployed for iOS9.3, and they work fine on iOS9.3.

However, sound doesn't play on any device running iOS 10.0.2. I tried deploying for iOS10 but it doesn't make any difference.

Simulator running iOS 10.0 (14A345) works fine. The sound also plays properly when previewed in Xcode 8.


Could it be that iOS10 no longer understands the sound format (the simulator does because it runs on macOS)? I'm using this to convert my samples


afconvert -f caff -d LEI16@11025 -c 1 "$FNAME-tmp.wav" -o "dist/sfx/$FNAME.caf"

I tried to convert my sound files as pointed out in the post above, but no luck. Simply no change in behavior.


The first time when I play a sound file in my app, it plays it only about 2 seconds. Then after a new sound is played again, it's playing the missing part of the first sound (basically pick up after it was cut off after 2 seconds). Very strange.

I have also the same problem after installing Xcode 8 and Target iOS 10. Is there a kind of a workaround.

Any progress on this? I reported the same bug and then it was marked as "duplicate". But the duplicate is still marked as "open". My games out in the App Store have been broken with no sound effects for weeks now since the release of iOS 10 and I've heard no news from Apple whatsoever. This is unacceptable.

Just to clarify,

I wasn't saying that converting the files like that would fix the issue. I was rather asking if THAT conversion would be the issue, because that's how I convert my sound effects.

The sounds have always worked before, so it doesn't make sense that they don't work now in iOS10, but maybe they dropped support of some encoder or something...

What a mess 😟

Apple, please do something.

We've been more than one month in the dark.

Hi there, same issue here, trying to just load 5 different gunfire sounds (1 second long wav files), it either plays them the first 4-5 times, then they sound muffled, or they sound muffled from 1st instance.


I'm on xcode 8, ios10.


My code:


let playSoundEffect = SKAction.playSoundFileNamed("sound\(arc4random()%5)", waitForCompletion: false)


run(playSoundEffect)


(my files are named sound0.wav - sound4.wav)


The above is called when user fires.

Any solution to this would be great


Cheers
Filippos

I am seeing the same issues as reported on this post. I even tried to use the SKAudio object, but there is a lag when calling it with accelerated sound events. As mentioned, this used to work and recently broke. We need your help.


Thanks!

Wondering if there has been any progress. It is year 2018 now. Stuck with the same. File plays normally but after some time SKAction: Error loading sound resource: .abc.caf

Stuck for the 5th day. Appreciate any light.

I get the same issue on Xcode 12 and iPad simulator.

Found a solution in Stackoverflow:
"When you select your sound file in XCode, access the inspector on the right side, then make sure the file is selected for your target(s)."

For me:
This solves my problem, thanks. When I drag m4a into project, the target is unmarked by default, but for mp3 or CAF file the target is marked by default. Is it the normal behavior of Xcode?