Skip to content

Commit

Permalink
joshugens: converted help files & uncommented Tendency.sc
Browse files Browse the repository at this point in the history
Converted the rest of the old help files, excluding DelTapRd/Wr, and
deleted unneeded html help files. Also, uncommented the Tendency.sc
class source, so that the examples in Tendency help file are useable.
So, that's it- done! 71/71 old help files converted.
  • Loading branch information
dotinspace committed Jun 19, 2016
1 parent 097bf71 commit 69761fe
Show file tree
Hide file tree
Showing 13 changed files with 1,049 additions and 1,101 deletions.
144 changes: 144 additions & 0 deletions source/JoshUGens/sc/HelpSource/Classes/PV_BinBufRd.schelp
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
TITLE:: PV_BinBufRd
summary:: Plays FFT data to a memory buffer
categories:: Libraries>JoshUGens, UGens>FFT
related:: Classes/PV_RecordBuf, Classes/PV_BinPlayBuf, Classes/PV_BufRd, Classes/PV_PlayBuf

DESCRIPTION::
WARNING:: Resynth of a FFTs with large window sizes may cause CPU spikes.::

WARNING:: Unlike link::Classes/PV_BufRd::, PV_BinBufRd needs to have an FFT Ugen preceding it in the processing chain.::

note:: link::Classes/PV_RecordBuf:: stores FFT data to a buffer for use by a number of PV UGens.::

CLASSMETHODS::

METHOD:: new

ARGUMENT:: buffer
The FFT buffer to fill data into.

ARGUMENT:: playbuf
The buffer to read frames of FFT data from.

ARGUMENT:: point
A value between 0.0 and 1.0. 0.0 is the beginning of the file, 1.0 the end. Values greater then 1.0

ARGUMENT:: binStart
note::
With binStart, binSkip and numBins, you have some control over which bins to synthesize:
list::
## binStart = 0
## binSkip = 2
## numBins = 10
## bins to synthesize = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]::
::

ARGUMENT:: binSkip
See binStart.

ARGUMENT:: numBins
See binStart.

ARGUMENT:: clear



INSTANCEMETHODS::


EXAMPLES::

code::
// anazlyze a soundfile and store its data to a buffer

s.boot;

(
var sf;
// path to a sound file here
p = Platform.resourceDir +/+ "sounds/a11wlk01.wav";
// the frame size for the analysis - experiment with other sizes (powers of 2)
f = 1024;
// the hop size
h = 0.25;
// get some info about the file
sf = SoundFile.new( p );
sf.openRead;
sf.close;
// allocate memory to store FFT data to... SimpleNumber.calcPVRecSize(frameSize, hop) will return
// the appropriate number of samples needed for the buffer
y = Buffer.alloc(s, sf.duration.calcPVRecSize(f, h));
// allocate the soundfile you want to analyze
z = Buffer.read(s, p);
)

// this does the analysis and saves it to buffer 1... frees itself when done
(
SynthDef("pvrec", { arg recBuf=1, soundBufnum=2;
var in, chain, bufnum;
bufnum = LocalBuf.new(1024);
Line.kr(1, 1, BufDur.kr(soundBufnum), doneAction: 2);
in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 0);
// note the window type and overlaps... this is important for resynth parameters
chain = FFT(bufnum, in, 0.25, 1);
chain = PV_RecordBuf(chain, recBuf, 0, 1, 0, 0.25, 1);
// no ouput ... simply save the analysis to recBuf
}).add;
)

a = Synth("pvrec", [\recBuf, y, \soundBufnum, z]);

// you can save your 'analysis' file to disk! I suggest using float32 for the format
// These can be read back in using Buffer.read

y.write(p++".scpv", "wav", "float32");

// play your analysis back ... see the playback UGens listed above for more examples.
(
SynthDef("pvplay", { arg out=0, recBuf=1, playbuf, clear = 0.0;
var in, chain, bufnum;
bufnum = LocalBuf.new(1024);
chain = FFT(bufnum, PlayBuf.ar(1, playbuf, BufRateScale.kr(playbuf), loop: 1));
// MouseX points into file. start at bin 10, skip 3, resynth 50
chain = PV_BinBufRd(chain, recBuf, MouseX.kr(0, 1), 10, 3, 5, clear);
Out.ar(out, IFFT(chain, 1).dup);
}).add;
);

// mix the resynth and data from the recBuf
b = Synth("pvplay", [\out, 0, \recBuf, y, \playbuf, z, \clear, 0.0]);

b.free;

