omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Quick Tip: Using iOS System Sound Effects

    Pythonista
    6
    8
    8530
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • omz
      omz last edited by

      Just a quick tip if you're bored with the standard sound effects that are included with Pythonista:

      You can actually use a lot of standard iOS sound effects as well (e.g. the various text message sounds). Here's how:

      import os
      import sound
      import time
      
      for dirpath, dirnames, filenames in os.walk('/System/Library/Audio/UISounds'):
          for f in filenames:
              if f.endswith('.caf'):
                  full_path = os.path.join(dirpath, f)
                  sound.play_effect(full_path)
                  time.sleep(1)
      

      As of iOS 7.1, there are 99 of them. Have fun!

      1 Reply Last reply Reply Quote 0
      • gregory.pease.280
        gregory.pease.280 last edited by

        Any hope for future support for playing music?

        1 Reply Last reply Reply Quote 0
        • ccc
          ccc last edited by

          http://omz-forums.appspot.com/pythonista/post/6155976625356800 change the file extension from .mp3 to .caf... It would probably be a cool update to Pythonista if it played .mp3 files without requiring that you change the file extension to .caf.

          1 Reply Last reply Reply Quote 0
          • pruppert222
            pruppert222 last edited by

            Ha. Nice. It's just fun to play that script and hear them all.

            1 Reply Last reply Reply Quote 0
            • kirorp
              kirorp last edited by

              Here a list of some sounds with there names http://theiphonewiki.com/wiki//System/Library/Audio/UISounds

              1 Reply Last reply Reply Quote 0
              • ccc
                ccc last edited by

                blue_box_dialer.py ;-)

                # http://en.wikipedia.org/wiki/Blue_box
                # http://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling
                
                # Change the phone number below and then hold your iOS device next
                # to an off-the-hook phone and the DTMF tones will make the call.
                #
                # Phone companies have learned a lot since the days of phreaking so
                # you should expect any calls made to appear on your monthly bill.
                
                phone_number_to_dial = '0081787881218'  # '12345#,765#,*'
                
                import os, sound, time
                
                fmt = '/System/Library/Audio/UISounds/dtmf-{}.caf'
                
                def dial_number(in_phone_number = phone_number_to_dial):
                    def dial_digit(in_digit):
                        if in_digit == ',':  # a comma is a 2 second pause
                            time.sleep(2)
                        else:
                            sound.play_effect(fmt.format(in_digit))
                            time.sleep(0.3)  # changes the dial speed
                
                    print('Dialing: %s' % in_phone_number)
                    in_phone_number = in_phone_number.replace('#', 'pound').replace('*', 'star')
                    for digit in in_phone_number:
                        dial_digit(digit)
                
                dial_number(phone_number_to_dial)
                
                1 Reply Last reply Reply Quote 0
                • omz
                  omz last edited by

                  Haha, awesome!

                  1 Reply Last reply Reply Quote 0
                  • TiffanyAlvarado
                    TiffanyAlvarado last edited by

                    This post is deleted!
                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post
                    Powered by NodeBB Forums | Contributors