Forum Archive

Sounds - library of existing or importing new

cjchallis

I have looked through documentation and websites but cannot find a comprehensive list of sounds available through the sound module or how to import custom sounds. I found the list of sounds available in omz Editorial, and it seems these are available in Pythonista as well. The Drum bonus example makes it seem like there are others.

In multiple places the documentation references a '+' option for adding sounds and images, but this does not appear for me.

Pythonista Version 1.5
iPhone 5S with iOS 7.1.2

omz

The + button didn't fit on the small iPhone screen, so this option is "hidden" in the copy/paste menu there. Just tap and hold the text cursor until the menu appears, and select "Insert..." (this only appears if no text is selected).

omz

As for importing sounds – there isn't an official way to do this right now, but it's possible to simply put sound files (in a supported format) into your script's folder and then call something like sound.play_effect('my_effect.caf') (you need to include the file extension, otherwise it'll look for built-in sound effects).

To get the sound file there, you could write a script that downloads it from the web, or you could transfer files from your Mac/PC using something like DiskAid.

ccc

Example script that downloads and plays .mp3 files from the web: https://github.com/cclauss/Pythonista_ui/blob/master/warp_speed.py

cjchallis

Great, thanks so much! These cover exactly what I was looking for.