TableProxy#
- class csoundengine.tableproxy.TableProxy(tabnum, numframes, parent=None, sr=0, nchnls=1, path='', skiptime=0.0, freeself=False)[source]#
A TableProxy is a proxy to an existing csound table
- Parameters:
tabnum (
int
) – the csound table numbersr (
int
) – the sample rate of the tablenchnls (
int
) – the number of channels in the tablenumframes (
int
) – the number of frames (data = numframes * nchnls)engine – the corresponding Engine
path (
str
) – the path to the output, if knownfreeself – if True, csound will free the table when this object goes out of scope
Warning
A TableProxy is never created by the user directly. It is returned by certain operations within a
Session
or aRenderer
, likereadSoundfile()
ormakeTable()
Example
>>> from csoundengine import * >>> session = Engine().session() >>> table = session.readSoundfile("mono.wav") >>> table TableProxy(tabnum=1, sr=44100, nchnls=1, engine=Engine(…), numframes=102400, path='mono.wav', freeself=False) >>> session.playSample(table, loop=True) >>> table.plot()
>>> table.plotSpectrogram()
- tabnum#
The table number assigned to this table
- sr#
Samplerate
- nchnls#
Number of channels, of applicable
- parent#
The parent Renderer
- numframes#
The number of frames (samples = numframes * nchnls)
- path#
The path to load the data from, if applicable
- freeself#
If True, bind the lifetime of the proxy to the lifetime of the table itself
- skiptime#
Skiptime of the table. This applies only to soundfiles
- data()[source]#
Get the table data as a numpy array.
The returned numpy array is a pointer to the csound memory (a view) if the table is live or the samples read from disk otherwise
- Return type:
ndarray
- Returns:
the data as a numpy array
- duration()[source]#
Duration of the sample data in this table.
This is only possible if the table holds sample data and the table has a samplerate
Raises ValueError if the table has no samplerate
- Return type:
float
- Returns:
the duration of the sample data, in seconds
- plotSpectrogram(fftsize=2048, mindb=-90, maxfreq=None, overlap=4, minfreq=0)[source]#
Plot a spectrogram of the sample data in this table.
Requires that the samplerate is set
- Parameters:
fftsize (int) – the size of the fft
mindb (int) – the min. dB to plot
maxfreq (int) – the max. frequency to plot
overlap (int) – the number of overlaps per window
minfreq (int) – the min. frequency to plot
- Return type:
None