• This project log basically a collection of links. However, These might helpful or not.
  • http://aubio.org/download, lint to download Aubio.
  • Aubio is a audio manipulating library for Python.
  • http://aubio.org/manpages/latest/aubiopitch.1.html, Aubio has a command line application called aubiopitch to extract energy (volume) and the pitch of an audio file. This can be done all using terminal command and without any programming.
  • http://people.csail.mit.edu/hubert/pyaudio/, another alternative to Aubio. PyAudio is a Python library to help on audio programming. I think this is similar to Minim library in Processing. However, I have intention to use this library just yet.
  • http://webaudiodemos.appspot.com/, a neat framework for audio processing with web technology. In this case, this is a library to manipulate audio using JavaScript. Definitely an alternative to look in case I want to make a sociometric badge variant with web technologies.
  • https://aubio.readthedocs.io/en/latest/debian_packages.html, here is a tutorial on how to install Aubio in Debian or Ubuntu based operating system.
  • Here is the screenshot.

./20161203-1408-cet-6-1.png

./20161203-1408-cet-6-2.png

./20161203-1408-cet-6-3.png

#! /usr/bin/env python

import alsaaudio
import numpy as np
import aubio

# constants
samplerate = 44100
win_s = 2048
hop_s = win_s // 2
framesize = hop_s

# set up audio input
recorder = alsaaudio.PCM(type=alsaaudio.PCM_CAPTURE)
recorder.setperiodsize(framesize)
recorder.setrate(samplerate)
recorder.setformat(alsaaudio.PCM_FORMAT_FLOAT_LE)
recorder.setchannels(1)

# create aubio pitch detection (first argument is method, "default" is
# "yinfft", can also be "yin", "mcomb", fcomb", "schmitt").
pitcher = aubio.pitch("default", win_s, hop_s, samplerate)
# set output unit (can be 'midi', 'cent', 'Hz', ...)
pitcher.set_unit("Hz")
# ignore frames under this level (dB)
pitcher.set_silence(-40)

print("Starting to listen, press Ctrl+C to stop")

# main loop
while True:
    try:
        # read data from audio input
        _, data = recorder.read()
        # convert data to aubio float samples
        samples = np.fromstring(data, dtype=aubio.float_type)
        # pitch of current frame
        freq = pitcher(samples)[0]
        # compute energy of current block
        energy = np.sum(samples**2)/len(samples)
        # do something with the results
        print("{:10.4f} {:10.4f}".format(freq,energy))
    except KeyboardInterrupt:
        print("Ctrl+C pressed, exiting")
        break

./20161203-1408-cet-6-4.png