function Synth(osc=u'sine', freq=440, length=100, attack=0, decay=5)

A factory function that synthesizes a sound and returns it as a Sampler object.

Example:

my_sampler=Synth(freq=u'b2',length=500)

Keywords:

osc -- Oscillator, can be "sine", "saw", "square" or "white_noise".

Type: str, unicode

Default: 'sine'

freq -- Frequency, either an integer value (value in hertz) or a string ("A1", "eb2", etc.).

Type: str, unicode, int, float

Default: 440

length -- The length of the sound in milliseconds.

Type: int, float

Default: 100

attack -- The attack (fade-in) time in milliseconds.

Type: int, float

Default: 0

decay -- The decay (fade-out) time in milliseconds.

Type: int, float

Default: 5

Returns:

A sampler object.

Type: sampler

function copy_sketchpad(name)

Returns a copy of a sketchpad's canvas.

Example:

my_canvas=copy_sketchpad('my_sketchpad')my_canvas.show()

Arguments:

name -- The name of the sketchpad.

Type: str, unicode

Returns:

A copy of the sketchpad's canvas.

Type: canvas

function pause()

Pauses the experiment.

function register_cleanup_function(fnc)

Registers a clean-up function, which is executed when the experiment ends. Clean-up functions are executed at the very end, after the display, sound device, and log file have been closed. Clean-up functions are also executed when the experiment crashes.

function reset_feedback()

Resets all feedback variables to their initial state.

Example:

reset_feedback()

function set_subject_nr(nr)

Sets the subject number and parity (even/ odd). This function is called automatically when an experiment is started, so you only need to call it yourself if you overwrite the subject number that was specified when the experiment was launched.

n -- An int that indicates the number of columns and rows, so that n=2 indicates a 2x2 grid, or a (n_col, n_row) tuple, so that n=(2,3) indicates a 2x3 grid.

Type: int, tuple

spacing -- A numeric value that indicates the spacing between cells, or a (col_spacing, row_spacing) tuple.

Type: float

Keywords:

pole -- The refence point.

Type: tuple

Default: (0, 0)

Returns:

A list of (x,y) coordinate tuples.

Type: list

function xy_random(n, width, height, min_dist=0, pole=(0, 0))

Generates a list of random points (x,y coordinates) with a minimum spacing between each pair of points. This function will raise an osexception when the coordinate list cannot be generated, typically because there are too many points, the min_dist is set too high, or the width or height are set too low.

Example:

# Draw a 50 rectangles in a random gridc=Canvas()c.fixdot()forx,yinxy_random(50,500,500,min_dist=40):c.rect(x-10,y-10,20,20)c.show()

An (rho, phi) coordinate tuple. Here, rho is the radial coordinate, also distance or eccentricity. phi is the angular coordinate in degrees (i.e. not radians), and reflects a counterclockwise rotation, where 0 is straight right.