• Stars
    star
    280
  • Rank 146,619 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created over 6 years ago
  • Updated over 2 years ago

Reviews

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

Repository Details

Fast and simple music and audio analysis using RNN in Python πŸ•΅οΈβ€β™€οΈ πŸ₯

GitHub license PRs Welcome

AudioOwl

AudioOwl is using librosa and RNN models to run fast analysis of music files 🎸.

Jump to:

Mix your music automatically with MixingBear - Automatic beat-mixing of music files 🎚

AudioOwl

Quickstart

Analyze a WAV audio file -

import audioowl
data = audioowl.analyze_file(path='my_music_file.wav', sr=22050)

print (data)
==> {'sample_rate': 22050,
    'duration': 36.096009070294784,
    'beat_samples': [12794, 40148, 66179, 93092, ...,
    'notes': [2,2,2,2,3,3,3,1,1,...]
    ...}

or an MP3 file -

data = audioowl.analyze_file(path='my_music_file.mp3', sr=22050)

Get beat times in samples (data['beat_samples']) -

import matplotlib.pyplot as plt

waveform = audioowl.get_waveform('drums.mp3', sr=22050)
data = audioowl.analyze_file('drums.mp3', sr=22050)

plt.figure()
plt.vlines(data['beat_samples'], -1.0, 1.0)
plt.plot(waveform)
plt.show()

plotting beats

Installation

Tested on Python 3.6 or later

⚠️ AudioOwl needs ffmpeg to be installed on your machine. The easiest way to install ffmpeg (at least on a Mac) is using homebrew. See instructions here.

The latest stable release is available on PyPI.
Install it using the following command -

$ pip install audioowl

Usage

Given an audio file, AudioOwl generates an objects with many useful information about your file πŸ’ͺ.

audioowl.get_waveform()

Returns a numpy array that contains that audio file time series.

Supported keyword arguments for audioowl.get_waveform():

  • path - Local path to the audio file.
  • sr [optional] - Requested sample rate for the analyzed file. This does not have to be the actual sample rate of the file, but the sample rate that will be used for the analysis. default = 22050.

audioowl.analyze_file()

Returns an object (dictionary) with the analysis results.

The audioowl.analyze_file() function allows you to use the path to the audio file.

Supported keyword arguments for audioowl.analyze_file():

  • path - Local path to the audio file.
  • sr [optional] - Requested sample rate for the analyzed file. This does not have to be the actual sample rate of the file, but the sample rate that will be used for the analysis. default = 22050.

audioowl.analyze_samples()

Returns a numpy array that contains that audio file time series.

The audioowl.analyze_samples() function allows you to use an audio time series (as numpy array).

Example -

import audioowl

time_series = audioowl.get_waveform('my_music_file.wav')
data = audioowl.analyze_samples(y=time_series, sr=44100)

Supported keyword arguments for audioowl.analyze_samples():

  • y - Time series. Must be a numpy array, with shape (1,) for mono, and (2,) for stereo.
  • sr - Requested sample rate for the analyzed file. This does not have to be the actual sample rate of the file, but the sample rate that will be used for the analysis.

Output data explained

The return value of all function is a an object (dictionary) with the analysis results. In case where the return value is stored in data:

import audioowl
data = audioowl.analyze_file(path='my_music_file.wav', sr=22050)

The data object will include the following properties:

  data['sample_rate'] # [int] sample rate

  data['duration'] # [float] file duration

  data['beat_samples'] # [list] beat location in samples

  data['number_of_beats'] # [list] number of detected beats

  data['tempo_float'] # [float] detected tempo as a float

  data['tempo_int'] # [int] detected tempo as an int

  data['zero_crossing'] # [list] detected zero level crossing, in samples detected

  data['noisiness_median'] # [float] nosiness value as a median, across the file

  data['noisiness_sum'] # [float] nosiness value as a sum, across the file

  data['notes'] # [list] notes across the file, based on chromagram of hop_length=512 samples.
  # notes legend:
  # 0   c
  # 1   c#
  # 2   d
  # 3   d#
  # 4   e
  # 5   f
  # 6   f#
  # 7   g
  # 8   g#
  # 9   a
  # 10  a#
  # 11  b

  data['dominant_note'] # [int] most dominant (frequent) note across the file

More Repositories

1

noise_reduction

Speech noise reduction which was generated using existing post-production techniques implemented in Python
HTML
175
star
2

MixingBear

Package for automatic beat-mixing of music files in Python 🐻🎚
Python
107
star
3

music-synthesis-with-python

Music Synthesis with Python talk, originally given at PyGotham 2017.
Jupyter Notebook
75
star
4

detune

πŸ‘¨β€πŸŽ€detune: A TrueDepth Music Experience for iOS --> ARKit, ARFaceAnchor Boilerplate
Swift
35
star
5

PressKit.js

✨A JS script that generates a well-designed press kit page πŸ“°for your creative project ✨
JavaScript
26
star
6

audio_noise_clustering

https://dodiku.github.io/audio_noise_clustering/results/ ==> An experiment with a variety of clustering (and clustering-like) techniques to reduce noise on an audio speech recording.
Python
25
star
7

Luncz

Luncz allows musicians to record a 10 second snippet of live music played on an acoustic or an amplified instrument, and analyzes the recording to extract the notes, the tempo, and the intensity level of the music. Using this data, Luncz generates new music to accompany the musician.
Jupyter Notebook
20
star
8

music_with_data_workshop

Materials for technical workshop about making music in the browser using data from the Twitter API
JavaScript
17
star
9

NOMNOM-The-Video-Machine-v2.0

πŸ“ΊA web application that uses an Arduino based controller to play videos from YouTube like music samples πŸŽ› 🎧
JavaScript
13
star
10

sound_gestures

A web application that uses mobile devices as musical instrument.
JavaScript
5
star
11

music_with_data_workshop_template

A template code for the Making Music with Online Data Workshop - https://github.com/dodiku/music_with_data_workshop
JavaScript
5
star
12

Csound

My Csound compositions
Jupyter Notebook
4
star
13

nded

JavaScript
2
star
14

RNN-training

1
star
15

news_scraper

A web scraper that gets news articles about a list of companies from a list of websites
Python
1
star
16

NOMNOM-The-Video-Machine-v1.0

A video controller, powered by an Arduino, that controls the playback of videos presented on a web browser.
JavaScript
1
star
17

best_language_web_app

https://bestlanguage.herokuapp.com ==> A NodeJS web application showing which programming language is best one to start learning today. Data is based on GitHub and Stackoverflow APIs.
JavaScript
1
star