Project: SC_LightMeter

Access the ambient light sensors of a MacBook Pro via SuperCollider.

title: SC_LightMeter
platform: OS X on MBP only
language: C++/SC
license: GPLv2
created: 2007/09/01
tags: supercollider, osx, light

Download (tgz, 8KB)

Following work done by Amit Singh, this is a SuperCollider UGen bridge to the light detection subsystem of Mac OS X, using the ambient light sensors provided under the speaker grilles of the current MacBook Pro.

Two integer values are provided (0 .. 2000), corresponding to the light level detected by the left and right sensors. Note that there is some latency inherent to the system, with response times to light level changes around ~0.3s.

Usage

SynthDef(\lmu_test, {
	var data;
	
	var light = LightMeter.kr;
	var light_freq = Lag.kr(LinExp.kr(light, 0, 2000, 40, 5000), 0.1);

	data = SinOsc.ar(light_freq) * 0.3;
	data = data + CombN.ar(data, 0.1, 0.1, 2.0, 0.2);
	
	Out.ar(0, Pan2.ar(data));
}).store;

Synth(\lmu_test);