I'm coding with Python 3.11 in Linux, PyQt6, and want to record audio to file. Using QMediaRecorder. My script writes an audio file m4a format to disk, but no sound is recorded. Basically microphone device works on this PC, have tested with other programs.
What am I doing wrong?
Here is my code:
self.session = QMediaCaptureSession()
self.audioInput = QAudioInput()
self.session.setAudioInput(self.audioInput)
self.recorder = QtMultimedia.QMediaRecorder()
self.session.setRecorder(self.recorder)
self.recorder.setOutputLocation(QUrl.fromLocalFile("/home/axel/Development/aiAudioDoc_files/aiAudioDoc02"))
self.recorder.setQuality(QtMultimedia.QMediaRecorder.Quality(3))
self.audioInput.setVolume(80/100)
self.recorder.record()