tools/utilities/pythonlibs/audio/microphone.py
def open(self, sample_size, sample_rate, num_channels, input_device=None):
        """ Open the microphone so it returns chunks of audio samples of the given sample_size
        where audio is converted to the expected sample_rate and num_channels
        and then scaled to floating point numbers between -1 and 1.
        
        sample_size - number of samples to return from read method
        audio_scale_factor - audio is converted to floating point using this scale
        sample_rate - the expected sample rate (e.g. 16000)
        num_channels - the number of audio channels to return
        input_device - input device index if you don't want to use the default
        """
        self.sample_rate = sample_rate
        self.sample_size = sample_size
        self.num_channels = num_channels
        self.audio_format = pyaudio.paInt16
        self.cvstate = None
        if input_device:
            info = self.audio.get_device_info_by_index(input_device)
        else:
            info = self.audio.get_default_input_device_info()
        self.mic_rate = int(info['defaultSampleRate'])
        buffer_size = int(math.ceil(sample_size * self.mic_rate / sample_rate))
        self.input_stream = self.audio.open(format=pyaudio.paInt16,
                        channels=num_channels,
                        rate=self.mic_rate, 
                        input=True,
                        frames_per_buffer=buffer_size,
                        stream_callback=self._on_recording_callback)    
        self.audio_scale_factor = 1 / 32768  # since we are using pyaudio.paInt16.
        self.closed = False
        if self.console:
            # since our read call blocks the UI we use a separate thread to monitor user input
            self.stdin_thread = Thread(target=self.monitor_input, args=(sys.stdin,))        
            self.stdin_thread.daemon = True
            self.stdin_thread.start()
 Open the microphone so it returns chunks of audio samples of the given sample_size
        where audio is converted to the expected sample_rate and num_channels
        and then scaled to floating point numbers between -1 and 1.
        
        sample_size - number of samples to return from read method
        audio_scale_factor - audio is converted to floating point using this scale
        sample_rate - the expected sample rate (e.g. 16000)
        num_channels - the number of audio channels to return
        input_device - input device index if you don't want to use the default
        
Open the microphone so it returns chunks of audio samples of the given sample_size
where audio is converted to the expected sample_rate and num_channels
and then scaled to floating point numbers between -1 and 1.

number of samples to return from read method
audio_scale_factor - audio is converted to floating point using this scale
sample_rate - the expected sample rate
num_channels - the number of audio channels to return
input_device - input device index if you don't want to use the default
Open the microphone so it returns chunks of audio samples of the given sample_size where audio is converted to the expected sample_rate and num_channels and then scaled to floating point numbers between - 1 and 1 . number of samples to return from read method audio_scale_factor - audio is converted to floating point using this scale sample_rate - the expected sample rate num_channels - the number of audio channels to return input_device - input device index if you don ' t want to use the default
def open(self, sample_size, sample_rate, num_channels, input_device=None):
        self.sample_rate = sample_rate
        self.sample_size = sample_size
        self.num_channels = num_channels
        self.audio_format = pyaudio.paInt16
        self.cvstate = None
        if input_device:
            info = self.audio.get_device_info_by_index(input_device)
        else:
            info = self.audio.get_default_input_device_info()
        self.mic_rate = int(info['defaultSampleRate'])
        buffer_size = int(math.ceil(sample_size * self.mic_rate / sample_rate))
        self.input_stream = self.audio.open(format=pyaudio.paInt16,
                        channels=num_channels,
                        rate=self.mic_rate, 
                        input=True,
                        frames_per_buffer=buffer_size,
                        stream_callback=self._on_recording_callback)    
        self.audio_scale_factor = 1 / 32768  
        self.closed = False
        if self.console:
            self.stdin_thread = Thread(target=self.monitor_input, args=(sys.stdin,))        
            self.stdin_thread.daemon = True
            self.stdin_thread.start()
def open ( self , sample_size , sample_rate , num_channels , input_device = None ) : self . sample_rate = sample_rate self . sample_size = sample_size self . num_channels = num_channels self . audio_format = pyaudio . paInt16 self . cvstate = None if input_device : info = self . audio . get_device_info_by_index ( input_device ) else : info = self . audio . get_default_input_device_info ( ) self . mic_rate = int ( info [ 'defaultSampleRate' ] ) buffer_size = int ( math . ceil ( sample_size * self . mic_rate / sample_rate ) ) self . input_stream = self . audio . open ( format = pyaudio . paInt16 , channels = num_channels , rate = self . mic_rate , input = True , frames_per_buffer = buffer_size , stream_callback = self . _on_recording_callback ) self . audio_scale_factor = 1 / 32768 self . closed = False if self . console : self . stdin_thread = Thread ( target = self . monitor_input , args = ( sys . stdin , ) ) self . stdin_thread . daemon = True self . stdin_thread . start ( )
Open the microphone so it returns chunks of audio samples of the given sample_size
where audio is converted to the expected sample_rate and num_channels
and then scaled to floating point numbers between -1 and 1.
Open the microphone so it returns chunks of audio samples of the given sample_size where audio is converted to the expected sample_rate and num_channels and then scaled to floating point numbers between - 1 and 1 .
""" Open the microphone so it returns chunks of audio samples of the given sample_size
        where audio is converted to the expected sample_rate and num_channels
        and then scaled to floating point numbers between -1 and 1.
        
        sample_size - number of samples to return from read method
        audio_scale_factor - audio is converted to floating point using this scale
        sample_rate - the expected sample rate (e.g. 16000)
        num_channels - the number of audio channels to return
        input_device - input device index if you don't want to use the default
        """ # since we are using pyaudio.paInt16. # since our read call blocks the UI we use a separate thread to monitor user input
self
sample_size
sample_rate
num_channels
input_device