- A C library for programming cognitive experiments on Windows
/* __ / /_______________ ____ ___ / __/ ___/ ___/ __ \/ __ \/ _ \ / /_(__ ) /__/ /_/ / /_/ / __/ \__/____/\___/\____/ .___/\___/ /_/ newsound4.c record, play and save a wav file (non blocking API) (no need to open a graphics window) */ #include <tscope.h> int main() { // make a sample pointer snd2_sample *samp; // allocate memory for a 2000 ms recording samp=snd2_makesample(2000); // make a stream pointer snd2_stream *stream; // record the sample stream = snd2_recordsample(samp); while (snd2_querysample(stream)==1) ts_wait(mtt(200)); // here you can do whatever you want (e.g. run a trial) snd2_stopsample(stream); // play the sample stream = snd2_playsample(samp); // save the sample to disk snd2_writesample(samp, "test.wav"); while (snd2_querysample(stream)==1) ts_wait(mtt(200)); // here you can do whatever you want (e.g. run a trial) snd2_stopsample(stream); // kill the sample snd2_killsample(samp); return 0; } END_OF_MAIN();