‹ system.log Quartz Composer in SC ›

Separate Noisy and Pitched Sounds

2014-10-01 11:14 supercollider

clean-up: #38

Here's a little fun trick how to use the not so well known clarity mode of SuperCollider's built-in pitch tracker. Set the clar argument to 1 and then grab the second value returned. By default, this is a binary flag (hasFreq), but with clar=1 it becomes a continuous value 0.0 to 1.0.

The example below includes a one-second delay to be able to hear the sounds you make being panned left-right depending on how 'clear' they are. There's also a short lag and a curved mapping to make the example work better.

//example: noise in the left ear, clear tones in the right
//use headphones
{
  var src= DelayN.ar(SoundIn.ar, 1, 1);
  var clarity= Pitch.kr(src, clar:1)[1].lag(0.1);
  Pan2.ar(src, clarity.lincurve(0.1, 0.9, -1, 1, 4).poll);
}.play

As variations on the above one could easily mute noises...

//example: mute noise, only play pitched sounds
//use headphones
{
  var src= DelayN.ar(SoundIn.ar, 1, 1);
  var clarity= Pitch.kr(src, clar:1)[1].lag(0.1);
  Pan2.ar(src)*clarity.lincurve(0.1, 0.9, 0, 1, 4);
}.play

and of course by just flipping a value around we only play the noises...

//example: mute pitched sounds, only play noises
//use headphones
{
  var src= DelayN.ar(SoundIn.ar, 1, 1);
  var clarity= Pitch.kr(src, clar:1)[1].lag(0.1);
  Pan2.ar(src)*(1-clarity.lincurve(0.1, 0.9, 0, 1, 4));
}.play

last an example to demonstrate how to route signals to effects depending on clarity...

//example: pitched sounds with reverb
//use headphones
{
  var src= DelayN.ar(SoundIn.ar, 1, 1)*0.5;
  var clarity= Pitch.kr(src, clar:1)[1].lag(2);
  XFade2.ar(src, GVerb.ar(src, 50), clarity.lincurve(0.3, 0.9, -1, 1, -2).poll);
}.play

‹ system.log Quartz Composer in SC ›