zellostream icon indicating copy to clipboard operation
zellostream copied to clipboard

UDP Stream VOX Silence Time not working

Open bunangst opened this issue 9 months ago • 1 comments

Long time user of the sound card input streaming setup.

Trying to help my brother with an issue using truck recorder and UDP stream. I see where the following section of code is trying to use all of the possible 'data' inputs for counting quiet samples...however the actual playback in the Zello App does not reflect that.

		if config["audio_source"] == "Sound Card":
			data = record_chunk(config, audio_input_stream, channel=config["in_channel_config"])
		elif config["audio_source"] == "UDP":
			data = get_udp_audio(config,seconds=0.06, channel=config["in_channel_config"])
		else:
			data = frombuffer(b'',dtype=short)
		if len(data) > 0:
			max_audio_level = max(abs(data))
		else:
			max_audio_level = 0
		if len(data) == 0 or max_audio_level < config["audio_threshold"]:
			quiet_samples = quiet_samples + 1
		else:
			quiet_samples = 0

Sound card inputs stream all data (even below audio threshold) until the quiet samples counter has filled.

The UDP configuration does not send any data during the VOX silence time because there is no data. The zello phone app cuts the playback of a stream with no data. Maybe the solution would be to send artificial silent packets?

				if len(data) > 0:
					data2 = data.tobytes()
					out = opuslib.api.encoder.encode(enc, data2, zello_chunk, len(data2) * 2)
					send_data = bytearray(array([1]).astype(">u1").tobytes())
					send_data = send_data + array([stream_id]).astype(">u4").tobytes()
					send_data = send_data + array([packet_id]).astype(">u4").tobytes()
					send_data = send_data + out

bunangst avatar May 16 '24 02:05 bunangst