diff --git a/src/auracast/server/multicast_frontend.py b/src/auracast/server/multicast_frontend.py index e5c4ed0..49e9e14 100644 --- a/src/auracast/server/multicast_frontend.py +++ b/src/auracast/server/multicast_frontend.py @@ -322,6 +322,17 @@ if audio_mode == "Demo": disabled=is_streaming, help="Select the demo stream configuration." ) + demo_content_options = ["Program material", "1 kHz test tone"] + saved_demo_content = saved_settings.get('demo_content', 'Program material') + if saved_demo_content not in demo_content_options: + saved_demo_content = 'Program material' + demo_content = st.selectbox( + "Demo Content", + demo_content_options, + index=demo_content_options.index(saved_demo_content), + disabled=is_streaming, + help="Select whether demo streams use program audio files or a continuous 1 kHz test tone." + ) # Stream password and flags (same as USB/AES67) saved_pwd = saved_settings.get('stream_password', '') or '' stream_passwort = st.text_input( @@ -1508,9 +1519,13 @@ if start_stream: bigs1 = [] for i in range(demo_cfg['streams']): cfg_cls, lang = lang_cfgs[i % len(lang_cfgs)] + if demo_content == "1 kHz test tone": + source_file = f'../testdata/test_tone_1k_{int(q["rate"]/1000)}kHz_mono.wav' + else: + source_file = f'../testdata/wave_particle_5min_{lang}_{int(q["rate"]/1000)}kHz_mono.wav' bigs1.append(cfg_cls( code=(stream_passwort.strip() or None), - audio_source=f'file:../testdata/wave_particle_5min_{lang}_{int(q["rate"]/1000)}kHz_mono.wav', + audio_source=f'file:{source_file}', iso_que_len=32, sampling_frequency=q['rate'], octets_per_frame=q['octets'], diff --git a/src/auracast/server/multicast_server.py b/src/auracast/server/multicast_server.py index 3635030..e979ffb 100644 --- a/src/auracast/server/multicast_server.py +++ b/src/auracast/server/multicast_server.py @@ -528,6 +528,13 @@ async def init_radio(transport: str, conf: auracast_config.AuracastConfigGroup, demo_count = sum(1 for big in conf.bigs if isinstance(big.audio_source, str) and big.audio_source.startswith('file:')) demo_rate = int(conf.auracast_sampling_rate_hz or 0) demo_type = None + demo_sources = [ + str(b.audio_source) + for b in conf.bigs + if isinstance(b.audio_source, str) and b.audio_source.startswith('file:') + ] + is_demo_tone = bool(demo_sources) and all('test_tone_1k_' in src for src in demo_sources) + demo_content = '1 kHz test tone' if is_demo_tone else 'Program material' if demo_count > 0 and demo_rate > 0: if demo_rate in (48000, 24000, 16000): demo_type = f"{demo_count} × {demo_rate//1000}kHz" @@ -554,8 +561,9 @@ async def init_radio(transport: str, conf: auracast_config.AuracastConfigGroup, 'big_random_addresses': [getattr(big, 'random_address', DEFAULT_RANDOM_ADDRESS) for big in conf.bigs], 'demo_total_streams': demo_count, 'demo_stream_type': demo_type, + 'demo_content': demo_content, 'is_streaming': auto_started, - 'demo_sources': [str(b.audio_source) for b in conf.bigs if isinstance(b.audio_source, str) and b.audio_source.startswith('file:')], + 'demo_sources': demo_sources, } return mc, persisted except HTTPException: diff --git a/src/auracast/testdata/test_tone_1k_16kHz_mono.wav b/src/auracast/testdata/test_tone_1k_16kHz_mono.wav new file mode 100644 index 0000000..37f62aa Binary files /dev/null and b/src/auracast/testdata/test_tone_1k_16kHz_mono.wav differ diff --git a/src/auracast/testdata/test_tone_1k_24kHz_mono.wav b/src/auracast/testdata/test_tone_1k_24kHz_mono.wav new file mode 100644 index 0000000..52c5aa9 Binary files /dev/null and b/src/auracast/testdata/test_tone_1k_24kHz_mono.wav differ diff --git a/src/auracast/testdata/test_tone_1k_48kHz_mono.wav b/src/auracast/testdata/test_tone_1k_48kHz_mono.wav new file mode 100644 index 0000000..84d3cff Binary files /dev/null and b/src/auracast/testdata/test_tone_1k_48kHz_mono.wav differ