Welcome to pippi’s documentation!


Anti-copywrite. Do whatever you would like with this software.

dsp.alias(snd, passthru=False, envelope=None, split_size=0)[source]

A simple time domain bitcrush-like effect.

The sound is cut into blocks between 1 and 64 frames in size if split_size is zero, otherwise split_size is the number of frames in each block.

Every other block is discarded, and each remaining block is repeated in place.

Set passthru to True to return the sound without processing. (Can be useful when processing grains in list comprehensions.)

By default, a random amplitude envelope is also applied to the final sound.

dsp.bln(length, low=3000.0, high=7100.0, wform='sine2pi')[source]

Time-domain band-limited (citation needed) noise generator.

Generates a series of single cycles of a given wavetype at random frequences within the supplied range.

Sounds nice & warm, if you ask me.

dsp.breakpoint(values, size=512)[source]

Takes a list of values, or a pair of wavetable types and values, and builds an interpolated list of points between each value using the wavetable type. Default table type is linear.

dsp.cache(s='', clear=False)[source]

Simple write() wrapper to create and clear cache audio

dsp.env(audio_string, wavetype='sine', fullres=False, highval=1.0, lowval=0.0, wtype=0, amp=1.0, phase=0.0, offset=0.0, mult=1.0)[source]

Temp wrapper for new env function


frames to hz


hz to frames

dsp.iscrossing(first, second)[source]

Detects zero crossing between two mono frames


Read a 44.1k / 16bit WAV file from disk with the Python wave module. Mono files are converted to stereo automatically.

dsp.split(string, size, chans=2)[source]

split a sound into chunks of size N in frames, or by zero crossings


split a stereo sound into a list of mono sounds

dsp.stretch(snd, length=None, speed=None, grain_size=120)[source]

Crude granular time stretching and pitch shifting

dsp.tone(length=44100, freq=440.0, wavetype='sine', amp=1.0, phase=0.0, offset=0.0)[source]

Synthesize a tone with the given params.

Possible wavetypes:

  • sine2pi or sine
  • cos2pi or cos
  • hann
  • tri
  • saw or line
  • isaw or phasor
  • vary
  • impulse
  • square

Length is given in frames.

dsp.transpose(snd, amount)[source]

Change the speed of a sound. 1.0 is unchanged, 0.5 is half speed, 2.0 is twice speed, etc.

This is a wrapper for audioop.ratecv in the standard library.

dsp.wavetable(wtype='sine', size=512, highval=1.0, lowval=0.0)[source]

The end is near. That’ll do, wavetable()

dsp.write(audio_string, filename, timestamp=False, cwd=True)[source]

Write audio data to renders directory with the Python wave module

lists.eu(length, numpulses)[source]

A euclidian pattern generator

>>> dsp.eu(12, 3)
[1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]

>>> dsp.eu(12, 5)
[1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0]
lists.interleave(list_one, list_two)[source]

Interleave the elements of two lists.

>>> dsp.interleave([1,1], [0,0])
[1, 0, 1, 0]
lists.list_split(items, packet_size)[source]

Split a list into lists of a given size

>>> dsp.list_split(range(10), 3)
[[0, 1, 2], [3, 4, 5], [6, 7, 8]]
lists.packet_shuffle(items, size)[source]

Shuffle the items in a list at a given granularity >= 3

>>> dsp.packet_shuffle(range(10), 3)
[0, 1, 2, 5, 4, 3, 8, 7, 6]

>>> dsp.packet_shuffle(range(10), 3)
[1, 2, 0, 4, 3, 5, 7, 6, 8]
lists.rotate(items, start=0, vary=False)[source]

Rotate a list by a given (optionally variable) offset

>>> dsp.rotate(range(10), 3)
[3, 4, 5, 6, 7, 8, 9, 0, 1, 2]

>>> dsp.rotate(range(10), vary=True)
[6, 7, 8, 9, 0, 1, 2, 3, 4, 5]

>>> dsp.rotate(range(10), vary=True)
[8, 9, 0, 1, 2, 3, 4, 5, 6, 7]

Takes an integer (truncated to between -32768 and 32767) and returns a single frame of sound.

utils.cap(num, max, min=0)[source]

Takes a number and a maximum and minimum cap and returns a truncated number within (inclusive) that range:

>>> dsp.cap(500, 1, 0)

>>> dsp.cap(-42424242, 32767, -32768)

Returns the length of a sound in frames

>>> dsp.flen(dsp.tone(dsp.mstf(1))) == dsp.mstf(1)
utils.log(message, mode='a')[source]

Write to a temporary log file at ~/pippi.log for debugging. Set mode to “w” or similar to truncate logs when starting a new session.


Takes a float between -1.0 to 1.0 and returns a single frame of sound. A wrapper for byte_string()

utils.scale(low_target, high_target, low, high, pos)[source]

Takes a target range (low, high) and source range (low, high) and a value in the source range and returns a scaled value in the target range.

To scale a value between 0 and 1 to a value between 0 and 100:

>>> print dsp.scale(0, 100, 0, 1, 0.5)

Coarse time measurement useful for non-realtime scripts.

Start the timer at the top of your script:


And stop it at the end of your script to print the time elapsed in seconds. Make sure dsp.quiet is False so the elapsed time will print to the console.


Convenience function that formats a datetime string for filenames:

>>> dsp.timestamp_filename()


tune.ntf(note, octave=4, ratios=None)[source]

Note to freq


Note to index returns the index of enharmonic note names or False if not found


Add two sounds together.


Multiply two sounds together.


Multiply a sound by a constant.


Envelope and control curve generation.


Generate a single cycle of a waveform.


Apply an envelope to a sound.


Wave folding synthesis.


Invert a sound.


Mix an arbitrary number of sounds together.


Multiply two sounds together.


Just your average pinecone.


Pulsar synthesis.


Change speed.


Subtract one sound from another.


Synthy. Depreciated: use tone() with a python wavetable instead


Wavetable synthesis.


Read from a wavetable

Indices and tables