How to use the sounddevice.RawStream function in sounddevice

To help you get started, we’ve selected a few sounddevice examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mkj / pru-mic / pdm / pdm1.py View on Github external
def __init__(self, rate, chunk, chans=1):
        self.stream = sounddevice.RawStream(samplerate = int(rate), channels = chans,
            callback = self._callback, dtype='int16', blocksize=chunk)
        self.queue = queue.Queue()
github googlesamples / assistant-sdk-python / google-assistant-sdk / googlesamples / assistant / grpc / audio_helpers.py View on Github external
def __init__(self, sample_rate, sample_width, block_size, flush_size):
        if sample_width == 2:
            audio_format = 'int16'
        else:
            raise Exception('unsupported sample width:', sample_width)
        self._audio_stream = sd.RawStream(
            samplerate=sample_rate, dtype=audio_format, channels=1,
            blocksize=int(block_size/2),  # blocksize is in number of frames.
        )
        self._block_size = block_size
        self._flush_size = flush_size
        self._sample_rate = sample_rate
github Jay2645 / Unreal-Google-Assistant / Content / Scripts / googlesamples / assistant / audio_helpers / __init__.py View on Github external
def __init__(self, sample_rate, sample_width, block_size, flush_size):
		if sample_width == 2:
			audio_format = 'int16'
		else:
			raise Exception('unsupported sample width:', sample_width)
		self._audio_stream = sd.RawStream(
			samplerate=sample_rate, dtype=audio_format, channels=1,
			blocksize=int(block_size/2),  # blocksize is in number of frames.
		)
		self._block_size = block_size
		self._flush_size = flush_size
		self._sample_rate = sample_rate
github Jay2645 / Unreal-Google-Assistant / Content / Scripts / googlesamples / assistant / audio_helpers / __init__.py View on Github external
def __init__(self, sample_rate, sample_width, block_size, flush_size, procedural_audio_wave):

		self.ue_procedural_audio_wave = procedural_audio_wave
		self.ue_procedural_audio_wave.SampleRate = sample_rate
		self.ue_procedural_audio_wave.NumChannels = 1
		self.ue_procedural_audio_wave.Duration = 10000.0
		self.ue_procedural_audio_wave.SoundGroup = 4
		self.ue_procedural_audio_wave.bLooping = False

		if sample_width == 2:
			audio_format = 'int16'
		else:
			raise Exception('unsupported sample width:', sample_width)
		self._system_audio_stream = sd.RawStream(
			samplerate=sample_rate, dtype=audio_format, channels=1,
			blocksize=int(block_size/2),  # blocksize is in number of frames.
		)
		self._block_size = block_size
		self._flush_size = flush_size
		self._sample_rate = sample_rate