Skip to content

7. Audio Recording Functionalities

tyiannak edited this page Aug 10, 2016 · 2 revisions

Some basic recording functionalities are supported and demonstrated in audioAnalysisRecordAlsa.py. However, this requires the alsa-audio python library, only available in Linux, (sudo apt-get install python-alsaaudio)

Record fix-sized audio segments

Function recordAudioSegments(RecordPath, BLOCKSIZE) from the audioAnalysisRecordAlsa.py file records successive fix-sized segments and stores them to the RecordPath folder.

Command-line use example:

python audioAnalysisRecordAlsa.py -recordSegments "rSpeech" 2.0

Realtime fix-sized segments classification

Function recordAnalyzeAudio(duration, outputWavFile, midTermBufferSizeSec, modelName, modelType) from the audioAnalysisRecordAlsa.py file records audio data and classifies each fix-sized segment (size midTermBufferSizeSec) using classifier modelName.

Command-line use example

python audioAnalysisRecordAlsa.py -recordAndClassifySegments 20 out.wav knnRecNoiseActivity knn