Mercurial > hg > auditok
comparison auditok/core.py @ 412:5a6685f1e42d
Remove unused code and update documentation for AudioRegion
author | Amine Sehili <amine.sehili@gmail.com> |
---|---|
date | Thu, 20 Jun 2024 21:51:11 +0200 |
parents | 0e938065a2db |
children | 0a6bc66562d3 |
comparison
equal
deleted
inserted
replaced
411:0e938065a2db | 412:5a6685f1e42d |
---|---|
576 sampling rate of audio data | 576 sampling rate of audio data |
577 sample_width : int | 577 sample_width : int |
578 number of bytes of one audio sample | 578 number of bytes of one audio sample |
579 channels : int | 579 channels : int |
580 number of channels of audio data | 580 number of channels of audio data |
581 meta : dict, default: None | 581 start : float, default: None |
582 any collection of <key:value> elements used to build metadata for | 582 optional start time of the region. This is typically provided by the |
583 this `AudioRegion`. Meta data can be accessed via `region.meta.key` | 583 `split` function. |
584 if `key` is a valid python attribute name, or via `region.meta[key]` | |
585 if not. Note that the :func:`split` function (or the | |
586 :meth:`AudioRegion.split` method) returns `AudioRegions` with a ``start`` | |
587 and a ``stop`` meta values that indicate the location in seconds of the | |
588 region in original audio data. | |
589 | 584 |
590 See also | 585 See also |
591 -------- | 586 -------- |
592 AudioRegion.load | 587 AudioRegion.load |
593 """ | 588 """ |
595 data: bytes | 590 data: bytes |
596 sampling_rate: int | 591 sampling_rate: int |
597 sample_width: int | 592 sample_width: int |
598 channels: int | 593 channels: int |
599 start: float = field(default=None, repr=None) | 594 start: float = field(default=None, repr=None) |
600 | |
601 def init__(self, data, sampling_rate, sample_width, channels, meta=None): | |
602 check_audio_data(data, sample_width, channels) | |
603 self.data = data | |
604 self.sampling_rate = sampling_rate | |
605 self.sample_width = sample_width | |
606 self.channels = channels | |
607 self._samples = None | |
608 self.splitp = self.split_and_plot | |
609 | |
610 if meta is not None: | |
611 self._meta = _AudioRegionMetadata(meta) | |
612 else: | |
613 self._meta = None | |
614 | |
615 self._seconds_view = _SecondsView(self) | |
616 self.sec = self.seconds | |
617 self.s = self.seconds | |
618 | |
619 self._millis_view = _MillisView(self) | |
620 self.ms = self.millis | |
621 | 595 |
622 def __post_init__(self): | 596 def __post_init__(self): |
623 | 597 |
624 check_audio_data(self.data, self.sample_width, self.channels) | 598 check_audio_data(self.data, self.sample_width, self.channels) |
625 | 599 |