// zero out the data in the FFT buf that ins't read in from recBuf
b = Synth("pvplay", [\out, 0, \bufnum, x, \recBuf, y, \playbuf, z, \clear, 1.0]);

// stop the synth
b.free;

// play your analysis back ... use multiple PV_BinBufRd ugens.
(
SynthDef("pvplay", { arg out=0, recBuf=1, playbuf, clear = 0.0;
var in, chain, bufnum;
bufnum = LocalBuf.new(1024);
chain = FFT(bufnum, PlayBuf.ar(1, playbuf, BufRateScale.kr(playbuf), loop: 1));
// MouseX points into file. start at bin 10, skip 3, resynth 50
chain = PV_BinBufRd(chain, recBuf, MouseX.kr(0, 1), 10, 3, 50, clear);
chain = PV_BinBufRd(chain, recBuf, MouseX.kr(0.1, 0.9), 10, 3, 50, 0.0);
Out.ar(out, IFFT(chain, 1).dup);
}).add;
);

// mix the resynth and data from the recBuf
b = Synth("pvplay", [\out, 0, \recBuf, y, \playbuf, z, \clear, 0.0]);

b.free;

// zero out the data in the FFT buf that ins't read in from recBuf
b = Synth("pvplay", [\out, 0, \bufnum, x, \recBuf, y, \playbuf, z, \clear, 1.0]);

// stop the synth
b.free;
// free the buffers
[y, z].do({arg me; me.free});
::
120 changes: 120 additions & 0 deletions source/JoshUGens/sc/HelpSource/Classes/PV_PlayBuf.schelp
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
TITLE:: PV_PlayBuf
summary:: Plays FFT data to a memory buffer
categories:: Libraries>JoshUGens, UGens>FFT
related:: Classes/PV_RecordBuf, Classes/PV_BinPlayBuf, Classes/PV_BufRd, Classes/PV_BinBufRd,

DESCRIPTION::
PV_PlayBuf will play back FFT data stored to a buffer with link::Classes/PV_RecordBuf::.

warning:: Resynth of a FFTs with large window sizes may cause CPU spikes.::

note:: link::Classes/PV_RecordBuf:: stores FFT data to a buffer for use by a number of PV UGens.::


CLASSMETHODS::

METHOD:: new

ARGUMENT:: buffer
The FFT buffer to fill data into.

ARGUMENT:: playbuf
The buffer to read frames of FFT data from.

ARGUMENT:: rate
Rate of playback of FFT data. Fractional time frames will use linearly interpolated phase and magnitude values. Can be negative.

ARGUMENT:: offset
An integer number of frames to offset into the playbuf file. Defaults to 0.0.

ARGUMENT:: binStart

ARGUMENT:: binSkip

ARGUMENT:: numBins

ARGUMENT:: loop

ARGUMENT:: clear


INSTANCEMETHODS::


EXAMPLES::

code::
// anazlyze a soundfile and store its data to a buffer

s.boot;

(
var sf;
// path to a sound file here
p = Platform.resourceDir +/+ "sounds/a11wlk01.wav";
// the frame size for the analysis - experiment with other sizes (powers of 2)
f = 1024;
// the hop size
h = 0.25;
// get some info about the file
sf = SoundFile.new( p );
sf.openRead;
sf.close;
// allocate memory to store FFT data to... SimpleNumber.calcPVRecSize(frameSize, hop) will return
// the appropriate number of samples needed for the buffer
y = Buffer.alloc(s, sf.duration.calcPVRecSize(f, h));
// allocate the soundfile you want to analyze
z = Buffer.read(s, p);
)

// this does the analysis and saves it to buffer 1... frees itself when done
(
SynthDef("pvrec", { arg bufnum=0, recBuf=1, soundBufnum=2;
var in, chain;
Line.kr(1, 1, BufDur.kr(soundBufnum), doneAction: 2);
in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 0);
bufnum = LocalBuf.new(1024, 1); // uses frame size from above
// note the window type and overlaps... this is important for resynth parameters
chain = FFT(bufnum, in, 0.25, 1);
chain = PV_RecordBuf(chain, recBuf, 0, 1, 0, 0.25, 1);
// no ouput ... simply save the analysis to recBuf
}).add;
)
a = Synth("pvrec", [\recBuf, y, \soundBufnum, z]);

// you can save your 'analysis' file to disk! I suggest using float32 for the format
// These can be read back in using Buffer.read

y.write(p++".scpv", "wav", "float32");

// play your analysis back ... see the playback UGens listed above for more examples.
(
SynthDef("pvplay", { arg out=0, recBuf=1;
var in, chain, bufnum;
bufnum = LocalBuf.new(1024, 1);
chain = PV_PlayBuf(bufnum, recBuf, MouseX.kr(-1, 1), 50, 1);
Out.ar(out, IFFT(chain, 1).dup);
}).add;
);
b = Synth("pvplay", [\out, 0, \recBuf, y]);

// stop the synth
b.free;

// vary the rate... experiment with different FFT sizes and overlaps in the analysis:
(
SynthDef("pvplay", { arg out=0, recBuf=1;
var in, chain, bufnum;
bufnum = LocalBuf.new(1024, 1);
chain = PV_PlayBuf(bufnum, recBuf, LFNoise2.kr(0.2).range(-1, 2), 0, 1);
Out.ar(out, IFFT(chain, 1).dup);
}).add;
)
b = Synth("pvplay", [\out, 0, \recBuf, y]);

// stop the synth
b.free;

// free the buffers
[y, z].do({arg me; me.free});
::
105 changes: 105 additions & 0 deletions source/JoshUGens/sc/HelpSource/Classes/PV_RecordBuf.schelp
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
TITLE:: PV_RecordBuf
summary:: Records FFT data to a memory buffer
categories:: Libraries>JoshUGens, UGens>FFT
related:: Classes/PV_RecordBuf, Classes/PV_BinPlayBuf, Classes/PV_BufRd, Classes/PV_BinBufRd,


DESCRIPTION::
PV_RecordBuf stores FFT data to a buffer for use by a number of PV UGens.


CLASSMETHODS::

METHOD:: new

ARGUMENT:: buffer
The FFT buffer.

ARGUMENT:: recbuf
The buffer to save frames of FFT data to.

ARGUMENT:: offset
An integer number of frames to offset into the recbuf file. Defaults to 0.

ARGUMENT:: run
If > 0.0, store data to the recbuf.

ARGUMENT:: loop
If > 0.0, when the end of the databuf is reached, new data will begint o overwrite old data.

ARGUMENT:: hop
The hop size used in the FFT analysis UGen (this allows the link::Classes/PV_Player:: UGens to check for consistency).

ARGUMENT:: wintype
The windowing type used in the FFT analysis UGen (this allows the link::Classes/PV_Player:: UGens to check for consistency).



INSTANCEMETHODS::


EXAMPLES::

code::
// anazlyze a soundfile and store its data to a buffer

s.boot;

(
var sf;
// path to a sound file here
p = Platform.resourceDir +/+ "sounds/a11wlk01.wav";
// the frame size for the analysis - experiment with other sizes (powers of 2)
f = 2048;
// the hop size
h = 0.5;
// get some info about the file
sf = SoundFile.new( p );
sf.openRead;
sf.close;
// allocate memory to store FFT data to... SimpleNumber.calcPVRecSize(frameSize, hop) will return
// the appropriate number of samples needed for the buffer
y = Buffer.alloc(s, sf.duration.calcPVRecSize(f, h));
// allocate the soundfile you want to analyze
z = Buffer.read(s, p);
)

// this does the analysis and saves it to 'y'... frees itself when done
(
SynthDef("pvrec", { arg recBuf=1, soundBufnum=2;
var in, chain, bufnum;
bufnum = LocalBuf.new(2048, 1);
Line.kr(1, 1, BufDur.kr(soundBufnum), doneAction: 2);
in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 0);
// note the window type and overlaps... this is important for resynth parameters
chain = FFT(bufnum, in, 0.25, 1);
chain = PV_RecordBuf(chain, recBuf, 0, 1, 0, 0.5, 1);
// no ouput ... simply save the analysis to recBuf
}).add;

a = Synth("pvrec", [\recBuf, y, \soundBufnum, z]);
)

// you can save your 'analysis' file to disk! I suggest using float32 for the format
// These can be read back in using Buffer.read

y.write(p++".scpv", "wav", "float32");

// play your analysis back ... see the playback UGens listed above for more examples.
(
SynthDef("pvplay", { arg out=0, recBuf=1;
var in, chain, bufnum;
bufnum = LocalBuf.new(2048);
chain = PV_PlayBuf(bufnum, recBuf, 1, 0, 1, 1, 0.25, 1);
Out.ar(out, IFFT(chain, 1).dup);
}).add;
);
b = Synth("pvplay", [\out, 0, \recBuf, y]);

// stop the synth
b.free;

// free the buffers
[y, z].do({arg me; me.free});

::
Loading

0 comments on commit 69761fe

Please sign in to comment.