Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

There are a lot of questions about this problem on SO:

But really no one answer works for me.

How do I capture an image programmatically without the camera shutter sound activating?

share|improve this question
5  
To be clear, this is a solution for when the phone is not muted / vibrate mode. In that mode, no sound is made when taking a picture. –  New Alexandria yesterday
25  
@NewAlexandria I heard in Japan shutter sounds in vibration mode too. This is law requirement. –  k06a yesterday
3  
Btw AudioServicesPlaySystemSound will not play if device is muted. So Japanese devices will still make a sound when muted, but not when non-muted... –  Filip Radelic yesterday
add comment

This question has an open bounty worth +100 reputation from gAMBOOKa ending in 6 days.

One or more of the answers is exemplary and worthy of an additional bounty.

1 Answer

I used this code once to capture iOS default shutter sound (here is list of sound file names https://github.com/TUNER88/iOSSystemSoundsLibrary):

NSString *path = @"/System/Library/Audio/UISounds/photoShutter.caf";
NSString *docs = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
NSData *data = [NSData dataWithContentsOfFile:path];
[data writeToFile:[docs stringByAppendingPathComponent:@"photoShutter.caf"] atomically:YES];

Then I used third-party app to extract photoShutter.caf from Documents directory (DiskAid for Mac). Next step I opened photoShutter.caf in Audacity audio editor and applied inversion effect, it looks like this on high zoom:

enter image description here

Then I saved this sound as photoShutter2.caf and tried to play this sound right before captureStillImageAsynchronouslyFromConnection:

static SystemSoundID soundID = 0;
if (soundID == 0) {
    NSString *path = [[NSBundle mainBundle] pathForResource:@"photoShutter2" ofType:@"caf"];
    NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];
    AudioServicesCreateSystemSoundID((__bridge CFURLRef)filePath, &soundID);
}
AudioServicesPlaySystemSound(soundID);

[self.stillImageOutput captureStillImageAsynchronouslyFromConnection:
...

And this really works! I runs test several times, every time I hear no shutter sound :)

You can get already inverted sound, captured on iPhone 5S iOS 7.1.1 from this link: https://www.dropbox.com/s/1echsi6ivbb85bv/photoShutter2.caf

share|improve this answer
4  
What's wrong with this answer? stackoverflow.com/a/14063081/149533 –  Nestor yesterday
54  
Very cool. Only caveat is that when flash is turned on, this will result in a double shutter sound because the default system sound is not played when captureStillImageAsynchronouslyFromConnection: is called, but rather when image is actually captured (during flash sequence). Instead add a key-value observer on self.stillImageOutput for keyPath 'capturingStillImage' to detect when capture truly starts, then play inverse sound in callback method. –  jm333 yesterday
4  
This is how modern military aircraft defeat radar. This is why you don't see the "stealth shape" silhouette on new fighter designs: There is an electronics package that handles what is basically a radar-defeating phase shift that broadcasts an "inverted" (phase-shifted) duplicate signal. –  L0j1k yesterday
1  
@L0j1k: It depends on what kind of stealth ship you are talking about. The F22 an ilk aren't interested in being undetected but in being unlockable. Problem with phase shift technology is you are incredibly obvious from every other position, since they won't see the same shift. –  Guvante yesterday
2  
This is how noise-cancelling headphones work, except they capture the sound in realtime –  Daniel Serodio yesterday
show 1 more comment

protected by Cupcake 22 hours ago

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.