def encode_audio()

in wearable/main.py [0:0]


def encode_audio(file: str) -> str:
    # Read the audio file in binary mode
    with open(file, "rb") as audio:
        audio_data = audio.read()

    # Encode the binary data to base64
    base64_encoded_data = base64.b64encode(audio_data)

    # Convert bytes to string for JSON serialization
    base64_encoded_string = base64_encoded_data.decode("utf-8")

    return base64_encoded_string