#How could I save two mp3 files locally?
1 messages · Page 1 of 1 (latest)
Here's the audio recording example.
Doesn't show how to save locally
sink.audio_data.items() should give you the user and his audio in bytes. Open a file in write binary mode and write the bytes
I did something similar, but when I save it locally I only save one voice, I wanted to get both voices (without mixing, each file is a voice, just like when we received it in the discord chat)
So wait.
You want a combined audio file? Like a file that lets you replay audio exactly how it was in the vc?
Or do you want separate audio files for each user?
I think you want the 2nd because you said no mixing
yes
You must be opening the file outside of the loop. That's why it will get overwritten by the last user
Open the files inside the loop. And make sure each file has a different name
I opened in loop :/
Show how
wait
I tried this way
for user_id, audio in sink.audio_data.items():
name = str(random.randint(000000, 999999))
with open(f'{name}.wav', 'wb') as f:
f.write(audio.file.read())```
but records only one
I also tried other ways
Add a print statement lol. Add see how many time that prints
Try printing the name
it prints according to how many people are talking during a recording
as i was alone, it was just one time
I was alone talking, that's why it only appeared once
like i said it only saves once but i don't know why
I tested it now
he saved the two files but they are empty
are you asking if it's an mp3 or something?
I'm using this
but i can use any of these if i want
No i mean print(type(audio))
oh, sorry
I also tested like this: print(type(audio.file))
Hmm ok it is bytes io
Try audio.file.getbuffer()
Done with your help thread?
Please close your own help thread using </close:882631512829329448> (
/close) with @turbid inlet.