Skip to content

Instantly share code, notes, and snippets.

@HeinrichApfelmus
Created February 15, 2012 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HeinrichApfelmus/1838304 to your computer and use it in GitHub Desktop.
Save HeinrichApfelmus/1838304 to your computer and use it in GitHub Desktop.
Strange behavior with stereo panning in hsc3-0.9
import Control.Exception
import qualified Sound.SC3 as SC
-- Haskell version
incorrectPan = withSuperCollider $ do
SC.audition $ SC.out 0 $
0.2* SC.balance2 (osc 220) (osc 220) mod (SC.constant 1)
getChar
where
osc freq = SC.sinOsc SC.AR (SC.constant freq) (SC.constant 0)
mod = SC.sinOsc SC.KR (SC.constant 0.2) (SC.constant 0)
withSuperCollider = bracket_
(SC.withSC3 $ \fd -> SC.send fd (SC.g_new [(1, SC.AddToTail, 0)]))
(SC.withSC3 $ \fd -> SC.send fd (SC.n_free [1]))
-- Presumably equivalent SuperCollider code
{-
(
SynthDef.new("test-balance", {
Out.ar(0,
0.2 * Balance2.ar(SinOsc.ar(220,0), SinOsc.ar(220,0), SinOsc.kr(0.2,0))
) }).play;
)
-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment