You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm writing a simple music tracker in Python 3 that uses Csound as its audio engine, and interacts with it through ctcsound.
My main sequencer class is SongSequencer. It has a toggle_playing method that converts the program's phrase and instrument data structures into a string in .csd format. Then I use a CsoundPerformanceThread to play the audio for that in a seperate thread. My problem is that there is delay of a second or two before Csound starts actually playing the audio back, which prevents me from syncing the current step indicator in my GUI to where the audio is in the score. Are there any callback methods I can use to sync my GUI and the audio playback?
I tried using the setRtPlayCallback method but couldn't get it to do anything.
The abbreviated code of my program looks like this:
classSongSequencer:
def__init__(self):
#...self.cs=ctcsound.Csound()
self.pt=ctcsound.CsoundPerformanceThread( self.cs.csound() )
deftoggle_playing(self, cursor_step=0):
ifself.pt.status() !=0:
self.pt.stop()
self.pt.join()
self.cs.reset()
self.pt=ctcsound.CsoundPerformanceThread( self.cs.csound() )
self.pt.setProcessCB(self.audio_start_cb)
channels_phrases= [[], [], [], []]
# Add contiguous filled phrase sequences in current channel, starting at current# cursor step. When I find an empty phrase sequence, exit loopforch_iinrange(0,4):
forpsqinself.sequence[ch_i][cursor_step:]:
ifnotpsq:
breakchannels_phrases[ch_i].append(psq.phrase.steps)
csd=phrases_to_csd(self.instruments, channels_phrases)
ret=self.cs.compileCsdText(csd)
ifret==ctcsound.CSOUND_SUCCESS:
self.cs.start()
self.cs.setPlayOpenCallback(self.audio_start_cb)
self.pt.play()
defaudio_start_cb(self):
print('AUDIO PLAYING NOW')
print('AUDIO PLAYING NOW')
print('AUDIO PLAYING NOW')
The text was updated successfully, but these errors were encountered:
I'm writing a simple music tracker in Python 3 that uses Csound as its audio engine, and interacts with it through ctcsound.
My main sequencer class is
SongSequencer
. It has atoggle_playing
method that converts the program's phrase and instrument data structures into a string in .csd format. Then I use a CsoundPerformanceThread to play the audio for that in a seperate thread. My problem is that there is delay of a second or two before Csound starts actually playing the audio back, which prevents me from syncing the current step indicator in my GUI to where the audio is in the score. Are there any callback methods I can use to sync my GUI and the audio playback?I tried using the
setRtPlayCallback
method but couldn't get it to do anything.The abbreviated code of my program looks like this:
The text was updated successfully, but these errors were encountered: