File size: 341 Bytes
970f8d9
 
e394327
 
 
970f8d9
e394327
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
import base64

def encode_audio_to_base64(audio_path):
    with open(audio_path, "rb") as f:
        return base64.b64encode(f.read()).decode()

def decode_audio_from_base64(encoded_audio, output_path):
    audio_data = base64.b64decode(encoded_audio)
    with open(output_path, "wb") as f:
        f.write(audio_data)
    return output_path