getSinkInputs(); foreach ($inputs as $input) { if ($input->getProperty('application.name') == 'Audacious') { echo "Found audacious on input #".$input->getIndex()."\n"; record($pulse, $input, "output.wav"); } } function record($pulse, $input, $filename) { echo "Creating null sink...\n"; $recSink = $pulse->createNullSink(); echo "Creating recorder...\n"; $recorder = $recSink->createRecorder(); $recorder->setFilename($filename); echo "Moving audacious to the null sink with index #".$recSink->getIndex()."...\n"; $input->moveToSink($recSink); echo "Recording 5 seconds...\n"; $recorder->start(); sleep(5); $recorder->stop(); }