LASP 1.0
Library for Acoustic Signal Processing
|
Class used to perform a recording. More...
Public Member Functions | |
__init__ (self, str fn, StreamMgr streammgr, float rectime=None, bool wait=True, progressCallback=None, float startDelay=0) | |
Start a recording. | |
resetCallback (self, daq) | |
Function called with initial stream data. | |
firstFrames (self, adata) | |
Set up the dataset in which to store the audio data. | |
inCallback (self, adata) | |
This method is called when a block of audio data from the stream is available. | |
setDelete (self, bool val) | |
Set the delete flag. | |
finish (self) | |
This method should be called to finish and a close a recording file, remove the queue from the stream, etc. | |
Public Attributes | |
smgr | |
metadata | |
startDelay | |
startDelay_passed | |
rectime | |
fn | |
curT_rounded_to_seconds | |
ablockno | |
stop | |
file_mtx | |
progressCallback | |
f | |
deleteFile | |
ad | |
indh | |
blocksize | |
nchannels | |
fs | |
Class used to perform a recording.
Recording data can come in from a different thread, that is supposed to call the inCallback
method, with audio data as an argument.
Definition at line 20 of file lasp_record.py.
lasp.lasp_record.Recording.__init__ | ( | self, | |
str | fn, | ||
StreamMgr | streammgr, | ||
float | rectime = None , |
||
bool | wait = True , |
||
progressCallback = None , |
|||
float | startDelay = 0 |
||
) |
Start a recording.
Blocks if wait is set to True.
Args: fn: Filename to record to. Extension is automatically added if not provided. stream: AvStream instance to record from. Should have input channels! rectime: Recording time [s], None for infinite, in seconds. If set to None, or np.inf, the recording continues indefintely. progressCallback: callable that is called with an instance of RecordStatus instance as argument. startDelay: Optional delay added before the recording is actually started in [s].
Definition at line 27 of file lasp_record.py.
lasp.lasp_record.Recording.finish | ( | self | ) |
This method should be called to finish and a close a recording file, remove the queue from the stream, etc.
Definition at line 215 of file lasp_record.py.
lasp.lasp_record.Recording.firstFrames | ( | self, | |
adata | |||
) |
Set up the dataset in which to store the audio data.
This will create the attribute self.ad
Args: adata: Numpy array with data from DAQ
Definition at line 157 of file lasp_record.py.
lasp.lasp_record.Recording.inCallback | ( | self, | |
adata | |||
) |
This method is called when a block of audio data from the stream is available.
It should return either True or False.
When returning False, it will stop the stream.
Definition at line 185 of file lasp_record.py.
lasp.lasp_record.Recording.resetCallback | ( | self, | |
daq | |||
) |
Function called with initial stream data.
Definition at line 120 of file lasp_record.py.
lasp.lasp_record.Recording.setDelete | ( | self, | |
bool | val | ||
) |
Set the delete flag.
If set, measurement file is deleted at the end of the recording. Typically used for cleaning up after canceling a recording.
Definition at line 206 of file lasp_record.py.
lasp.lasp_record.Recording.ablockno |
Definition at line 75 of file lasp_record.py.
lasp.lasp_record.Recording.ad |
Definition at line 104 of file lasp_record.py.
lasp.lasp_record.Recording.blocksize |
Definition at line 127 of file lasp_record.py.
lasp.lasp_record.Recording.curT_rounded_to_seconds |
Definition at line 72 of file lasp_record.py.
lasp.lasp_record.Recording.deleteFile |
Definition at line 95 of file lasp_record.py.
lasp.lasp_record.Recording.f |
Definition at line 87 of file lasp_record.py.
lasp.lasp_record.Recording.file_mtx |
Definition at line 81 of file lasp_record.py.
lasp.lasp_record.Recording.fn |
Definition at line 70 of file lasp_record.py.
lasp.lasp_record.Recording.fs |
Definition at line 129 of file lasp_record.py.
lasp.lasp_record.Recording.indh |
Definition at line 108 of file lasp_record.py.
lasp.lasp_record.Recording.metadata |
Definition at line 56 of file lasp_record.py.
lasp.lasp_record.Recording.nchannels |
Definition at line 128 of file lasp_record.py.
lasp.lasp_record.Recording.progressCallback |
Definition at line 83 of file lasp_record.py.
lasp.lasp_record.Recording.rectime |
Definition at line 67 of file lasp_record.py.
lasp.lasp_record.Recording.smgr |
Definition at line 55 of file lasp_record.py.
lasp.lasp_record.Recording.startDelay |
Definition at line 61 of file lasp_record.py.
lasp.lasp_record.Recording.startDelay_passed |
Definition at line 64 of file lasp_record.py.
lasp.lasp_record.Recording.stop |
Definition at line 78 of file lasp_record.py.