audio_buffer.py
Go to the documentation of this file.
1 import rospy
2 
3 from audio_to_spectrogram.data_buffer import DataBuffer
4 
5 
7 
8  def __init__(self, topic_name='~audio',
9  input_sample_rate=16000,
10  window_size=10.0,
11  bitdepth=16,
12  n_channel=1, target_channel=0,
13  get_latest_data=False,
14  discard_data=False,
15  auto_start=False):
16 
17  super(AudioBuffer, self).__init__(
18  topic_name=topic_name,
19  expr_to_get_data='m.data', # field of audio_common_msgs/AudioData
20  input_sample_rate=input_sample_rate,
21  window_size=window_size,
22  is_integer=True,
23  is_signed=True,
24  bitdepth=bitdepth,
25  n_channel=n_channel,
26  target_channel=target_channel,
27  get_latest_data=get_latest_data,
28  discard_data=discard_data,
29  auto_start=auto_start,
30  )
31 
32  @staticmethod
33  def from_rosparam(**kwargs):
34  n_channel = rospy.get_param('~n_channel', 1)
35  target_channel = rospy.get_param('~target_channel', 0)
36  mic_sampling_rate = rospy.get_param('~mic_sampling_rate', 16000)
37  bitdepth = rospy.get_param('~bitdepth', 16)
38  return AudioBuffer(input_sample_rate=mic_sampling_rate,
39  bitdepth=bitdepth,
40  n_channel=n_channel,
41  target_channel=target_channel,
42  **kwargs)
audio_to_spectrogram.audio_buffer.AudioBuffer.__init__
def __init__(self, topic_name='~audio', input_sample_rate=16000, window_size=10.0, bitdepth=16, n_channel=1, target_channel=0, get_latest_data=False, discard_data=False, auto_start=False)
Definition: audio_buffer.py:8
audio_to_spectrogram.data_buffer
Definition: data_buffer.py:1
audio_to_spectrogram.audio_buffer.AudioBuffer
Definition: audio_buffer.py:6
audio_to_spectrogram.audio_buffer.AudioBuffer.from_rosparam
def from_rosparam(**kwargs)
Definition: audio_buffer.py:33
audio_to_spectrogram.data_buffer.DataBuffer
Definition: data_buffer.py:11


audio_to_spectrogram
Author(s):
autogenerated on Sat Feb 22 2025 04:03:22