R
R
RD1706D2022-02-18 13:20:10
Python
RD1706D, 2022-02-18 13:20:10

How to read and write a file at the same time in Python?

Is it possible to simultaneously record audio to a file and at the same time listen to its contents? If this is possible, then I would like to know about the implementation of this on the VLC and Wavio modules in Python. Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vadim, 2022-02-18
@Viji

https://habr.com/ru/post/149420/

M
Maxim Bulatov, 2022-02-18
@dvenum

It's not about multithreading, or rather not about it alone.
Try reading the file in chunks into a buffer, save the position, and close the file. Wavio is minimalistic, it has only a couple of functions and it does not know how to set the position. But inside there is a wave that has tell and setpos.
When recording, pay attention to buffering, i.e. when exactly is writing to disk.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question