#How could I save two mp3 files locally?

1 messages · Page 1 of 1 (latest)

jade narwhal
turbid inletBOT
#

Here's the audio recording example.

cosmic orchid
cosmic orchid
jade narwhal
cosmic orchid
#

I think you want the 2nd because you said no mixing

cosmic orchid
# jade narwhal 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

cosmic orchid
jade narwhal
#

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

cosmic orchid
#

Shouldn't you be doing ./{name}.wav ?

#

I'm not sure tho

cosmic orchid
#

Try printing the name

jade narwhal
jade narwhal
jade narwhal
#

like i said it only saves once but i don't know why

jade narwhal
#

he saved the two files but they are empty

cosmic orchid
#

What's the type of audio

jade narwhal
#

I'm using this

#

but i can use any of these if i want

cosmic orchid
jade narwhal
jade narwhal
#

I also tested like this: print(type(audio.file))

cosmic orchid
#

Hmm ok it is bytes io

cosmic orchid
jade narwhal
#

omg

#

it worked out!!

#

Thanks!

cosmic orchid
#

?tag solved

karmic quailBOT
#

Done with your help thread?

Please close your own help thread using </close:882631512829329448> (/close) with @turbid inlet.