Why don't sounds save in interface builder?

How come sounds dont save in interface builder? i made a homer simpson sondboard and the sounds dont save on the buttons.

I haven’t used any custom sounds yet, as they would be inappropriate for my applications, so I can’t speak from experience. But, I would start here…


…and make sure that you are doing all of the things mentioned correctly. I read into the page at the url above and it seems to contain the info and links to more pages that should solve your problem. Pay particular attention to the “load sound” call, as a sound file that is not part of the core system sounds probably needs to be loaded before it can be used, much like a window. You may want to load it on ‘will open’ before the window using it is displayed, so it is available to your app until you pitch it. You might want to look into releasing it when you’re done with it too, to reduce overhead (if that’s an issue). I guess a guy putting homer simpson sounds into his apps probably isn’t interested in overhead, though :lol:

good luck…

Just copy your sound to the project (drag the sound file to the Resources folder in the Groups & Files area of your project) and make sure you check “Copy the items…” Then in IB, select the button and then in the Attributes pane of the Info Palette enter the name of the file in the Sound field. The only caveat is that you don’t add the extension. So if your sound is called Homer.mpg (or Homer.aiff, or whatever), just enter Homer in the Sound field. That’s it.


That didn’t work for him. When IB was opened again, none of the sounds were there.

(I was there at the time.)

yeah… pretty much i did that but if you start IB again the arnt there.

Although I did have success doing it jonn8’s way, it took a few minutes to get it right, and I had problems getting the sounds to appear in the IB sounds palette so I could actually use them. A more reliable and less troublesome method is…

  1. Select “Add Files…” from the the ‘Project’ menu in project builder. Select the sound file you want to put in. Make sure to check the “Copy item’s into destination group’s folder” checkbox at the top, and click ‘Add’. The file should appear in the resources folder or at the bottom of your files list in the ‘files’ window at left.

  2. Your sound file should now be available in the ‘Sounds’ tab in Interface builder. I used the sound file “hello.aiff”. Make sure to strip the extension, in this case the ‘.aiff’ part, and reference it as just “hello”.

  3. In the code for your button’s on clicked event, add the code…

on clicked theObject
	set theSound to load sound "hello" -- change 'hello' to your sound (without extension)
	play theSound
end clicked

This is all you should have to do. Using this method allows you a little more flexibility too, as you may want to only play the sound if certain environmental criteria are met when the button is pushed, rather than just playing when the button is depressed.

Check out the link in my first post, and also this link:
load sound

I was concerned that loading the sound every time the button was pushed might load multiple instances of the file and bloat the app memory usage, but I can find nothing to support this so I wouldn’t worry about it for now.

Hope this helps…

You can get around this by loading the sound into a property at launch and then just play the property at the proper time.