Module pippi.soundbuffer

Functions

rebuild_buffer

def rebuild_buffer(
    ...
)

Classes

SoundBuffer

class SoundBuffer(
    /,
    *args,
    **kwargs
)

A sequence of audio frames representing a buffer of sound.

Class variables

avg
channels
dur
frames
mag
samplerate

Methods

adsr
def adsr(
    ...
)
clear
def clear(
    ...
)

Writes zeros into the buffer, adjusting the size if length > 0.

clip
def clip(
    ...
)
cloud
def cloud(
    ...
)

Create a new Cloud from this SoundBuffer

convolve
def convolve(
    ...
)
copy
def copy(
    ...
)

Return a new copy of this SoundBuffer.

cut
def cut(
    ...
)

Copy a portion of this soundbuffer, returning a new soundbuffer with the selected slice.

This is called cut for historical reasons, but it might be better understood if renamed to slice as it doesn't modify the source SoundBuffer in any way.

The start param is a position in seconds to begin cutting, and the length param is the cut length in seconds.

Overflowing values that exceed the boundries of the source SoundBuffer will return a SoundBuffer padded with silence so that the length param is always respected.

dub
def dub(
    ...
)

Dub a sound or iterable of sounds into this soundbuffer starting at the given position in fractional seconds.

snd.dub(snd2, 3.2)

To dub starting at a specific frame position use:

snd.dub(snd3, framepos=111)

env
def env(
    ...
)

Apply an amplitude envelope to the sound of the given type.

To modulate a sound with an arbitrary iterable, simply do:

snd * iterable

Where iterable is a list, array, or SoundBuffer with the same # of channels and of any length

fill
def fill(
    ...
)

Truncate the buffer to the given length or loop the contents of the buffer up to the given length in frames.

grains
def grains(
    ...
)

Iterate over the buffer in fixed-size grains. If a second length is given, iterate in randomly-sized grains, given the minimum and maximum sizes.

graph
def graph(
    ...
)
max
def max(
    ...
)
mix
def mix(
    ...
)

Mix this sound in place with a sound or iterable of sounds

pad
def pad(
    ...
)

Pad this sound with silence at start or end

pan
def pan(
    ...
)

Pan a stereo sound from pos=0 (hard left) to pos=1 (hard right)

Different panning strategies can be chosen by passing a value to the method param.

method='constant' Constant (square) power panning. This is the default.

method='linear' Simple linear panning.

method='sine' Variation on constant power panning using sin() and cos() to shape the pan. Taken from the floss manuals csound manual.

method='gogins' Also taken from the csound manual -- Michael Gogins' variation on the above which uses a different part of the sinewave.

rcut
def rcut(
    ...
)

Copy a portion of this SoundBuffer of the given length in seconds starting from a random position within it.

This will always return a complete SoundBuffer without overflows or added silence, and the entire sound will be returned without added silence if a length that exceeds the length of the source SoundBuffer is given -- unlike SoundBuffer.cut() which will pad results with silence to preserve the length param if an invalid or overflowing offset position is given.

remix
def remix(
    ...
)
repeat
def repeat(
    ...
)
reverse
def reverse(
    ...
)
reversed
def reversed(
    ...
)
speed
def speed(
    ...
)

Change the speed of the sound

stretch
def stretch(
    ...
)

Change the length of the sound without changing the pitch. Uses the csound mincer phase vocoder implementation from soundpipe.

taper
def taper(
    ...
)
toenv
def toenv(
    ...
)
towavetable
def towavetable(
    ...
)
transpose
def transpose(
    ...
)

Change the pitch of the sound without changing the length. Uses the csound mincer phase vocoder implementation from soundpipe. TODO accept: from/to hz, notes, midi notes, intervals

vspeed
def vspeed(
    ...
)
write
def write(
    ...
)

Write the contents of this buffer to disk in the given audio file format. (WAV, AIFF, AU)