text: Muting or stopping sound of a background app and turning it on afterwards
  Hallo,
  I would like to imitate the effect when you hear music with one app A and then a voice message is played in another app B. App B then turns down the sound of App A running in background and playing the voice message and afterwards turning up the volume again.
  App A in my case is deezer and App B would be the Pythonista script, that would put out a signal sound to the user.
  Pausing music in a and turning it on afterwards would also work for me.
  Kind regards
  Bastian
  What happens when you play a sound now? Does it stop the other app entirely?
  I think there may be a avaudiosession option for that, but it's been a while.
  When I play a sound currently through sound.play_effect the music in the background just continues. But it is so loud, that I do not really notice the sound from Pythonista.
  xthis works, might be ways to simplify
  from objc_util import * s=ObjCClass("AVAudioSession").sharedInstance() s.setActive_error_(False,None) s.setCategory_withOptions_error_(ns('AVAudioSessionCategoryPlayback'),0x2,None) # s.setActive_error_(True,None) import sound sp=sound.Player('game:Bleep') sp.play() s.setActive_error_(False,None) s.setCategory_withOptions_error_(ns('AVAudioSessionCategoryPlayback'),0x1,None)
  option 2 means to "duck others". there is another option to interrupt others, but i cant seem to get that working.
  If we dont set active false at the end, the music stays softer.
  Im not entirely sure if the setActive is needed up front.