Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UDP Stream VOX Silence Time not working #23

Open
bunangst opened this issue May 16, 2024 · 1 comment
Open

UDP Stream VOX Silence Time not working #23

bunangst opened this issue May 16, 2024 · 1 comment

Comments

@bunangst
Copy link

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
@aaknitt
Copy link
Owner

aaknitt commented Jul 1, 2024

What program are you using as the UDP audio source? I'm trying to reproduce this but having some trouble...it seems to work well when using trunk-recorder as the source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants