# VERTAAL APP EAGLE SHELTER # Versie d.d. 19-03-2024 # EVERNOTE: # EAGLE SHELTER VERTAAL APP (EIGENLIJK TRANSCRIPTIE APP !) - CONNY ARIËNS - Can I use the microphone in a Streamlit application running on Hugging Face Spaces? - YES ! - POE WEB-SEARCH - 19-03-2024 !!!!! !!!!! # https://www.evernote.com/shard/s313/nl/41973486/a5777de0-40b5-4b88-8f7e-829c758fff92/ # EAGLE SHELTER VERTAAL APP (EIGENLIJK TRANSCRIPTIE APP !) - CONNY ARIËNS - Can I use the microphone in a Streamlit application running on Hugging Face Spaces? - YES ! - POE WEB-SEARCH - 19-03-2024 !!!!! !!!!! # https://poe.com/s/mlDEoHWYvbk11hQ5AE7z # example of how to configure the microphone input using the pyaudio library in Python: import streamlit as st import pyaudio def configure_microphone_input(): # Create an instance of the PyAudio class audio = pyaudio.PyAudio() # Get the available input devices device_count = audio.get_device_count() input_devices = [] for i in range(device_count): device_info = audio.get_device_info_by_index(i) if device_info['maxInputChannels'] > 0: input_devices.append(device_info) # Print the available input devices st.write("Available input devices:") for i, device in enumerate(input_devices): st.write(f"{i+1}. {device['name']}") # Select the desired input device # device_index = st.number_input("Enter the index of the input device you want to use:", min_value=1, max_value=len(input_devices), value=1, step=1) - 1 device_index = 0 # st.number_input("Enter the index of the input device you want to use:", min_value=0, max_value=len(input_devices), value=0, step=1) - 1 # Configure the microphone input stream = audio.open(format=pyaudio.paInt16, channels=1, rate=44100, input=True, input_device_index=device_index, frames_per_buffer=1024) # Start recording st.write("Recording started...") frames = [] while True: data = stream.read(1024) frames.append(data) # Stop recording st.write("Recording stopped.") stream.stop_stream() stream.close() audio.terminate() # Process the recorded audio frames as needed # ... # Streamlit app # def main(): st.title("Microphone Input Example") # Configure microphone input configure_microphone_input() #if __name__ == "__main__": # main()