Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Error -1500 using AudioServicesCreateSystemSoundID ?

higginshiggins Posts: 46Registered Users
edited August 2009 in iPhone SDK Development
Hey gang,

I've got a weird simulator error related to sounds. My app loads a series of sounds (12 of them) in AIFF 4:1 44.1kHz mono format, as exported by QuickTime Pro.

On the device, everything works fine and I get no errors related to sound.

However in the simulator, two of the sounds spit an error upon load:
2008-11-22 18:50:27.422 My App[9606:20b] Error -1500 loading sound at path: /Users/higgins/Library/Application Support/iPhone Simulator/User/Applications/537A8435-3AAE-4189-ABA7-0A7C7C0316AB/My App.app/applause_long.aif
2008-11-22 18:50:27.423 My App[9606:20b] Error -1500 loading sound at path: /Users/higgins/Library/Application Support/iPhone Simulator/User/Applications/537A8435-3AAE-4189-ABA7-0A7C7C0316AB/My App.app/laughter_final.aif

Now...it still seems to WORK (doesn't crash), but the error seems odd to me. I tried recompressing the files and otherwise fiddling around, but the simulator just doesn't seem to like them.

From some Googling, I gather that -1500 is an "unspecified" error. That ain't too helpful. The only difference about these sounds (versus the other 10) is that they're bigger files. The other 10 files are 64k or under (real tiny); these two are 116k and 252k (5 sec and 11 sec respectively)...still pretty tiny, right? Is it possible that this is related?
Post edited by higgins on

Replies

  • skinchinskinchin Posts: 3New Users
    edited November 2008
    Any progress toward a solution to this? I am having a similar problem, but seemingly regardless of caf file size.
  • higginshiggins Posts: 46Registered Users
    edited November 2008
    No progress on this issue. The app still seems to run fine on all my test devices (all flavors of iPhones and iPod touches) but the simulator still complains.
  • wyattbikerwyattbiker Posts: 18Registered Users
    edited April 2009
    higgins wrote: »
    No progress on this issue. The app still seems to run fine on all my test devices (all flavors of iPhones and iPod touches) but the simulator still complains.

    Anyone with answers to this? Sound plays on the device but not on the simulator. I tried both wav and aif. Small 6sec files <100k

    AudioServicesCreateSystemSoundID(baseURL, &pmph);
    returns an error, I am using iPod 2.2.1 and Mac OS X 10.5.5.
    Thanks


    Here is the code.
    	[self playSound: @"mysound" musicType: @"wav"] ;
    
    
    -(void)playSound: (NSString *) fileName musicType: (NSString *) fileType {
    	SystemSoundID pmph; 
    	id sndpath = [[NSBundle mainBundle] pathForResource:fileName ofType: fileType]; 
    	CFURLRef baseURL = (CFURLRef) [[NSURL alloc] initFileURLWithPath:sndpath];
    	OSStatus error=AudioServicesCreateSystemSoundID(baseURL, &pmph); 
    	if (error != kAudioServicesNoError) { // failed
    		NSLog(@"Error %d loading sound", error);
    	}
    	
    	AudioServicesPlaySystemSound(pmph);
    
    }
    
  • wyattbikerwyattbiker Posts: 18Registered Users
    edited April 2009
    wyattbiker wrote: »
    Anyone with answers to this? Sound plays on the device but not on the simulator. I tried both wav and aif. Small 6sec files <100k

    AudioServicesCreateSystemSoundID(baseURL, &pmph);
    returns an error, I am using iPod 2.2.1 and Mac OS X 10.5.5.
    Thanks


    Here is the code.
    	[self playSound: @"mysound" musicType: @"wav"] ;
    
    
    -(void)playSound: (NSString *) fileName musicType: (NSString *) fileType {
    	SystemSoundID pmph; 
    	id sndpath = [[NSBundle mainBundle] pathForResource:fileName ofType: fileType]; 
    	CFURLRef baseURL = (CFURLRef) [[NSURL alloc] initFileURLWithPath:sndpath];
    	OSStatus error=AudioServicesCreateSystemSoundID(baseURL, &pmph); 
    	if (error != kAudioServicesNoError) { // failed
    		NSLog(@"Error %d loading sound", error);
    	}
    	
    	AudioServicesPlaySystemSound(pmph);
    
    }
    


    UPDATE: After using Audacity to shorten the file in increments of 1sec, I found out only files <=4.9sec long will play in the simulator. File size is irrelevant (one file was 800K+) and Stereo at 44100. So anyone with ideas, or should I report this as a buig?

    I even used Apples 'caf' format.
  • higginshiggins Posts: 46Registered Users
    edited April 2009
    wyattbiker wrote: »
    UPDATE: After using Audacity to shorten the file in increments of 1sec, I found out only files <=4.9sec long will play in the simulator. File size is irrelevant (one file was 800K+) and Stereo at 44100. So anyone with ideas, or should I report this as a buig?

    I even used Apples 'caf' format.

    Interesting. Yeah, I have just been living with this issue (bug?) for a while now -- it definitely only affects the simulator, and does feel like an Apple bug to me. I have several apps in the store using these kinds of sound files, and they definitely work on customers' devices, make it through the approval process, etc.

    I'd say go ahead and radar it.
  • seanriceseanrice Posts: 86Registered Users
    edited April 2009
    Yea! We've seen this 4.9sec bug too, only ... I didn't realize until just now that the device would play a full 30. Still, .WAV files are humongously overfat files and if you've got something long to play ... AVFoundation looks to be the solution.

    I have a question, assuming one is just figuring all this out now (!) ... how does one free the resources allocated by a SystemSoundID played file properly?

    CODE:
    - (void)playSound:(NSString *)thisSound {
    NSLog(@"GVC:playSound: %@", thisSound);

    if (thisSound != nil) {
    SystemSoundID soundID;
    NSString *thisSoundsPath = [[NSBundle mainBundle] pathForResource:thisSound ofType:@"wav"];
    OSStatus err = AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:thisSoundsPath], &soundID);
    if (err) {
    NSLog(@"*** WARNING *** Error occurred assigning sound!");
    }
    AudioServicesAddSystemSoundCompletion(soundID, NULL, NULL, SoundFinished, thisSoundsPath);
    AudioServicesPlaySystemSound(soundID);
    CFRunLoopRun();
    }
    }

    When played, the sound calls this simple routine Constants.h:

    static void SoundFinished (SystemSoundID soundID, void *sound2dispose)
    {
    /* finished playing, freeing resources */
    AudioServicesDisposeSystemSoundID(sound2dispose);
    CFRelease(sound2dispose);
    CFRunLoopStop(CFRunLoopGetCurrent());
    NSLog(@"cleaning ... %@", sound2dispose);

    }

    BUT i'm crashing more now than ever. Obviously over-releasing or releasing too soon, i don't know.
  • dspecklebackdspeckleback Posts: 3New Users
    edited August 2009
    higgins wrote: »
    Hey gang,

    I've got a weird simulator error related to sounds. My app loads a series of sounds (12 of them) in AIFF 4:1 44.1kHz mono format, as exported by QuickTime Pro.

    On the device, everything works fine and I get no errors related to sound.

    However in the simulator, two of the sounds spit an error upon load:
    2008-11-22 18:50:27.422 My App[9606:20b] Error -1500 loading sound at path: /Users/higgins/Library/Application Support/iPhone Simulator/User/Applications/537A8435-3AAE-4189-ABA7-0A7C7C0316AB/My App.app/applause_long.aif
    2008-11-22 18:50:27.423 My App[9606:20b] Error -1500 loading sound at path: /Users/higgins/Library/Application Support/iPhone Simulator/User/Applications/537A8435-3AAE-4189-ABA7-0A7C7C0316AB/My App.app/laughter_final.aif
    

    Now...it still seems to WORK (doesn't crash), but the error seems odd to me. I tried recompressing the files and otherwise fiddling around, but the simulator just doesn't seem to like them.

    From some Googling, I gather that -1500 is an "unspecified" error. That ain't too helpful. The only difference about these sounds (versus the other 10) is that they're bigger files. The other 10 files are 64k or under (real tiny); these two are 116k and 252k (5 sec and 11 sec respectively)...still pretty tiny, right? Is it possible that this is related?

    I believed I've tracked down the cause of the -1500 error. I had a simple test app for sounds; which worked fine but when testing another sound, the mysterious -1500 error appeared. I was using a simple WAV file I grabbed from the net that was less than 1 second in duration. I discovered than when looking at 'More Info' on the file, the duration and frequency couldn't be determined; even though the file played perfectly in Audacity or iTunes. I loaded the file in Audacity and resaved it in the same format. The duration and frequency was now available and the -1500 error disappeared.

    So I suspect the real issue was a matter of formatting within the sound file (perhaps Windows vs Mac formatting)? Although I'm sure someone out there could shed more light on the actual issue, this resolved the problem for me. Hope this helps!
  • wyattbikerwyattbiker Posts: 18Registered Users
    edited August 2009
    I believed I've tracked down the cause of the -1500 error. I had a simple test app for sounds; which worked fine but when testing another sound, the mysterious -1500 error appeared. I was using a simple WAV file I grabbed from the net that was less than 1 second in duration. I discovered than when looking at 'More Info' on the file, the duration and frequency couldn't be determined; even though the file played perfectly in Audacity or iTunes. I loaded the file in Audacity and resaved it in the same format. The duration and frequency was now available and the -1500 error disappeared.

    So I suspect the real issue was a matter of formatting within the sound file (perhaps Windows vs Mac formatting)? Although I'm sure someone out there could shed more light on the actual issue, this resolved the problem for me. Hope this helps!

    I agree. I resaved and it worked.

    Also, FYI. mp3 formats play in simulator but not on device. For anyone wondering, stick with caf.
Sign In or Register to comment.