Buffer

class supriya.tools.servertools.Buffer(buffer_group_or_index=None)[source]

A buffer.

>>> server = servertools.Server().boot()
>>> buffer_ = servertools.Buffer()
>>> buffer_
<Buffer: None>
>>> buffer_ = buffer_.allocate(frame_count=8192)
>>> server.sync()
<Server: udp://127.0.0.1:57751, 8i8o>
>>> buffer_
<Buffer: 0>
>>> buffer_.free()
>>> buffer_
<Buffer: None>

Lineage

digraph InheritanceGraph { graph [background=transparent, bgcolor=transparent, color=lightslategrey, fontname=Arial, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, root="__builtin__.object", splines=spline, style="dotted, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=12, penwidth=2, style="filled, rounded"]; edge [color=lightsteelblue2, penwidth=2]; subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=1, group=0, label=object, shape=box]; } subgraph cluster_servertools { graph [label=servertools]; "supriya.tools.servertools.Buffer.Buffer" [color=black, fontcolor=white, group=1, label=<<B>Buffer</B>>, shape=box, style="filled, rounded"]; "supriya.tools.servertools.ServerObjectProxy.ServerObjectProxy" [color=2, group=1, label=ServerObjectProxy, shape=oval, style=bold]; "supriya.tools.servertools.ServerObjectProxy.ServerObjectProxy" -> "supriya.tools.servertools.Buffer.Buffer"; } subgraph cluster_systemtools { graph [label=systemtools]; "supriya.tools.systemtools.SupriyaObject.AbstractBase" [color=3, group=2, label=AbstractBase, shape=box]; "supriya.tools.systemtools.SupriyaObject.SupriyaObject" [color=3, group=2, label=SupriyaObject, shape=box]; "supriya.tools.systemtools.SupriyaObject.AbstractBase" -> "supriya.tools.systemtools.SupriyaObject.SupriyaObject"; } "builtins.object" -> "supriya.tools.systemtools.SupriyaObject.AbstractBase"; "supriya.tools.systemtools.SupriyaObject.SupriyaObject" -> "supriya.tools.servertools.ServerObjectProxy.ServerObjectProxy"; }

Bases

Attribute summary

allocate([channel_count, frame_count, ...]) Allocates buffer on server.
allocate_from_file(file_path[, ...]) Allocates buffer on server with contents read from file_path.
buffer_group Gets buffer group.
buffer_id Gets buffer id.
channel_count Gets channel count.
close([sync]) Closes buffer, if it was open during a read or write process by the DiskIn or DiskOut UGens.
copy_from([frame_count, source_buffer_id, ...]) Copies data from another buffer into this buffer.
copy_to([frame_count, ...]) Copies data in this buffer into another buffer.
duration_in_seconds Gets duration in seconds.
fill([index_count_value_triples]) Fills contiguous blocks of samples with values.
fill_via_chebyshev(amplitudes[, ...]) Fills buffer with Chebyshev polynomial.
fill_via_sine_1([amplitudes, as_wavetable, ...]) Fills buffer with sum of sinusoids via /b_gen sine1.
fill_via_sine_2(amplitudes, frequencies[, ...]) Fills buffer with sum of sinusoids via /b_gen sine2.
fill_via_sine_3(amplitudes, frequencies, phases) Fills buffer with sum of sinusoids via /b_gen sine3.
frame_count Gets frame count.
free() Frees buffer.
get([indices]) Gets sample values at indices.
get_contiguous([index_count_pairs]) Gets contiguous sample values.
get_frame([frame_ids, completion_callback]) Gets frames at frame_ids.
is_allocated Is true if buffer is allocated.
play([add_action, bus, level, loop, rate, ...])
query() Queries buffer.
read(file_path[, channel_indices, ...]) Reads contents of file_path into buffer.
sample_count Gets sample count.
sample_rate Gets sample-rate.
server Gets associated server.
set([index_value_pairs, sync]) Sets samples.
set_contiguous([index_values_pairs, sync]) Sets contiguous blocks of samples.
write(file_path[, completion_message, ...]) Writes buffer to disk.
zero([completion_message, sync]) Zero all samples in buffer.
__eq__(expr) Is true when ID of expr equals ID of Supriya object.
__float__() Gets float representation of buffer.
__format__([format_specification]) Formats Supriya object.
__hash__() Hashes Supriya object.
__int__() Gets integer representation of buffer.
__repr__() Gets interpreter representation of buffer.

Read-only properties

Buffer.buffer_group

Gets buffer group.

>>> buffer_one = servertools.Buffer().allocate(frame_count=8)
>>> buffer_one.buffer_group is None
True
>>> buffer_group = servertools.BufferGroup(buffer_count=1)
>>> buffer_group.allocate(
...     frame_count=8,
...     )
<BufferGroup: {1} @ 1>
>>> buffer_two = buffer_group[0]
>>> buffer_two.buffer_group is buffer_group
True
>>> buffer_one.free()
>>> buffer_one.buffer_group is None
True
>>> buffer_group.free()
>>> buffer_two.buffer_group is buffer_group
True

Returns BufferGroup or none.

Buffer.buffer_id

Gets buffer id.

>>> buffer_one = servertools.Buffer()
>>> buffer_one.buffer_id is None
True
>>> buffer_group = servertools.BufferGroup(buffer_count=4)
>>> for buffer_ in buffer_group:
...     print(buffer_.buffer_id)
...
None
None
None
None
>>> buffer_one = buffer_one.allocate(frame_count=8)
>>> buffer_one.buffer_id
0
>>> buffer_group.allocate(frame_count=8)
<BufferGroup: {4} @ 1>
>>> for buffer_ in  buffer_group:
...     buffer_.buffer_id
...
1
2
3
4
>>> buffer_one.free()
>>> buffer_one.buffer_id is None
True
>>> buffer_group.free()
>>> for buffer_ in buffer_group:
...     print(buffer_.buffer_id)
...
None
None
None
None

Returns integer or none.

Buffer.channel_count

Gets channel count.

>>> buffer_one = servertools.Buffer().allocate(
...     frame_count=8,
...     )
>>> buffer_two = servertools.Buffer().allocate(
...     channel_count=4,
...     frame_count=8,
...     )
>>> buffer_one.channel_count
1
>>> buffer_two.channel_count
4
>>> buffer_one.free()
>>> buffer_two.free()

Returns integer.

Buffer.duration_in_seconds

Gets duration in seconds.

>>> buffer_ = servertools.Buffer()
>>> buffer_.duration_in_seconds
0.0
>>> buffer_ = buffer_.allocate(frame_count=44100)
>>> buffer_.duration_in_seconds
1.0
>>> buffer_.free()
>>> buffer_.duration_in_seconds
0.0

Returns float.

Buffer.frame_count

Gets frame count.

>>> buffer_ = servertools.Buffer()
>>> buffer_.frame_count
0
>>> buffer_ = buffer_.allocate(frame_count=512)
>>> buffer_.frame_count
512
>>> buffer_.free()
>>> buffer_.frame_count
0

Returns integer.

Buffer.is_allocated

Is true if buffer is allocated. Otherwise false.

>>> buffer_ = servertools.Buffer()
>>> buffer_.is_allocated
False
>>> buffer_ = buffer_.allocate(frame_count=8)
>>> buffer_.is_allocated
True
>>> buffer_.free()
>>> buffer_.is_allocated
False

Returns boolean

Buffer.sample_count

Gets sample count.

>>> buffer_one = servertools.Buffer().allocate(frame_count=16)
>>> buffer_two = servertools.Buffer().allocate(
...     channel_count=2,
...     frame_count=16,
...     )
>>> buffer_three = servertools.Buffer().allocate(
...     channel_count=8,
...     frame_count=16,
...     )
>>> buffer_one.sample_count
16
>>> buffer_two.sample_count
32
>>> buffer_three.sample_count
128
>>> buffer_one.free()
>>> buffer_two.free()
>>> buffer_three.free()
>>> buffer_one.sample_count
0
>>> buffer_two.sample_count
0
>>> buffer_three.sample_count
0

Returns integer.

Buffer.sample_rate

Gets sample-rate.

>>> buffer_ = servertools.Buffer()
>>> buffer_.sample_rate
0
>>> buffer_ = buffer_.allocate(frame_count=8)
>>> buffer_.sample_rate
44100.0
>>> buffer_.free()
>>> buffer_.sample_rate
0

Returns float.

Buffer.server

Gets associated server.

>>> buffer_ = servertools.Buffer()
>>> buffer_.server is None
True
>>> buffer_ = buffer_.allocate(frame_count=8)
>>> buffer_.server is server
True
>>> buffer_.free()
>>> buffer_.server is None
True

Returns server or none.

Methods

Buffer.allocate(channel_count=1, frame_count=1, server=None, sync=True)[source]

Allocates buffer on server.

>>> buffer_one = servertools.Buffer().allocate()
>>> buffer_one.query()
BufferInfoResponse(
    buffer_id=0,
    frame_count=1,
    channel_count=1,
    sample_rate=44100.0
    )
>>> buffer_two = servertools.Buffer().allocate(
...     frame_count=16,
...     )
>>> buffer_two.query()
BufferInfoResponse(
    buffer_id=1,
    frame_count=16,
    channel_count=1,
    sample_rate=44100.0
    )
>>> buffer_three = servertools.Buffer().allocate(
...     channel_count=2,
...     frame_count=32,
...     )
>>> buffer_three.query()
BufferInfoResponse(
    buffer_id=2,
    frame_count=32,
    channel_count=2,
    sample_rate=44100.0
    )
>>> buffer_one.free()
>>> buffer_two.free()
>>> buffer_three.free()

Returns buffer.

Buffer.allocate_from_file(file_path, channel_indices=None, completion_message=None, frame_count=None, server=None, starting_frame=None, sync=True)[source]

Allocates buffer on server with contents read from file_path.

>>> buffer_one = servertools.Buffer().allocate_from_file(
...     systemtools.Assets['pulse_44100sr_16bit_octo.wav'],
...     )
>>> buffer_one.query()
BufferInfoResponse(
    buffer_id=0,
    frame_count=8,
    channel_count=8,
    sample_rate=44100.0
    )
>>> buffer_two = servertools.Buffer().allocate_from_file(
...     systemtools.Assets['pulse_44100sr_16bit_octo.wav'],
...     channel_indices=(3, 4),
...     frame_count=4,
...     starting_frame=1,
...     sync=True,
...     )
>>> buffer_two.query()
BufferInfoResponse(
    buffer_id=1,
    frame_count=4,
    channel_count=2,
    sample_rate=44100.0
    )
>>> for frame_id in range(buffer_two.frame_count):
...     buffer_two.get_frame(frame_id).as_dict()
...
OrderedDict([(0, (0.0, 0.0))])
OrderedDict([(2, (0.0, 0.0))])
OrderedDict([(4, (0.999969482421875, 0.0))])
OrderedDict([(6, (0.0, 0.999969482421875))])
>>> buffer_one.free()
>>> buffer_two.free()

Returns buffer.

Buffer.close(sync=True)[source]

Closes buffer, if it was open during a read or write process by the DiskIn or DiskOut UGens.

>>> buffer_ = servertools.Buffer().allocate(
...     channel_count=8,
...     frame_count=8,
...     )
>>> buffer_.read(
...     systemtools.Assets['pulse_44100sr_16bit_octo.wav'],
...     leave_open=True,
...     )
>>> buffer_.close()
>>> buffer_.free()

Returns none.

Buffer.copy_from(frame_count=None, source_buffer_id=None, source_starting_frame=None, target_starting_frame=None, sync=True)[source]

Copies data from another buffer into this buffer.

>>> buffer_one = servertools.Buffer().allocate(frame_count=4)
>>> buffer_two = servertools.Buffer().allocate(frame_count=4)
>>> buffer_one.fill([(0, 4, 0.5)])
>>> buffer_two.copy_from(
...     frame_count=2,
...     source_buffer_id=buffer_one,
...     target_starting_frame=1,
...     )
>>> buffer_two.get_contiguous([(0, 4)]).as_dict()
OrderedDict([(0, (0.0, 0.5, 0.5, 0.0))])
>>> buffer_one.free()
>>> buffer_two.free()

Returns none.

Buffer.copy_to(frame_count=None, source_starting_frame=None, target_buffer_id=None, target_starting_frame=None, sync=True)[source]

Copies data in this buffer into another buffer.

>>> buffer_one = servertools.Buffer().allocate(frame_count=4)
>>> buffer_two = servertools.Buffer().allocate(frame_count=4)
>>> buffer_one.fill([(0, 4, 0.5)])
>>> buffer_one.copy_to(target_buffer_id=buffer_two)
>>> buffer_two.get_contiguous([(0, 4)]).as_dict()
OrderedDict([(0, (0.5, 0.5, 0.5, 0.5))])
>>> buffer_one.free()
>>> buffer_two.free()

Returns none.

Buffer.fill(index_count_value_triples=None)[source]

Fills contiguous blocks of samples with values.

>>> buffer_ = servertools.Buffer().allocate(
...     frame_count=8,
...     server=server,
...     sync=True,
...     )
>>> buffer_.fill([(0, 2, 0.5), (3, 3, 1.)])
>>> buffer_.get_contiguous([(0, 8)]).as_dict()
OrderedDict([(0, (0.5, 0.5, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0))])
>>> buffer_.free()

Returns none.

Buffer.fill_via_chebyshev(amplitudes, as_wavetable=True, should_normalize=True, should_clear_first=True, sync=True)[source]

Fills buffer with Chebyshev polynomial.

>>> buffer_ = servertools.Buffer().allocate(
...     frame_count=8,
...     server=server,
...     )
>>> buffer_.fill_via_chebyshev(
...     amplitudes=(1, 0.5, 0.25),
...     as_wavetable=False,
...     )
>>> for x in buffer_.get_contiguous([(0, 8)]).as_dict()[0]:
...     x
...
-0.2133333384990692
-0.03999999910593033
4.7369516864363795e-17
-0.013333333656191826
0.0
0.12000000476837158
0.4266666769981384
1.0
>>> buffer_.free()

Returns none.

Buffer.fill_via_sine_1(amplitudes=None, as_wavetable=True, should_clear_first=True, should_normalize=True, sync=True)[source]

Fills buffer with sum of sinusoids via /b_gen sine1.

>>> buffer_ = servertools.Buffer().allocate(
...     frame_count=8,
...     server=server,
...     )
>>> buffer_.fill_via_sine_1(
...     amplitudes=(1, 1, 1),
...     as_wavetable=False,
...     )
>>> for x in buffer_.get_contiguous([(0, 8)]).as_dict()[0]:
...     x
...
0.0
1.0
0.0
0.17157284915447235
1.014530602374735e-16
-0.17157284915447235
0.0
-1.0
>>> buffer_.free()

Returns none.

Buffer.fill_via_sine_2(amplitudes, frequencies, as_wavetable=True, should_clear_first=True, should_normalize=True, sync=True)[source]

Fills buffer with sum of sinusoids via /b_gen sine2.

>>> buffer_ = servertools.Buffer().allocate(
...     frame_count=8,
...     server=server,
...     )
>>> buffer_.fill_via_sine_2(
...     amplitudes=(1, 0.5, 0.25),
...     as_wavetable=False,
...     frequencies=(1, 2, 4),
...     )
>>> for x in buffer_.get_contiguous([(0, 8)]).as_dict()[0]:
...     x
...
0.0
0.46657732129096985
0.8170253038406372
0.9893794655799866
1.0
0.9250487685203552
0.8511532545089722
0.8245751261711121
>>> buffer_.free()

Returns none.

Buffer.fill_via_sine_3(amplitudes, frequencies, phases, as_wavetable=True, should_clear_first=True, should_normalize=True, sync=True)[source]

Fills buffer with sum of sinusoids via /b_gen sine3.

>>> buffer_ = servertools.Buffer().allocate(
...     frame_count=8,
...     server=server,
...     )
>>> buffer_.fill_via_sine_3(
...     amplitudes=(1, 0.5, 0.25),
...     as_wavetable=False,
...     frequencies=(1, 2, 3),
...     phases=(0, 0.5, 0),
...     )
>>> for x in buffer_.get_contiguous([(0, 8)]).as_dict()[0]:
...     x
...
0.21980325877666473
0.6533028483390808
0.9323374032974243
1.0
0.8886302709579468
0.6973193287849426
0.5352014899253845
0.46329957246780396
>>> buffer_.free()

Returns none.

Buffer.free()[source]

Frees buffer.

Returns none.

Buffer.get(indices=None)[source]

Gets sample values at indices.

>>> buffer_ = servertools.Buffer().allocate(
...     frame_count=4,
...     server=server,
...     sync=True,
...     )
>>> response = buffer_.get(indices=(1, 2))
>>> response.as_dict()
OrderedDict([(1, 0.0), (2, 0.0)])
>>> buffer_.free()

Returns buffer-set response.

Buffer.get_contiguous(index_count_pairs=None)[source]

Gets contiguous sample values.

>>> buffer_ = servertools.Buffer().allocate(
...     frame_count=4,
...     server=server,
...     sync=True,
...     )
>>> response = buffer_.get_contiguous(
...     index_count_pairs=((0, 2), (1, 3))
...     )
>>> response.as_dict()
OrderedDict([(0, (0.0, 0.0)), (1, (0.0, 0.0, 0.0))])
>>> buffer_.free()

Returns buffer-set-contiguous response.

Buffer.get_frame(frame_ids=None, completion_callback=None)[source]

Gets frames at frame_ids.

>>> buffer_ = servertools.Buffer().allocate_from_file(
...     systemtools.Assets['pulse_44100sr_16bit_octo.wav'],
...     )
>>> for frame_id in range(buffer_.frame_count):
...     buffer_.get_frame(frame_id).as_dict()
...
OrderedDict([(0, (0.999969482421875, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0))])
OrderedDict([(8, (0.0, 0.999969482421875, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0))])
OrderedDict([(16, (0.0, 0.0, 0.999969482421875, 0.0, 0.0, 0.0, 0.0, 0.0))])
OrderedDict([(24, (0.0, 0.0, 0.0, 0.999969482421875, 0.0, 0.0, 0.0, 0.0))])
OrderedDict([(32, (0.0, 0.0, 0.0, 0.0, 0.999969482421875, 0.0, 0.0, 0.0))])
OrderedDict([(40, (0.0, 0.0, 0.0, 0.0, 0.0, 0.999969482421875, 0.0, 0.0))])
OrderedDict([(48, (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.999969482421875, 0.0))])
OrderedDict([(56, (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.999969482421875))])
>>> buffer_.free()

Returns buffer-set-contiguous response.

Buffer.play(add_action=None, bus=0, level=1, loop=False, rate=1, target_node=None)[source]
Buffer.query()[source]

Queries buffer.

>>> buffer_ = servertools.Buffer().allocate(
...     channel_count=2,
...     frame_count=16,
...     )
>>> buffer_.query()
BufferInfoResponse(
    buffer_id=0,
    frame_count=16,
    channel_count=2,
    sample_rate=44100.0
    )
>>> buffer_.free()

Returns buffer-info response.

Buffer.read(file_path, channel_indices=None, completion_message=None, frame_count=None, leave_open=None, starting_frame_in_buffer=None, starting_frame_in_file=None, sync=True)[source]

Reads contents of file_path into buffer.

>>> buffer_ = servertools.Buffer().allocate(
...     channel_count=2,
...     frame_count=8,
...     )
>>> for frame_id in range(buffer_.frame_count):
...     buffer_.get_frame(frame_id).as_dict()
...
OrderedDict([(0, (0.0, 0.0))])
OrderedDict([(2, (0.0, 0.0))])
OrderedDict([(4, (0.0, 0.0))])
OrderedDict([(6, (0.0, 0.0))])
OrderedDict([(8, (0.0, 0.0))])
OrderedDict([(10, (0.0, 0.0))])
OrderedDict([(12, (0.0, 0.0))])
OrderedDict([(14, (0.0, 0.0))])
>>> buffer_.read(
...     systemtools.Assets['pulse_44100sr_16bit_octo.wav'],
...     channel_indices=(0, 1),
...     )
>>> for frame_id in range(buffer_.frame_count):
...     buffer_.get_frame(frame_id).as_dict()
...
OrderedDict([(0, (0.999969482421875, 0.0))])
OrderedDict([(2, (0.0, 0.999969482421875))])
OrderedDict([(4, (0.0, 0.0))])
OrderedDict([(6, (0.0, 0.0))])
OrderedDict([(8, (0.0, 0.0))])
OrderedDict([(10, (0.0, 0.0))])
OrderedDict([(12, (0.0, 0.0))])
OrderedDict([(14, (0.0, 0.0))])
>>> buffer_.free()

Returns none.

Buffer.set(index_value_pairs=None, sync=False)[source]

Sets samples.

>>> buffer_ = servertools.Buffer().allocate(
...     frame_count=8,
...     )
>>> buffer_.set([
...     (0, 0.25),
...     (1, 0.5),
...     (4, 0.75),
...     (5, 1.0),
...     ])
>>> buffer_.get_contiguous([(0, 8)]).as_dict()[0]
(0.25, 0.5, 0.0, 0.0, 0.75, 1.0, 0.0, 0.0)
>>> buffer_.free()

Returns none.

Buffer.set_contiguous(index_values_pairs=None, sync=False)[source]

Sets contiguous blocks of samples.

>>> buffer_ = servertools.Buffer().allocate(
...     frame_count=8,
...     )
>>> buffer_.set_contiguous([
...     (1, [1, 2, 3]),
...     (4, [-3, 2, -1]),
...     ])
>>> buffer_.get_contiguous([(0, 8)]).as_dict()[0]
(0.0, 1.0, 2.0, 3.0, -3.0, 2.0, -1.0, 0.0)
>>> buffer_.free()

Returns none.

Buffer.write(file_path, completion_message=None, frame_count=None, header_format='aiff', leave_open=False, sample_format='int24', starting_frame=None, sync=True)[source]

Writes buffer to disk.

>>> buffer_one = servertools.Buffer().allocate_from_file(
...     systemtools.Assets['pulse_44100sr_16bit_octo.wav'],
...     channel_indices=(0,),
...     )
>>> buffer_one.get_contiguous([(0, 8)]).as_dict()[0]
(0.999969482421875, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
>>> import os
>>> file_path = os.path.expanduser('~')
>>> file_path = os.path.join(file_path, 'temp.wav')
>>> if os.path.exists(file_path):
...     os.remove(file_path)
>>> buffer_one.write(
...     file_path,
...     header_format='wav',
...     )
>>> buffer_two = servertools.Buffer().allocate_from_file(file_path)
>>> buffer_two.get_contiguous([(0, 8)]).as_dict()[0]
(0.999969482421875, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
>>> os.remove(file_path)
>>> buffer_one.free()
>>> buffer_two.free()

Returns none.

Buffer.zero(completion_message=None, sync=True)[source]

Zero all samples in buffer.

>>> buffer_ = servertools.Buffer().allocate(
...     frame_count=8,
...     sync=True,
...     )
>>> buffer_.set_contiguous(
...     index_values_pairs=[(0, (1, 2, 3, 4, 5, 6, 7, 8))],
...     sync=True,
...     )
>>> buffer_.get_contiguous([(0, 8)]).as_dict()
OrderedDict([(0, (1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0))])
>>> buffer_.zero()
>>> buffer_.get_contiguous([(0, 8)]).as_dict()
OrderedDict([(0, (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0))])
>>> buffer_.free()

Returns none.

Special methods

(SupriyaObject).__eq__(expr)

Is true when ID of expr equals ID of Supriya object. Otherwise false.

Returns boolean.

Buffer.__float__()[source]

Gets float representation of buffer.

>>> buffer_one = servertools.Buffer().allocate(frame_count=8)
>>> buffer_two = servertools.Buffer().allocate(frame_count=8)
>>> buffer_one
<Buffer: 0>
>>> float(buffer_one)
0.0
>>> buffer_two
<Buffer: 1>
>>> float(buffer_two)
1.0
>>> buffer_one.free()
>>> buffer_two.free()
>>> buffer_three = servertools.Buffer()
>>> float(buffer_three)
Traceback (most recent call last):
...
ValueError: Cannot cast unallocated buffer to float.

Returns float.

(SupriyaObject).__format__(format_specification='')

Formats Supriya object.

Set format_specification to ‘’ or ‘storage’. Interprets ‘’ equal to ‘storage’.

Returns string.

(SupriyaObject).__hash__()

Hashes Supriya object.

Required to be explicitely re-defined on Python 3 if __eq__ changes.

Returns integer.

Buffer.__int__()[source]

Gets integer representation of buffer.

>>> buffer_one = servertools.Buffer().allocate(frame_count=8)
>>> buffer_two = servertools.Buffer().allocate(frame_count=8)
>>> buffer_one
<Buffer: 0>
>>> int(buffer_one)
0
>>> buffer_two
<Buffer: 1>
>>> int(buffer_two)
1
>>> buffer_one.free()
>>> buffer_two.free()
>>> buffer_three = servertools.Buffer()
>>> int(buffer_three)
Traceback (most recent call last):
...
ValueError: Cannot cast unallocated buffer to int.

Returns integer.

Buffer.__repr__()[source]

Gets interpreter representation of buffer.

>>> buffer_ = servertools.Buffer()
>>> repr(buffer_)
'<Buffer: None>'
>>> buffer_ = buffer_.allocate(frame_count=8)
>>> repr(buffer_)
'<Buffer: 0>'
>>> buffer_.free()
>>> repr(buffer_)
'<Buffer: None>'

Returns string.