-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
midi_file_player.py + multiprocessing #99
Comments
What OS are you on? (there is some specifics of spawning child processes with Also, I believe you want to use |
Hi @HaHeho,
Debian GNU/Linux (testing) with kernel realtime:
Yes, this makes sense. Here is my current code:
When calling
but after that the command line is available. So, something wrong happens with When running the code I posted here (by commenting the
and the process doesn't stop: so no differences compared to my previous attempt with multiprocessing+threading. Thanks! |
@Stemby Let's take a step back: do you really need This is really hard to get right and some libraries might not support it very well. I don't know if the If you don't really need If you are willing to load the whole audio file into memory (the MIDI file is already in memory), you might not even need If you really need
Then we can start debugging ... |
Thanks @mgeier!
I'm not sure. I suppose it would be the must solid solution for my purpose (if it works properly). At the moment I'm testing a simpler way (threading) and postponing the migration to multiprocessing.
OK, thank you! |
Isn't that the only way to realize file playback (either audio or MIDI) as an independent component which can be e.g. invoked or remote controlled by other parts of an application? If then Since quite a while, I was thinking to create a simple reference example for (audio) file playback which utilizes
|
It depends on what exactly you mean by "independent component", but I don't think so. In simple cases, neither But if multiple things have to be done concurrently in the main thread, a solution has to be found.
In my experience it very much does, because The resulting code is certainly less intuitive, because you have to think about which parts of the program state will be duplicated in multiple processes, which often isn't very obvious.
Yes, having an example to test whether the But it would be really good if the example would somehow represent a situation where Of course it should be as simple as possible, but it would be good for illustration if one of the processes would do some CPU-intensive work. |
@Stemby Any news on this? |
Hi,
I'm trying to modify this example in order to make it compatible with multiprocessing.
Mainly I had to rename some global variables:
Now I get this error at the end of the execution:
How can I fix it?
Thank you!
Carlo
The text was updated successfully, but these errors were encountered: