Hoohaha / Auana-P

Audio Recognition Algorithm Python Package

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Auana-P Version 0.6

Auana-P:Audio Analysis algorithm Python Package

Auana is a open source, free and light tool with the audio recognition and basic analysis algorithms. It try to provide a professional audio recognition solutions for python.
It was designed by python and c(core algorithm). So it is fast enough, it can easily find the simialr references which it heared before, the progress just like human. And also it will tell the user the position where the songs is playing. Auana support microphone records and file analysis. File analysis only support "wav" file for now. In addition, it also provide the functions: Broken-Frame detection and Volume value detection.

Except using for recognitions, it will more focus on audio signal analysis. At the begaining, Auana is designed for audio validition. It is so boring to check the musics/songs by manually.
So for the automation of audio validation, it may be a good idea. It is still in developing. Any comments, suggestions welcomed. My Email: hui.g@foxmail.com.

Requirments:


Features:


1.Broken-frame detection [support]
2.Sound recognition [support]
3.Volume value computation [support]
4.Audio play and record [support]
5.THD+N [support]
6.Support mp3 ,wma…etc [will]
7.Detect noise [will]

Quickly Start


1.Storage

The class Storage is a data management. If you want to use the recognition, you must create a storage and init it.

  • init(path=DEFAULT_DATA_PATH)<br > Parameters:<br > DEFAULT_DATA_PATH = "./data"

1) Functions.

  • query(file):<br > query the file if was saved in storage.<br > file: file path.<br >
  • clean_up():<br > clean all items in this storage. Should be caution to use.<br >
  • forget(file):<br > forget/delete a file.<br > file: file path.<br >
  • items():<br > show all item which was saved in storage<br >
  • commit():<br > commit the changes<br >
  • Open(file) : <br > open a wave file and return a WaveForm Object. If file is None, it will open an empty WaveForm.<br > file: file path.<br >

2) Create a new storage.

Create a new storage to store the data. The defalut settings: framerate is 22500, data path is ../data. Use the default configuration, see the following example.

try:
    Create()
except ValueError:
    pass

Custom settings:

#Custom framerate: 16000.
try:
    Create(framerate=1600)
except ValueError:
    pass
#Custom data path.
try:
    Create(path="C:/data")
except ValueError:
    pass
#Custom framerate and data path.
try:
    Create(framerate=16000, path="C:/data")
except ValueError:
    pass

###2.WaveForm WaveForm is a class that can be used to recognize or detect broken frame.<br >

  • init(framerate, data, storage=None, filename=None, channels=2)<br > Parameters:<br > framerate --- sample rate. data --- a data list required. storage --- A reference storage manager. Default is None.<br > filename --- Waveform filename. Default is None.<br > channels --- channels number. Default is 2.<br >

####1) Functions. Basic Functions:<br >

  • write(data):<br > write new data to waveform.<br > data: a list required.<br >
  • detec_broken_frame(ch=None):<br > broken frame detection.<br > ch: default stereo mode---None, mono mode---0/1 (0: left, 1:right)<br>
  • get_volume(ch=None):<br > compute the average volume of this waveform.<br > ch: default stereo mode---None, mono mode---0/1 (0: left, 1:right)<br >
  • get_THD(ch==None):<br > compute the THD+N.<br > ch: default stereo mode---None, mono mode---0/1 (0: left, 1:right)<br >

Recognition Functions:<br >

  • hear():<br > hear/extract the fingerprints to storage.<br >
  • recognize(ch=None, Fast=True):<br > audio recognition. <br > ch: default stereo mode---None, mono mode---01/1(0: left, 1:right).<br > Fast: means fast search, if the accuracy is high enough, it will search in right channel. default True.

###2) Examples open an waveform

from auana import Storage

sto = Storage()

w = sto.Open("sample.wav")

or open an empty WaveForm:

from auana import Storage

sto = Storage()

w = sto.Open()

w.write(data) #w.data=data          #data:wave data

If you don`t use it for recognition. you can use it by the following forms.

from auana import Open

w = Open("sample.wav")

w.detect_broken_frame()  #for broken frame detection

1> Save the fingerprints into the storage.

w.hear()

2> For recognition:

name, accuracy, position = w.recognize()

3>For broken frame detection:

bf = w.detect_broken_frame()

4>Get the volume:

v = w.get_volume()

##Demo User's Guide

1> Prework
Prework Demo can memory the new files.

2> MIC Recognition
This is a Demo for showing how to recognize the data from MIC. You can double click the "Demo_MICRecognition" to run.
And then you can play a song and press "Enter" to make the demo to processing.

3> File Search
Drag the sample ".wav" file into "Demo_FileSearchDemo.py".

4> Broken Frame
Drag the sample into "Demo_BrokenFrame.py".

##Performance

There are 180 files in the "./data" folder. Follow figure shows the relationships between record-time and search time.

7

##Simple Theory

3 4 5 6 6 8

##Version modification

version 0.1.Auana Pacage.
version 0.2.Auana: designed by C and python.
version 0.3.Auana: Optimzie parameter about recognition to make it more reliable.
version 0.4.Auana: New functions: return where the match songs is playing.
version 0.5.Auana: Optimize the get_fingerprint algoritms
version 0.6.Auana: New algorithm for extracting fingerprints

About

Audio Recognition Algorithm Python Package

License:Artistic License 2.0


Languages

Language:Python 89.0%Language:C 10.9%Language:Batchfile 0.1%