granular

class GranBase(grains, freq=10.0, jitter=0, random_offset=0, gain=1.0, offset=0.0)

Bases: object

Parameters
  • grains (array(array)) – An array of audio buffers that will be used as a grain cloud

  • freq (float) – Frequency in Hz that grains will be fired at

  • jitter (float) – Ammount of jitter to apply to the grain firing frequency

  • random_offset (int) – An ammount of randomness that determines the sequence in which grains are fired

  • gain (float) – An ammount of gain to apply to the output

  • offset (float) – An ammount of offset to apply to the output

Variables
  • freq_in_seconds (float) – The frequency represented as an ammount of time in seconds

  • current_grain (int) – The index of the currently playing grain

  • playing_grains (array) – An array of grain indecies that correspond to the grains currently playing

  • grain_positions (array(array)) – An array of indecies that correspond to the playback posistion of each grain

  • time (float) – The last value of time recieved

  • increment (int) – The number of grains to increment every time a grain is fired.

fire_grain()

A function that fires a grain and increments pointers accordingly

gain_to(gain)
Parameters

gain (float) – A value to change the gain to

get_pcm_value(time)
Parameters

time (float) – The time in seconds of which the PCM value should be gotten for

Returns

A PCM value for the granulator at a given time

Return type

float

get_sample(time)
Parameters

time (float) – The time in seconds of which the sample should be gotten

Returns

A PCM value for the granulator at a given time that has been adjusted with gain and offset

Return type

float

make_jitter()

A function that invokes an ammount of jitter on the grain firing frequency