On linux/wayland demoShow doesn't immediatly show window
JAicewizard opened this issue · comments
Jaap Aarts commented
I am running praat on linux/wayland, and need to run some scripts which makes use of the demo functionality (see script below). However only at the end does the demo window get shown. This is of course not the intended way it should be displayed.
I did some debugging, and the c function Demo_show
does not immediatly show the window, it seems to only be drawn when gtk goes into an idle state.
If there is any more information you need/want, let me know.
form The necessity to window signal parts.
comment Displays sequential short-term spectra of artificial vowel sound.
positive Window_length_(msec) 25
real Overlap_part_of_window_(%) 50
choice Window 1
button Rectangular
button Hanning
endform
dur = 0.3
Create Sound from formula: "base", 1, 0, dur, 44100, "0"
To Pitch: 0, 75, 600
Down to PitchTier
Add point: 0, 125
To Sound (pulse train): 44100, 1, 0.05, 2000, "no"
Filter (one formant): 420, 60
Filter (one formant): 1400, 80
# Omit start effect.
Extract part: 0.02, 0.3, "rectangular", 1, "no"
Rename... vowel
win = window_length/1000
tStep = win*(1-overlap_part_of_window/100)
if tStep<(win/50)
exit Choose lower overlap part.
endif
steps = floor(dur/tStep)
for i to steps-1
select Sound vowel
t1 = (i-1)*tStep
t2 = t1+win
Extract part: t1, t2, "rectangular", 1, "no"
if window = 2
Multiply by window: "Hanning"
endif
demo Erase all
demo Select outer viewport: 0, 50, 25, 75
demo Draw: 0, 0, -1, 1, "yes"
To Spectrum (dft)
demo Select outer viewport: 50, 100, 25, 75
demo Draw: 0, 5000, 0, 0, "yes"
if i < steps-1
demo Select inner viewport: 20, 80, 20, 80
demo Text top: "yes", "Still busy.."
endif
demoShow()
plus Sound vowel_part
Remove
sleep (0.9)
endfor
demo Select inner viewport: 20, 80, 20, 80
if window = 1
demo Text top: "yes", "Now you may start over, choosing Hanning window."
else
demo Text top: "yes", "Now you may start over, choosing Rectangular window."
endif