Packages

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).

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Friction
  2. Serializable
  3. ProductReader
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. 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

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  9. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. 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

  13. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  16. def read(in: RefMapIn, key: String, arity: Int): Friction
    Definition Classes
    FrictionProductReader
  17. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  18. def toString(): String
    Definition Classes
    AnyRef → Any
  19. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  20. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  21. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from Serializable

Inherited from ProductReader[Friction]

Inherited from AnyRef

Inherited from Any

Ungrouped