object Friction extends ProductReader[Friction] with Serializable
A UGen implementing a physical model of a system with dry-friction. A chaotic filter.
The input is treated as the driving force in a physical model of a mass resting on a belt, which can stick or slip relative to the belt (depending on the friction between the two). The input represents the position of the belt, and the mass is held approximately in place by a spring and a damper. The output is the position of the mass, which in very high-friction situations will be exactly the same as the input – but when the other forces can overcome the friction then stick-and-slip alternations will typically occur.
Note that DC offset will have a qualitative effect on the system's behaviour (because of the spring being stretched), so feel free to experiment with adding/removing DC.
The model is inspired by the one considered in this research article: A. Luo and B. Gegg, Dynamics of a harmonically excited oscillator with dry-friction on a sinusoidally time-varying, traveling surface, International Journal of Bifurcation and Chaos, 16 (2006), pp. 3539–3566.
To create the system studied in that paper (which analyses chaotic stick-and-slip oscillations), the input should be a sinusoid added to an ever-increasing ramp value. But for musical effects you can do different things.
Examples
// filter a simple sine wave, producing a chaotic result play { val sig = SinOsc.ar(660) val out = Friction.ar(sig, friction = 5.41322e-5, mass = 8.05501) Pan2.ar(out, 0, 0.1) }
// modulate parameters by mouse. Left is original (modulated) sine wave, right is filtered play { val sig = SinOsc.ar((LFPulse.kr(0.5) + LFPulse.kr(0.33)).mulAdd(220, 440).lag(0.1)) val out = Friction.ar(sig, friction = MouseX.kr(0.00001, 0.03, 1), mass = MouseY.kr(0.2, 10, 1)) GESeq(sig, out) * 0.1 }
// Ringz oscillators, each with separate Friction, merged to create 'rusty' klank. play { // Note the way the effect changes as the sound dies away. val imp = Impulse.ar(1) * 0.1 val klank = Ringz.ar(imp, Seq(800, 1071, 1153, 1723)) val rusty = Friction.ar(klank, friction = 1.75584e-5, mass = 2.69789) Pan2.ar(Mix(rusty)) }
// play with DC offset and spring stiffness play { val sig = SinOsc.ar(330) + MouseX.kr(0.01, 10, 1) val out = Friction.ar(sig, friction = 5.41322e-5, mass = 8.05501, spring = MouseY.kr(0,1)) Pan2.ar(out * 0.1) }
// DC offset and spring stiffness for a control signal play { // Converts boring sinusoidal freq undulation into something much more interesting val sig = LFPar.kr(33) + MouseX.kr(0.01, 10, 1) val fr = Friction.kr(sig, friction = 5.41322e-5, mass = 8.05501, spring = MouseY.kr(0,1)) val out = SinOsc.ar(fr.linLin(-1, 1, 150, 500)) Pan2.ar(out * 0.1) }
This is a third-party UGen (MCLDUGens).
- Alphabetic
- By Inheritance
- Friction
- Serializable
- ProductReader
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def ar(in: GE, friction: GE = 0.5f, spring: GE = 0.414f, damp: GE = 0.313f, mass: GE = 0.1f, beltMass: GE = 1.0f): Friction
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def kr(in: GE, friction: GE = 0.5f, spring: GE = 0.414f, damp: GE = 0.313f, mass: GE = 0.1f, beltMass: GE = 1.0f): Friction
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def read(in: RefMapIn, key: String, arity: Int): Friction
- Definition Classes
- Friction → ProductReader
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated