RedDPCMencode differential pulse-code modulation
very simple ugen to encode signals as dpcm. it basically outputs the difference between adjacent samples.
see also: RedDPCMdecode
*ar(in, round)
*kr(in, round)
in - input signal
round - optional
dpcm(in, round)
language side
//--
s.boot
b= Buffer.read(s, "sounds/a11wlk01.wav")
a= {RedDPCMencode.ar(PlayBuf.ar(1, b, loop:1)).dup}.play
a.free
a= {PlayBuf.ar(1, b, loop:1).dup}.play
a.free
b.free
//--
a= {RedDPCMencode.ar(SoundIn.ar([0, 1]), MouseX.kr)}.play
a.free
//--control rate - compare with mouse full left and then full right
(
a= {
var x= Dust.kr(4);
SinOsc.ar([400, 800], 0, Decay.kr([x, RedDPCMencode.kr(x, MouseX.kr)], 0.5));
}.play
)
//--language side
(
a= RedDPCMencode.new;
[0, 0, 1, 0.6, 0.49, 0, -1].do{|x| a.dpcm(x, 0).postln}; ""
)
(
a= RedDPCMencode.new;
b= RedDPCMdecode.new;
[0, 0, 1, 0.6, 0.49, 0, -1].do{|x| b.dpcm(a.dpcm(x, 0)).postln}; ""
)
//--whispering
b= Buffer.read(s, "sounds/a11wlk01.wav")
a= {var src= PlayBuf.ar(1, b, loop:1); 5.do{src= RedDPCMencode.ar(src)}; (src*5).dup}.play
a.free
b.free