jass.generators
Class ColorSonificator

java.lang.Object
  extended by jass.engine.Out
      extended by jass.engine.InOut
          extended by jass.generators.ModalObjectWithOneContact
              extended by jass.generators.ModalObjectWithOneContactInterpolated
                  extended by jass.generators.ColorSonificator
All Implemented Interfaces:
Sink, Source

public class ColorSonificator
extends ModalObjectWithOneContactInterpolated

Map HSB color to [pitch reson-width loudness] Represent a color (h,s,b) by a noise source of loudness b, filtered through a reson bank with Shepard frequencies (i.e. octaves apart covering the audible range) and some damping d = 1*freq/freq_lowest. The hue h [0 1] will be mapped to an octave range in freq. (Note the dampings are also scaled when freq. is scaled to preserve scale invariance of octaves.) The saturation s [0 1] will be mapped to the "material" (i.e., the width of the resonances will be multiplied by a factor depending on the saturation.

Author:
Kees van den Doel (kvdoel@cs.ubc.ca)

Field Summary
 
Fields inherited from class jass.generators.ModalObjectWithOneContactInterpolated
ampR_new, R2_new, twoRCosTheta_new
 
Fields inherited from class jass.generators.ModalObjectWithOneContact
ampR, b1, b2, b3, c_i, modalModel, p1, p2, p3, R2, rollGain, srate, tmpBuf, twoRCosTheta, yt_1, yt_2
 
Fields inherited from class jass.engine.InOut
sourceContainer, sourcePassivity, srcBuffers
 
Fields inherited from class jass.engine.Out
buf, bufferSize, bufOld, lock
 
Constructor Summary
ColorSonificator(float srate, int bufferSize)
          Create and initialize.
 
Method Summary
protected  void createModalModel()
           
static double decibel(double a)
          Convert from level to decibel
 float getFudgePower()
          Get power in scaling law for gains a = a*d^fudgePower.
 float getMaximumLevelDifference()
          Get level difference between white and black
 float[] getSaturationLimits()
          Get damping range corresponding to saturation
 void setFudgePower(float p)
          Set power in scaling law for gains a = a*d^fudgePower.
 void setHSB_V(float h, float s, float b, float v)
          Set hue, saturation, brightness and slide velocity (1 = max)
 void setHSB(float h, float s, float b)
          Set hue, saturation and brightness
 void setMaximumLevelDifference(float dbmax)
          Set level difference between white and black
 void setSaturationLimits(float dmin, float dmax)
          Set damping range corresponding to saturation
 
Methods inherited from class jass.generators.ModalObjectWithOneContactInterpolated
allocate_new, computeLocation, computeModalFilterBank, computeResonCoeff
 
Methods inherited from class jass.generators.ModalObjectWithOneContact
addSource, allocate, clearHistory, computeBuffer, computeFilter, setDamping, setFrequencyScale, setGain, setLocation, setNf
 
Methods inherited from class jass.engine.InOut
addSource, getBuffer, getSources, removeSource, resetTime
 
Methods inherited from class jass.engine.Out
clearBuffer, copyToOld, getBuffer, getBufferSize, getTime, peekAtBuffer, setBufferSize, setTime, setTimeAndNotify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorSonificator

public ColorSonificator(float srate,
                        int bufferSize)
Create and initialize.

Parameters:
srate - sampling rate in Hertz.
bufferSize - Buffer size used for real-time rendering.
Method Detail

decibel

public static double decibel(double a)
Convert from level to decibel

Parameters:
a - level
Returns:
decibels = 20Log_10(a)

setFudgePower

public void setFudgePower(float p)
Set power in scaling law for gains a = a*d^fudgePower. .5 for constant energy but lower in practice because of critical band effect, to have d-independent loudness

Parameters:
p - fudgePower

getFudgePower

public float getFudgePower()
Get power in scaling law for gains a = a*d^fudgePower. .5 for constant energy but lower in practice because of critical band effect, to have d-independent loudness

Returns:
fudgePower

createModalModel

protected void createModalModel()

setSaturationLimits

public void setSaturationLimits(float dmin,
                                float dmax)
Set damping range corresponding to saturation

Parameters:
dmin - damping for saturated color
dmax - damping for unsaturated color

setMaximumLevelDifference

public void setMaximumLevelDifference(float dbmax)
Set level difference between white and black

Parameters:
dbmax - maximum level difference between white and black

getMaximumLevelDifference

public float getMaximumLevelDifference()
Get level difference between white and black

Returns:
maximum level difference between white and black

getSaturationLimits

public float[] getSaturationLimits()
Get damping range corresponding to saturation

Returns:
[minimumDamping maximumDamping]

setHSB_V

public void setHSB_V(float h,
                     float s,
                     float b,
                     float v)
Set hue, saturation, brightness and slide velocity (1 = max)

Parameters:
h - hue in range 0-1
s - saturation in range 0-1
b - brightness in range 0-1
v - velocity in range 0-1

setHSB

public void setHSB(float h,
                   float s,
                   float b)
Set hue, saturation and brightness

Parameters:
h - hue in range 0-1
s - saturation in range 0-1
b - brightness in range 0-1