• Stars
    star
    212
  • Rank 179,541 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created over 7 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Python AUdio Recording and Analysis (paura)

pAura: Python AUdio Recording and Analysis

News

General

  • paura.py is a Python tool for recording and analyzing sounds in an online and continuous manner. paura uses pySound (based on portaudio), so it can both be used in Linux and MacOs environments.
  • paura_lite.py is a very simple command-line recorder and real-time visualization

Installation

Before downloading this library and setting up the pip requirements, please consider the following:

Requirements for Linux

  • Install pyAudioAnalysis.
  • Install portaudio: sudo apt-get install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0
  • Install opencv for python: sudo apt-get install python-opencv
  • sudo apt-get install gnuplot (required only for paura_lite.py)

Requirements for MacOs

  • Install pyAudioAnalysis.
  • Install portaudio: brew install portaudio
  • Install pysound and opencv for python: pip3 install pyaudio opencv-python
  • brew install gnuplot (required only for paura_lite.py)

Execution and outputs for paura.py

Execution example

The following command records audio data using blocks of 1sec (segments).

 python3 paura.py --blocksize 1.0 --spectrogram --chromagram --record_segments --record_all

Output

For each segment, the script:

  1. Visualizes the spectrogram, chromagram along with the raw samples (waveform)
  2. Applies a simple audio classifier that distinguishes between 4 classes namely silence, speech, music and other sounds.

Output format

The predictions are printed in the console in the form of timestamp (segment starting point in seconds, counting from the recording starting time), class label (silence, music, speech or other), and prediction confidence, e.g.

...
12.71	other	0.52
13.63	speech	0.30
14.66	other	0.43
15.68	music	0.92
16.70	speech	0.30
...

Also, the waveform, spectrograms and chromagrams are visualized in dedicated plots.

If the --record_segments flag is provided, each segment is saved in a folder named by the starting timestamp of the recording session, and has a filename indicated by its relative timestamp from the recording starting time, e.g. for the above example:

⇒ ls -1 2020_01_28_12:37AM_segments 
...
0012.71_other.wav
0013.63_speech.wav
0014.66_other.wav
0015.68_music.wav
0016.70_speech.wav
...

Finally, if --record_all is provided, the whole recording is saved in a singe audio file. Not to be used for very long recordings (many hours), due to memory issues. In the above example, the overall audio recording is stored in 2020_01_26_11:16PM.wav

Execution and outputs for paura_lite.py

This script takes no arguments and just records sounds, while visualizing each segment's spectrogram in the console.

python3 paura_lite.py

Sample output (for one of the recorded windows).

0 Hz     ███▊
100 Hz   █████████▉
200 Hz   █████▎
300 Hz   ███████▋
400 Hz   ███████████▌
500 Hz   ████▊
600 Hz   █████▍
700 Hz   ██████▉
800 Hz   ████
900 Hz   ██▋
1000 Hz  █████▍
1100 Hz  ███
1200 Hz  ███▉
1300 Hz  ██████
1400 Hz  ██████▌
1500 Hz  █████████
1600 Hz  ██████████████
1700 Hz  ██████▌
1800 Hz  ████
1900 Hz  █▋
2000 Hz  █▌
2100 Hz  ██▏
2200 Hz  ███▊
2300 Hz  ████████▎
2400 Hz  ████████████▌
2500 Hz  █████▉
2600 Hz  ████▊
2700 Hz  ██▉
2800 Hz  ██▏
2900 Hz  ███▎
3000 Hz  █████▎
3100 Hz  ███
3200 Hz  ██▎
3300 Hz  ██▊
3400 Hz  ███▋
3500 Hz  ██▏
3600 Hz  █▌
3700 Hz  █▊
3800 Hz  █▍
3900 Hz  █▋

A demo video of paura_lite.py is also available in the following video:

IMAGE ALT TEXT HERE

Ongoing work

Export selected features and mid-term representations

Author

Theodoros Giannakopoulos, Principal Researcher of Multimodal Machine Learning at the Multimedia Analysis Group of the Computational Intelligence Lab (MagCIL) of the Institute of Informatics and Telecommunications, of the National Center for Scientific Research "Demokritos"

More Repositories

1

pyAudioAnalysis

Python Audio Analysis Library: Feature Extraction, Classification, Segmentation and Applications
Python
5,590
star
2

pyImageClassification

Image Feature Extraction and Classification Using Python
Python
104
star
3

multimodalAnalysis

Python examples for the course "Multimodal Information Processing & Analysis" of the MSc in Data Science in NCSR Demokritos
Jupyter Notebook
91
star
4

deep_audio_features

Pytorch implementation of deep audio embedding calculation
Python
85
star
5

color_your_music_mood

A realtime demo for generating colors based on musical moods
Python
37
star
6

basic_audio_analysis

Jupyter Notebook
34
star
7

multimodal_movie_analysis

A Python Library for Multimodal Analysis of Movies and Content-based Movie Recommendation
Python
22
star
8

amvoc

A Python Tool for Analysis of Mouse Vocal Communication
Python
13
star
9

AUROS

A ROS framework for Audio Analysis
C++
12
star
10

basic_audio_handling

A set of examples for basic audio data handling
Jupyter Notebook
12
star
11

pyTextClassification

Training and using classifiers for textual documents
Python
12
star
12

readys

A Speech Analytics Python Tool for Speaking Assessment
Python
11
star
13

ml-python

Python examples for the Machine Learning Course at MSc of AI at NCSR Demokritos
Jupyter Notebook
10
star
14

python-data-science

Introduction to Python for Data Science
Jupyter Notebook
9
star
15

recognizeFitExercise

Classification of fitness exercises based on accelerometer and camera information
Python
9
star
16

pyVisualizeMp3Tags

Generate visualisations and reports on collections of mp3 files using python
Python
8
star
17

soundscape_quality

Data handling and baseline approach for soundscape quality estimation
Python
6
star
18

pyScholar

Python Library to Analyse and Visualise Google Scholar Metadata
Python
6
star
19

pySLRF

Python algorithms for scanning laser range finder data
Python
5
star
20

pyOpenAireTextClassifier

An open source set of supervised learning procedures for scientific text classification
Python
3
star
21

segment_sound

A Python script to break an audio signal into audio segments using silence removal
Python
3
star
22

inf_teiste_data_structures_lab

C
2
star
23

covid19_predict

A simple Python predictor for covid19 data
Python
2
star
24

ml-stocks

Python
2
star
25

cv_track_face

Simple face tracking using opencv and python
Python
1
star
26

dl-python

Python material for deep learning
Python
1
star
27

Multimodal-User-Monitoring

Python
1
star
28

music-metadata-analysis

A python lib for analysing data from the Spotify API
Python
1
star
29

tyiannak.github.io

HTML
1
star
30

inf_teiste_info_theory_lab

Information Theory Library and Examples
Python
1
star