Record in CsoundPerformanceThread - ctcsound, python API

Hi,
I found that it’s possible to record directly through ctcsound.
I’m trying something like this, but the .wav file is always corrupted.

cs_return = cs.start()
pt = ctcsound.CsoundPerformanceThread(cs.csound())
if cs_return == ctcsound.CSOUND_SUCCESS:
		print('CSOUND is ON!')

		filename = '/Users/j/Desktop/out.wav'
		bits = 24
		numbufs = 2

		print('Record ON') 
		pt.record(filename, bits, numbufs)
		
		pt.play()

		while pt.status() == 0:
			pass

		pt.stopRecord()
		print('Record OFF') 
		cs.cleanup()

bump!
It’s strange. It seems that it’s a quicktime problem. If I read my file with VLC it works.
Anyway, I dont feel confortable having wav that seems corrupted. I don’t know what it is, but I’ll keep using fout, even if I know it’s not the best solution.