rt_note_analysis.py : Change to support stereo signals.

This commit is contained in:
kevin 2020-11-30 10:13:59 -05:00
parent b4b0973e9a
commit 011606c5cf

View File

@ -30,11 +30,15 @@ class RT_Analyzer:
if result: if result:
sigV = result.value sigV = result.value
# convert the audio signal vector to contain only the first (left) channel
if len(sigV.shape)>1:
sigV = sigV[:,0].squeeze()
anlArgs = types.SimpleNamespace(**anlArgD) anlArgs = types.SimpleNamespace(**anlArgD)
rmsDbV, rms_srate, binHz = audio_harm_rms( audioDev.srate, np.squeeze(sigV), anlArgs.rmsWndMs, anlArgs.rmsHopMs, anlArgs.dbLinRef, midi_pitch, anlArgs.harmCandN, anlArgs.harmN ) rmsDbV, rms_srate, binHz = audio_harm_rms( audioDev.srate, np.squeeze(sigV), anlArgs.rmsWndMs, anlArgs.rmsHopMs, anlArgs.dbLinRef, midi_pitch, anlArgs.harmCandN, anlArgs.harmN )
pkIdxL = locate_peak_indexes( rmsDbV, rms_srate, [( begTimeMs, endTimeMs)] ) pkIdxL = locate_peak_indexes( rmsDbV, rms_srate, [( begTimeMs, endTimeMs)] )