How can I make a play two musical notes simultaneously in Python?

539 Views Asked by At

I plan to do a music notation which allow the user to place the note where ever they want and allowed them to play the notes they placed.

If the user put the note in the same time which we have to play 2 or above notes together, any solution to solve that problem?

3

There are 3 best solutions below

1
On

Answer is really simple and straightforward in theory - use threads. Your code has to be executed asynchronously.

1
On

Use multiprocess and winsound module to do so.

1
On
import threading
....
....
....
threading.Thread(name='<thread_name>', target='<your_target>').start()

you can do it 2 times for 2 different targets