new Mixer(renderer:GlRenderer, options:Object)
A mixer mixes two sources together.
Mixer example on codepen:
codepen
Mixmode
Mixers support a Mixmode
.
The Mixmode defines the curvature of the crossfade.
In a regular crossfade, source 1 would fade out while source 2 fades in. At the center both sources are then both at 50% opacity; however, 2 sources with 50% opacity only add up to ~75% opacity, not to 100%. This means that the output is darker in the middle of the crossfade then it is at both ends. This is the default Mixmode, the other modes play with these settings
1: NORMAL (default), regular, linear crossfade
2: HARD, switches with a hard cut at 50%
3: NAM, fades with an upward curvature forcing 100% opacity throughout the crossfade (lighter!)
4: FAM, fades with a downward curve, forcing a 'overlay' period
5: NON DARK, Never goes dark, 0-2 linear curve, capped at 1 and .36
6: LEFT, forces the pod on 0 (locks pod)
7: RIGHT, forces the pod on 1 (locks pod)
8: CENTER, forces both sources at ~66% (locks pod)
9: BOOM forces both sources at 100%, allows for overflow (lighter!) (locks pod)
Blendmode
Mixers also support a Blendmode
.
Think of them as the a Photoshop Blendmodes. They tell the mixer how to blend Source 1 and Source 2 together.
1 ADD (default),
2 SUBSTRACT,
3 MULTIPLY,
4 DARKEN,
5 COLOUR BURN,
6 LINEAR_BURN,
7 LIGHTEN,
8 SCREEN,
9 COLOUR_DODGE,
10 LINEAR_DODGE,
11 OVERLAY,
12 SOFT_LIGHT,
13 HARD_LIGHT,
14 VIVID_LIGHT,
15 LINEAR_LIGHT,
16 PIN_LIGHT,
17 DIFFERENCE,
18 EXCLUSION
Switch both mixer and blendmode in realtime:
mixer1.mixMode() // shows mixmode (default 1, NORMAL)
mixer1.mixMode(8) // set MixMode to BOOM
mixer1.blendMode(1) // set blendmode to ADD (default)
mixer1.blendMode(14) // set blendmode to VIVID_LIGHT
Move the pod up and down over time, or fade from source1 to source2 and back
again.
ar c = 0;
setInterval( function() {
c += 0.01
mixer1.pod ( ( Math.sin(c) * 0.5 ) + 0.5 );
})
Parameters:
Name | Type | Description |
---|---|---|
renderer:GlRenderer |
||
options:Object |
- Implements:
- Source:
Example
let myMixer = new Mixer( renderer, { source1: myVideoSource, source2: myOtherMixer });
Methods
bindBpm(binding)
binds currentBpmFunc to a function
whatever BPM currentBpmFunc returns will be bpm used.
it's called on update
Parameters:
Name | Type | Description |
---|---|---|
binding |
function | allows for overriding internal bpm |
- Source:
Example
var mixer1 = new Mixer( renderer, { source1: file, source2: file})
var audioanalysis = new AudioAnalysis( renderer, { audio: file })
audioanalysis.bindBPM( audioanalysis.getBPM() * 0.5 )
bindBpm(binding)
binds currentBpmFunc to a function
whatever BPM currentBpmFunc returns will be bpm used.
it's called on update
Parameters:
Name | Type | Description |
---|---|---|
binding |
function | allows for overriding internal bpm |
- Source:
Example
var mixer1 = new Mixer( renderer, { source1: file, source2: file})
var audioanalysis = new AudioAnalysis( renderer, { audio: file })
audioanalysis.bindBPM( audioanalysis.getBPM() * 0.5 )
blendMode(blendmode)
gets or sets the blendMode, there are 18 Blendmodes available, numbered 1-18;
1 ADD (default),
2 SUBSTRACT,
3 MULTIPLY,
4 DARKEN,
5 COLOUR BURN,
6 LINEAR_BURN,
7 LIGHTEN,
8 SCREEN,
9 COLOUR_DODGE,
10 LINEAR_DODGE,
11 OVERLAY,
12 SOFT_LIGHT,
13 HARD_LIGHT,
14 VIVID_LIGHT,
15 LINEAR_LIGHT,
16 PIN_LIGHT,
17 DIFFERENCE,
18 EXCLUSION
Parameters:
Name | Type | Description |
---|---|---|
blendmode |
integer | index of the Blendmode |
- Source:
bpm(bpm)
gets or sets the bpm or beats per minutes, locally in this mixer
defaults to 128
Parameters:
Name | Type | Description |
---|---|---|
bpm |
number | beats per minute |
- Source:
bpmMod(currentMod)
gets or sets the currentMOD or modifyer for the bpm
this way you can modify the actual tempo, make the beats
follow on half speed, or dubbel speed or *4, *2, /2, /4 etc.
Parameters:
Name | Type | Description |
---|---|---|
currentMod |
number | beat multiplyer for tempo |
- Source:
fade(fadeDuration)
fades from one channel to the other in duration milliseconds
Parameters:
Name | Type | Description |
---|---|---|
fadeDuration |
float | the duration of the fade |
- Source:
mixMode(mixmode)
gets or sets the mixMode, there are 8 MixModes available, numbered 1-9;
1: NORMAL (default), regular, linear crossfade
2: HARD, switches with a hard cut at 50%
3: NAM, fades with an upward curvature forcing 100% opacity throughout the crossfade (lighter!)
4: FAM, fades with a downward curve, forcing a 'overlay' period
5: NON DARK, Never goes dark, 0-2 linear curve, capped at 1 and .36
6: LEFT, forces the pod on 0 (locks pod)
7: RIGHT, forces the pod on 1 (locks pod)
8: CENTER, forces both sources at ~66% (locks pod)
9: BOOM forces both sources at 100%, allows for overflow (lighter!) (locks pod)
Parameters:
Name | Type | Description |
---|---|---|
mixmode |
integer | index of the Mixmode |
- Source:
pod(position)
the position of the handle, fader or pod. 0 is left, 1 is right
Parameters:
Name | Type | Description |
---|---|---|
position |
float | position of the handle |
- Source:
setAutoFade(autoFade)
sets setAutoFade true/false
Parameters:
Name | Type | Description |
---|---|---|
autoFade |
boolean | to do, or do not |
- Source: