ofxPDSP
pdsp::GrainCloud Class Reference

Stereo "cloud" of really short sampled segments. More...

#include <GrainCloud.h>

Inheritance diagram for pdsp::GrainCloud:
pdsp::Patchable

Public Member Functions

 GrainCloud (int voices)
 
 GrainCloud (const GrainCloud &other)
 
GrainCloudoperator= (const GrainCloud &other)
 
float meter_env (int voice) const
 returns the last processed envelope amplitude value of the selected grain. This method is thread-safe.
 
float meter_position (int voice) const
 returns a value from 0.0f to 1.0f that broadly rapresent the "playhead" of the selected grain. This method is thread-safe.
 
float meter_jitter (int voice) const
 returns a value from -1.0f to 1.0f that rapresent the jitter of the selected grain. This method is thread-safe.
 
Patchablein_position ()
 Sets "position" as selected input and returns this module ready to be patched. This is the default input. Send a value between 0.0f and 1.0f to control the position of the grains inside the sample.
 
Patchablein_length ()
 Sets "length" as selected input and returns this module ready to be patched. Controls the grain length in milliseconds.
 
Patchablein_pitch ()
 Sets "pitch" as selected input and returns this module ready to be patched. Controls the grain pitch in semitones.
 
Patchablein_select ()
 Sets "select" as selected input and returns this module ready to be patched. Select the sample to stream from the ones previously added.
 
Patchablein_density ()
 Sets "density" as selected input and returns this module ready to be patched. Controls the density of the graincloud by reducing the distance between grain retriggerings.
 
Patchablein_distance_jitter ()
 Sets "distance_jitter" as selected input and returns this module ready to be patched. Controls a random value in millisecond that is added to the time between grain retriggerings.
 
Patchablein_position_jitter ()
 Sets "position_jitter" as selected input and returns this module ready to be patched. Grain position jitter control relative to the sample length. 0.0f = no jitter, 1.0f = position jitter as long as the entire sample lenght.
 
Patchablein_pitch_jitter ()
 Sets "pitch_jitter" as selected input and returns this module ready to be patched. Grain pitch jitter in semitones.
 
Patchablein_direction ()
 Sets "direction" as selected input and returns this module ready to be patched. A positive value makes the grains play forward, a negative in reverse.
 
Patchablech (size_t index)
 Uses the selected channel as output for the patching operation. 0 is for the left channel (default output) and 1 is for the right channel. Index values outside of range are remapped to 0 or 1. More...
 
int getVoicesNum () const
 returns the number of voices used for the graincloud.
 
void addSample (SampleBuffer *newSample)
 adds a pointer to a SampleBuffer to an internal array of SampleBuffer pointers More...
 
void setSample (SampleBuffer *samplePointer, int index=0)
 Sets the SampleBuffer pointer at the given index to a new pointer. More...
 
void setWindowType (Window_t type, int window_length=1024)
 sets the envelope window shape, optionally the resolution of the table. More...
 
- Public Member Functions inherited from pdsp::Patchable
void resetInputToDefault ()
 resets the selected input to the default.
 
void resetOutputToDefault ()
 resets the selected output to the default.
 
Patchablein (const char *tag)
 sets the selected input to the one tagged with "tag", if tag is a valid string, and returns this Patchable ready to be patched. More...
 
Patchableout (const char *tag)
 sets the selected output to the one tagged with "tag", if tag is a valid string, and returns this Patchable ready to be patched. More...
 
void disconnectIn ()
 disconnects all the outputs connected to the selected input, then resets the selected input to the default.
 
void disconnectOut ()
 disconnects all the inputs connected to the selected output, then resets the selected output to the default.
 
void disconnectAll ()
 disconnects all the inputs and outputs to their connected outputs and inputs. Also resets the selected input and output to the default.
 
InputNodegetSelectedInput ()
 returns the selected input, you can patch a Patchable or OutputNode to it with the >> operator.
 
OutputNodegetSelectedOutput ()
 returns the selected output, you can patch it to another Patchable or InputNode with the >> operator.
 
std::vector< std::string > getInputsList ()
 returns a vector of the valid input tags
 
std::vector< std::string > getOutputsList ()
 returns a vector of the valid input tags
 

Additional Inherited Members

- Protected Member Functions inherited from pdsp::Patchable
void addOutput (const char *tag, OutputNode &output)
 method to add outputs when constructing a Unit More...
 
void addInput (const char *tag, InputNode &input)
 method to add inputs when constructing a Unit More...
 
void addModuleOutput (const char *tag, Patchable &unit)
 method to add outputs when constructing a module More...
 
void addModuleInput (const char *tag, Patchable &unit)
 method to add outputs when constructing a module More...
 

Detailed Description

Stereo "cloud" of really short sampled segments.

By default it has 8 voices, but you can construct it with more voices if you use the non-default constructor.

Member Function Documentation

◆ addSample()

void pdsp::GrainCloud::addSample ( SampleBuffer newSample)

adds a pointer to a SampleBuffer to an internal array of SampleBuffer pointers

Parameters
[in]newSamplepointer to a SampleBuffer

◆ ch()

pdsp::Patchable & pdsp::GrainCloud::ch ( size_t  index)

Uses the selected channel as output for the patching operation. 0 is for the left channel (default output) and 1 is for the right channel. Index values outside of range are remapped to 0 or 1.

Parameters
[in]indexchannel index

◆ setSample()

void pdsp::GrainCloud::setSample ( SampleBuffer samplePointer,
int  index = 0 
)

Sets the SampleBuffer pointer at the given index to a new pointer.

Parameters
[in]samplePointerpointer to a sample buffer with a loaded file inside
[in]indexindex of the position of the sample to set inside the sample pointers table

◆ setWindowType()

void pdsp::GrainCloud::setWindowType ( Window_t  type,
int  window_length = 1024 
)

sets the envelope window shape, optionally the resolution of the table.

Parameters
[in]typewindow type
[in]window_lengthwindow length, if not specified 1024

The documentation for this class was generated from the following files: