## Autocorrelation and the case of the missing fundamental

[UPDATED January 25, 2016: One of the examples was broken, also the IPython notebook links now point to nbviewer, where you can hear the examples.]

For sounds with simple harmonic structure, the pitch we perceive is usually the fundamental frequency, even if it is not dominant. For example, here's the spectrum of a half-second recording of a saxophone.

The first three peaks are at 464, 928, and 1392 Hz. The pitch we perceive is the fundamental, 464 Hz, which is close to...

## Generating pink noise

In one of his most famous columns for Scientific American, Martin Gardner wrote about pink noise and its relation to fractal music. The article was based on a 1978 paper by Voss and Clarke, which presents, among other things, a simple algorithm for generating pink noise, also known as 1/f noise.

The fundamental idea of the algorithm is to add up several sequences of uniform random numbers that get updated at different rates. The first source gets updated at...

## Differentiating and integrating discrete signals

I am back at work on Think DSP, adding a new chapter on differentiation and integration. In the previous chapter (which you can read here) I present Gaussian smoothing, show how smoothing in the time domain corresponds to a low-pass filter in the frequency domain, and present the Convolution Theorem.

In the current chapter, I start with the first difference operation (diff in Numpy) and show that it corresponds to a high-pass filter in the frequency domain. I use historical stock...

## 60 numbers

This blog title is inspired from the Peabody award-winning Radiolab episode 60 words. Radiolab is well known for its insightful stories on Science with an amazing sound design. Today's blog is about decoding Radiolab's theme music (actually, just a small "Mmm Newewe" part of it hereafter called the Radiolab sound). I have been taking this online course on Audio Signal Processing where we are taught how to analyze sounds...

## Approximating the area of a chirp by fitting a polynomial

Once in a while we need to estimate the area of a dataset in which we are interested. This area could give us, for example, force (mass vs acceleration) or electric power (electric current vs charge).

One way to do that is fitting a curve on our data, and let's face it: this is not that easy. In this post we will work on this issue using Python and its packages. If you do not have Python installed on your system, check here how to...

## Bayes meets Fourier

Joseph Fourier never met Thomas Bayes—Fourier was born in 1768, seven years after Bayes died. But recently I have been exploring connections between the Bayes filter and the Fourier transform.

By "Bayes filter", I don't mean spam filtering using a Bayesian classifier, but rather recursive Bayesian estimation, which is used in robotics and other domains to estimate the state of a system that evolves over time, for example, the position of a moving robot. My interest in...

## Constrained Integer Behavior

Integer arithmetic is ubiquitous in digital hardware implementations, it's prolific in the control and data-paths. When using fixed width (constrained) integers, overflow and underflow is business as usual.

Building with IntegersThe subtitle of this post mentions a wheel - before I get to the wheel I want to look at an example. The recursive-windowed-averager (rwa, a.k.a moving average)...

## Python scipy.signal IIR Filtering: An Example

In the last posts I reviewed how to use the Python scipy.signal package to design digital infinite impulse response (IIR) filters, specifically, using the iirdesign function (IIR design I and IIR design II ). In this post I am going to conclude the IIR filter design review with an example.

Previous posts:

## Polyphase Filters and Filterbanks

ALONG CAME POLY

Polyphase filtering is a computationally efficient structure for applying resampling and filtering to a signal. Most digital filters can be applied in a polyphase format, and it is also possible to create efficient resampling filterbanks using the same theories.

This post will walk through a reference implementation of both the downsampling polyphase filter and a downsampling polyphase filterbank using scipy, numpy, matplotlib, and python. It should also highlight some of...

## Python scipy.signal IIR Filter Design Cont.

In the previous post the Python scipy.signal iirdesign function was disected. We reviewed the basics of filter specification and reviewed how to use the iirdesign function to design IIR filters. The previous post I only demonstrated low pass filter designs. The following are examples how to use the iirdesign function for highpass, bandpass, and stopband filters designs.

Highpass FilterThe following is a highpass filter design for the different filter...

## Bayes meets Fourier

Joseph Fourier never met Thomas Bayes—Fourier was born in 1768, seven years after Bayes died. But recently I have been exploring connections between the Bayes filter and the Fourier transform.

By "Bayes filter", I don't mean spam filtering using a Bayesian classifier, but rather recursive Bayesian estimation, which is used in robotics and other domains to estimate the state of a system that evolves over time, for example, the position of a moving robot. My interest in...

## Approximating the area of a chirp by fitting a polynomial

Once in a while we need to estimate the area of a dataset in which we are interested. This area could give us, for example, force (mass vs acceleration) or electric power (electric current vs charge).

One way to do that is fitting a curve on our data, and let's face it: this is not that easy. In this post we will work on this issue using Python and its packages. If you do not have Python installed on your system, check here how to...

## Polyphase Filters and Filterbanks

ALONG CAME POLY

Polyphase filtering is a computationally efficient structure for applying resampling and filtering to a signal. Most digital filters can be applied in a polyphase format, and it is also possible to create efficient resampling filterbanks using the same theories.

This post will walk through a reference implementation of both the downsampling polyphase filter and a downsampling polyphase filterbank using scipy, numpy, matplotlib, and python. It should also highlight some of...

## Python scipy.signal IIR Filtering: An Example

In the last posts I reviewed how to use the Python scipy.signal package to design digital infinite impulse response (IIR) filters, specifically, using the iirdesign function (IIR design I and IIR design II ). In this post I am going to conclude the IIR filter design review with an example.

Previous posts:

## Curse you, iPython Notebook!

First, I think ipython is great. I use it daily and always have an ipython terminal open. But just recently, I was showing off the ipython 0.12 notebook and in the process created a lengthy example while demonstrating the cool features of the ipython notebook. The example included LaTeX equations, plots, etc. Since the notebook session was on something of relevance I decided to clean up the session and use it for the beginning of a report.

## Differentiating and integrating discrete signals

I am back at work on Think DSP, adding a new chapter on differentiation and integration. In the previous chapter (which you can read here) I present Gaussian smoothing, show how smoothing in the time domain corresponds to a low-pass filter in the frequency domain, and present the Convolution Theorem.

In the current chapter, I start with the first difference operation (diff in Numpy) and show that it corresponds to a high-pass filter in the frequency domain. I use historical stock...

## Generating pink noise

In one of his most famous columns for Scientific American, Martin Gardner wrote about pink noise and its relation to fractal music. The article was based on a 1978 paper by Voss and Clarke, which presents, among other things, a simple algorithm for generating pink noise, also known as 1/f noise.

The fundamental idea of the algorithm is to add up several sequences of uniform random numbers that get updated at different rates. The first source gets updated at...

## Python scipy.signal IIR Filter Design

IntroductionThe following is an introduction on how to design an infinite impulse response (IIR) filters using the Python scipy.signal package. This post, mainly, covers how to use the scipy.signal package and is not a thorough introduction to IIR filter design. For complete coverage of IIR filter design and structure see one of the references.

Filter SpecificationBefore providing some examples lets review the specifications for a filter design. A filter...

## Autocorrelation and the case of the missing fundamental

[UPDATED January 25, 2016: One of the examples was broken, also the IPython notebook links now point to nbviewer, where you can hear the examples.]

For sounds with simple harmonic structure, the pitch we perceive is usually the fundamental frequency, even if it is not dominant. For example, here's the spectrum of a half-second recording of a saxophone.

The first three peaks are at 464, 928, and 1392 Hz. The pitch we perceive is the fundamental, 464 Hz, which is close to...

## [Book Review] Numpy 1.5 Beginner's Guide

Full Disclosure: The publisher of this book, PACKT, was soliciting reviewers. I volunteered to review the book and the publisher sent me an e-version of the book.

IntroductionThe following is a review of "Numpy 1.5 Beginner's Guide", "Learn by doing: less theory, more results" by Ivan Idris. As the title suggests this book is for a beginner. Either someone who is new to numerical computing with high-level languages (HLL) or someone who is new to the Python...

## Python scipy.signal IIR Filter Design

IntroductionThe following is an introduction on how to design an infinite impulse response (IIR) filters using the Python scipy.signal package. This post, mainly, covers how to use the scipy.signal package and is not a thorough introduction to IIR filter design. For complete coverage of IIR filter design and structure see one of the references.

Filter SpecificationBefore providing some examples lets review the specifications for a filter design. A filter...

## Python scipy.signal IIR Filtering: An Example

In the last posts I reviewed how to use the Python scipy.signal package to design digital infinite impulse response (IIR) filters, specifically, using the iirdesign function (IIR design I and IIR design II ). In this post I am going to conclude the IIR filter design review with an example.

Previous posts:

## Polyphase Filters and Filterbanks

ALONG CAME POLY

Polyphase filtering is a computationally efficient structure for applying resampling and filtering to a signal. Most digital filters can be applied in a polyphase format, and it is also possible to create efficient resampling filterbanks using the same theories.

This post will walk through a reference implementation of both the downsampling polyphase filter and a downsampling polyphase filterbank using scipy, numpy, matplotlib, and python. It should also highlight some of...

## Curse you, iPython Notebook!

First, I think ipython is great. I use it daily and always have an ipython terminal open. But just recently, I was showing off the ipython 0.12 notebook and in the process created a lengthy example while demonstrating the cool features of the ipython notebook. The example included LaTeX equations, plots, etc. Since the notebook session was on something of relevance I decided to clean up the session and use it for the beginning of a report.

## Python scipy.signal IIR Filter Design Cont.

In the previous post the Python scipy.signal iirdesign function was disected. We reviewed the basics of filter specification and reviewed how to use the iirdesign function to design IIR filters. The previous post I only demonstrated low pass filter designs. The following are examples how to use the iirdesign function for highpass, bandpass, and stopband filters designs.

Highpass FilterThe following is a highpass filter design for the different filter...

## Bayes meets Fourier

Joseph Fourier never met Thomas Bayes—Fourier was born in 1768, seven years after Bayes died. But recently I have been exploring connections between the Bayes filter and the Fourier transform.

By "Bayes filter", I don't mean spam filtering using a Bayesian classifier, but rather recursive Bayesian estimation, which is used in robotics and other domains to estimate the state of a system that evolves over time, for example, the position of a moving robot. My interest in...

## Generating pink noise

In one of his most famous columns for Scientific American, Martin Gardner wrote about pink noise and its relation to fractal music. The article was based on a 1978 paper by Voss and Clarke, which presents, among other things, a simple algorithm for generating pink noise, also known as 1/f noise.

The fundamental idea of the algorithm is to add up several sequences of uniform random numbers that get updated at different rates. The first source gets updated at...

## Constrained Integer Behavior

Integer arithmetic is ubiquitous in digital hardware implementations, it's prolific in the control and data-paths. When using fixed width (constrained) integers, overflow and underflow is business as usual.

Building with IntegersThe subtitle of this post mentions a wheel - before I get to the wheel I want to look at an example. The recursive-windowed-averager (rwa, a.k.a moving average)...

## Differentiating and integrating discrete signals

I am back at work on Think DSP, adding a new chapter on differentiation and integration. In the previous chapter (which you can read here) I present Gaussian smoothing, show how smoothing in the time domain corresponds to a low-pass filter in the frequency domain, and present the Convolution Theorem.

In the current chapter, I start with the first difference operation (diff in Numpy) and show that it corresponds to a high-pass filter in the frequency domain. I use historical stock...

## [Book Review] Numpy 1.5 Beginner's Guide

Full Disclosure: The publisher of this book, PACKT, was soliciting reviewers. I volunteered to review the book and the publisher sent me an e-version of the book.

IntroductionThe following is a review of "Numpy 1.5 Beginner's Guide", "Learn by doing: less theory, more results" by Ivan Idris. As the title suggests this book is for a beginner. Either someone who is new to numerical computing with high-level languages (HLL) or someone who is new to the Python...