0

I'm creating a simple synthesizer with a simple gui with a single frequency slider.

In one program I've learned how to create the slider and update a variable when the slider changes, and in a separate program i've created the synth program that creates the continuous audio stream from a numpy array using sounddevice. the array is a sine wave with a constant frequency.

how do i combine the two to have the frequency input of the synth get updated in real time based on the slider on my gui?

i've scanned through the pysimplegui cookbook, but the sections on threading seem to use the gui as the main process, with a button triggering a subprocess and then returning to the gui, where i want the real time process to continue in the background, with its inputs changing based on the gui.

Any input or guidance?

Milothicus
  • 123
  • 2
  • 7
  • Just for no GUI called in multi-threading. For multi-threading, you can set it by global variable, queue or buffer.in GUI event loop. – Jason Yang Feb 02 '21 at 04:30
  • Jason, I'm not clear on what you mean by "Just for no GUI called in multi-threading." my assumption was that i'd have to start the sound generator in one thread, and then run the GUI in another thread to update the inputs to the sound generator. – Milothicus Feb 02 '21 at 16:03
  • Most of time, we cannot call GUI action in your multi-threading, so generate an GUI event in Multi-threading and process that event in GUI loop. Now, you got an event in your GUI event loop, you can set value for variable which is accessed by global variable in your multi-threading. – Jason Yang Feb 02 '21 at 17:02

0 Answers0