Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSound and Python communication

I am currently working on a specialization project on simulating guitar effects with Evolutionary Algorithms, and want to use Python and CSound to do this.

The idea is to generate effect parameters in my algorithm in Python, send them to CSound and apply the filter to the audio file, then send the new audio file back to Python to perform frequency analysis for comparison with the target audio file (this will be done in a loop till the audio file is similar enough to the target audio file, so sending/receiving between CSound and Python will be done alot).

Shortly phrased, how do I get Python to send data to a CSound(.csd file), how do I read the data in the .csd file, and how do I send a .wav file from CSound to Python? It is also preferred that this can work dynamically on its own till the criterions for the audio file is met.

Thanks in advance

like image 770
jk87 Avatar asked Nov 05 '22 10:11

jk87


1 Answers

You can use Csound's python API, so you can run Csound within python and pass values using the software bus. See csound.h. You might also want to use the csPerfThread wrapper class which can schedule messages to and from Csound when it is running. All functionality is available from python.

like image 93
Andres Avatar answered Nov 09 '22 06:11

Andres