
Neutralizing the iOS camera click sound through active sound cancellation - dmd
http://stackoverflow.com/questions/23758875/capture-image-via-capturestillimageasynchronouslyfromconnection-with-no-shutter
======
TorKlingberg
I wonder if Apple is intentionally forcing the shutter sound, to prevent
secret upskirt shots. I know several phones have had shutter sounds that
cannot be disabled, and some countries have required it. In that case Apple
might reject apps that use this trick.

~~~
general_failure
Shutter sound is required by law in many countries.

~~~
baddox
_Many_ countries? South Korea is the only one I can find a source for online.
In Japan it appears to only be a voluntary choice among device manufacturers.

[https://www.privacyinternational.org/reports/south-
korea/ii-...](https://www.privacyinternational.org/reports/south-korea/ii-
surveillance-policy)

~~~
hrktb
"voluntary" choice in Japan is basically the regulators telling the carriers
that if they don't do it they'll have to regulate. From the carrier's point of
view, it's a matter of doing it now in friendly terms, or doing it tomorrow
with the regulators on their back.

------
ertdfgcb
This is a really cool solution to a problem that really seems like it
shouldn't exist.

~~~
pliu
It's all relative. There are probably a lot of subway riding Japanese ladies
that would argue that this problem really really should exist.

~~~
greggman
How do you figure? The same laws don't apply to digital cameras which come on
all shapes and sizes.

~~~
sosborn
When you are holding a camera, the intent is somewhat obvious. When you are
holding a phone, not so much. That's the real separation.

~~~
greggman
Cameras come in all different shapes and sizes. I can get cameras that look
like cellphones. I can even get keychain cameras for $4 off eBay and put them
in my shoes. Set them to video and shoot hours of up skirt shots.

The law does nothing to stop people who want to take pictures without you
knowing they're doing it. Anyone who wants to will. The law is pointless

~~~
Pitarou
No, it is not pointless.

The point of this law is to create the perception that the authorities are
doing something about the perceived epidemic of upskirt photography.

The same authorities also erect signs next to escalators warning people that
upskirt photography is a crime. They serve the same purpose: to make
escalator-riding ladies feel that the authorities are watching out for them.

Don't knock it. It works.

------
mschuster91
How is this possible? Doing ANC would require the sound to be played at the
_exact same microsecond_ as the target sound.

~~~
colanderman
Closer to exact same millisecond. 44.1 kHz sampling rate + 64(ish)-sample
buffer granularity = ~1 millisecond.

~~~
chronial
Even that is an overly harsh requirement. While being close does not
completely remove the sound but still does severly reduce its volume:

[http://www.wolframalpha.com/input/?i=sin%28x%29+-+sin%28x-0....](http://www.wolframalpha.com/input/?i=sin%28x%29+-+sin%28x-0.2%29%2C+sin%28x%29+-+sin%28x-0.5%29%2C+sin%28x%29)

~~~
colanderman
No, not really. If you're off by a millisecond (the minimum, assuming
64-sample buffers and 64 kHz sampling rate), frequencies which are even
multiples of 500 Hz will be nullified, those which are odd multiples of 500 Hz
will be _amplified_ , and the rest will fall somewhere between those extremes.
(This is known as a "comb filter"; see [1] and [2].)

Your examples demonstrate the behavior of such filtering only for frequencies
much less than 500 Hz, which will indeed be attenuated. However, a camera
"click" sound, being both brief and noisy, contains lots of high-frequency
content which will be, on the whole, preserved.

In fact, assuming the "click" sound can be approximated by white noise, its
total energy will be _doubled_ by such filtering!

So yes, you _do_ need to play the sounds within the same millisecond.

[1]
[http://en.wikipedia.org/wiki/Comb_filter](http://en.wikipedia.org/wiki/Comb_filter)

[2]
[http://en.wikipedia.org/wiki/File:Comb_filter_response_ff_ne...](http://en.wikipedia.org/wiki/File:Comb_filter_response_ff_neg.svg)

------
ja27
Barely related, but it's surprising how often DSLR newbies show up on
photography forums asking how to disable the shutter sound on their cameras.

------
JosephRedfern
Is this how noise-cancelling headphones work?

~~~
jayd16
Everyone is getting really excited because they think this is how it works,
but no, not exactly.

The shutter sound comes from the same speaker as the anti-shutter sound. The
phone is mixing the tracks together and playing nothing.

It's _not_ like both sounds are played and they neutralize each other as sound
waves.

~~~
ANTSANTS
Inverted sound waves can cancel each other in air, I've heard (or not heard)
the effect with my own ears.

~~~
jayd16
Sure, but my point is that there is only one speaker involved so the
cancellation happens in the electronics, before any sound is made.

~~~
kordless
It's interesting to think of 'cancellation' in different mediums. Waves in
physical space. Radio in electromagnetism. And now 'computed' waves cancel
each other too.

------
rrggrr
Hilarity from the comments: I wish I could upvote twice: once for the
inverted-cancelling hack, and once for answering your own question, just to
counteract anyone daft enough to downvote you for that. – Daniel Earwicker 1
hour ago

~~~
georgiecasey
i think that was aimed at me. i said in a now deleted comment:

> Wow! Even though I know it's allowed, some coolness points deducted for
> posting the question yourself :-). I'd definitely do the same though. I'd be
> stopping random people in the street telling them the hack!

i know posting and answering your own questions is encouraged on SO, it was
just a joke!

~~~
soundoflight
It looks like he posted it AND answered it at the same time though, which is
really weird.

~~~
m_myers
There's a checkbox at the bottom of the "Ask" screen that lets you write your
answer before posting the question. Makes it easier to document a piece of
knowledge if you don't have a blog to post it on.

[http://stackoverflow.com/help/self-
answer](http://stackoverflow.com/help/self-answer)

------
vpdn
Awesome hack! If anyone wants try it out and play around, here's a demo
project:
[https://github.com/vpdn/SilentPhotoCaptureDemo](https://github.com/vpdn/SilentPhotoCaptureDemo)

------
inafewwords
Another trick is to use a dummy cord. Use a broken headset and cut off the
jack. Plug that into the phone.

Diverts sound to headset which doesn't exist. Or just put on a working set of
headphones

------
pygy_
Apple owns the copyright of the shutter sound.

That's enough to reject an app using this trick.

~~~
0x0
I guess the app could read the shutter audio file and invert it on the fly, it
doesn't need to ship with the inverted sound upfront. As a bonus it would
likely work even if future OS updates changed the sound (well, unless they
moved the file so it would no longer be found)

------
happyscrappy
On Android you can record without the user knowing which is way cooler.

~~~
cpach
Is that really true?

~~~
happyscrappy
Only if you side load apps and give full permissions.

