AudioFrame
internal used_size
marker accessors
#196
Labels
enhancement
New feature or request
Milestone
AudioFrame
has an internal marker to indicate how much data has been recorded into it already.This marker is moved via:
microphone.record()
andmicrophone.record_into()
AudioFrame
via indexes, egmy_audioframe[n]
AudioFrame.copyfrom()
methodAudioFrame.copyfrom()
should move the internalused_size
marker #190AudioFrame
copy constructor or clone methodAudioFrame
deep copy #189We still need to document this in the docs, and having a document hidden feature without a way to access it is not ideal.
We were waiting for cases when having these accessors was beneficial, mostly following the general philosophy of "it's easier to add something later than it is to remove it or modify it".
Cases where we would have found these accessors useful:
buffer_offset
parameter tomicrophone.record_into()
, then (Shouldmicrophone.record_into()
have an additionalduration
and/orbuffer_offset
parameters? #197) it would be useful for cases like this:microphone.record_into(my_audioframe, buffer_offset=my_audioframe.get_position())
offset
parameter toAudioFrame.copyfrom()
(Effective way to get data in and out of an AudioFrame #194), then it would be useful to understand where to continue from (af.copyfrom(buffer, af.get_position()
)In the case we'd like to implement this, we have a couple options:
seek(offset, whence)
andtell()
from the Python file objectset_position()
andget_position()
Option 1) is more standard, but option 2) might be simpler to understand, and matches similar accessors already used in the micro:bit API.
So, my vote would be for option 2).
The text was updated successfully, but these errors were encountered: