# Record in CsoundPerformanceThread - ctcsound, python API

**URL:** <https://forum.csound.com/t/record-in-csoundperformancethread-ctcsound-python-api/1031>\
**Category:** General\
**Created:** [January 4, 2023, 12:39pm UTC](https://forum.csound.com/t/record-in-csoundperformancethread-ctcsound-python-api/1031 "2023-01-04T12:39:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cordelia](https://forum.csound.com/user_avatar/forum.csound.com/cordelia/32/279_2.png) [@Cordelia](https://forum.csound.com/u/Cordelia)\
**Post date:** [January 4, 2023, 12:39pm UTC](https://forum.csound.com/t/record-in-csoundperformancethread-ctcsound-python-api/1031/1 "2023-01-04T12:39:27Z")

</div>

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.

```csound
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()

```

---

<div class="post-metadata">

**Author:** ![Cordelia](https://forum.csound.com/user_avatar/forum.csound.com/cordelia/32/279_2.png) [@Cordelia](https://forum.csound.com/u/Cordelia)\
**Post date:** [January 16, 2023, 10:49pm UTC](https://forum.csound.com/t/record-in-csoundperformancethread-ctcsound-python-api/1031/2 "2023-01-16T22:49:58Z")

</div>

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.
