Open Piano YEG placed upright pianos in outdoor public spaces in 2014 and 2015 (see the Make Something Edmonton page for more information). Inside one piano was placed a Raspberry Pi physical computing device which recorded music as passers-by played. Using decibel levels, it detected when people were playing and when they stopped, recording only when music was being made. Highlights can be heard here.
The code for recreating this device is open source and can be found at this github repo.