简体   繁体   中英

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

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?

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

使用multiprocess winsoundwinsound模块来执行此操作。

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

you can do it 2 times for 2 different targets

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM