For today you should:
1) Work on exercises from Chapter 1.
2) Get your software environment squared away (see below).
3) Read Chapter 2 if possible.
Today:
1) Harmonics
2) Aliasing
3) Implementation
For next time:
1) Read Chapters 1 and 2 if you have not.
2) Work on exercises.
3) Explore one of the readings or project ideas below.
4) Prepare a progress report (see Lecture 1).
Documentation for thinkdsp.py is at
http://greenteapress.com/thinkdsp/thinkdsp.html
But you will also want to read the source code.
If you have not already set up your Git repo with an upstream remote, you should cd into your repo and run
git remote -v
You should see a list of remotes, probably something like this:
origin https://github.com/YourName/ThinkDSP.git (fetch)
origin https://github.com/YourName/ThinkDSP.git (push)
To add my repo as an upstream remote:
git remote add upstream https://github.com/AllenDowney/ThinkDSP
If you list the remotes again, you should see the new entry. Now to pull changes from upstream:
git pull upstream master
upstream is the name of the remote to want to pull changes from; master is the name of the branch in the local repo you want to apply the changes to.
When you pull changes from upstream, they are applied to your local copy, but they are not in your repo on GitHub until you push them there.
1) cd into ThinkDSP/code and launch IPython. Start chap02.ipynb.
ipython notebook --matplotlib inline
2) Follow the examples there to explore the harmonic structure of triangle and square signals.
3) If you are feeling creative, write a class definition for a new kind of Signal. You can pattern-match on SquareWave and TriangleWave as examples.
4) Explore the harmonic structure of your new signal. Or if you didn't create one, try SawtoothSignal or ParabolicSignal in thinkdsp.
Recommended Exercise: What generalizations can we make about the shape of the wave form and the structure of the harmonics?
1) Run the aliasing example in chap02.ipynb.
2) Experiment with different signals, different frequencies, and different folding/Nyquist frequencies.
The most important methods we have seen so far are
class Wave:
def make_spectrum(self):
"""Computes the spectrum using FFT.
returns: Spectrum
"""
hs = numpy.fft.rfft(self.ys)
return Spectrum(hs, self.framerate)
and
class Spectrum:
def make_wave(self):
"""Transforms to the time domain.
returns: Wave
"""
ys = numpy.fft.irfft(self.hs)
return Wave(ys, self.framerate)
These methods are thin wrappers around
numpy.fft.rfft (real FFT)
numpy.fft.irfft (real FFT inverse)
You can read about these functions here.
The result of rfft is a vector of complex numbers. There are (at least) two ways to think of complex numbers:
Cartesian: real part + imaginary part
Polar: magnitude * exp(i * angle)
numpy provides absolute, which computes "absolute value" or magnitude, and angle, which computes angle (or argument, or phase).
Let's work through the example in chap02.ipynb.
Some lessons:
1) We hear the fundamental component as pitch.
2) We hear harmonic structure as timbre.
3) We don't hear phase (so there are many different looking waveforms that sound the same).
Vi Hart explains Chapters 1 and 2 (and more) in 12 minutes.
Here are some that I have heard about but generally not looked closely at:
Python for Signal Processing
https://github.com/unpingco/Python-for-Signal-Processing
Adventures in Signal Processing with Python (MATLAB? We don’t need no stinkin' MATLAB!)
http://www.embeddedrelated.com/showarticle/197.php
"Python For Audio Signal Processing" - Linux Audio Conference
http://lac.linuxaudio.org/2011/papers/40.pdf
"A python package with natural interface for signal processing", Noam Gavish,
https://github.com/noamg/signal_processing
As promised, here is a list of resources recommended by a very helpful reader, João Nuno Carvalho:
I would like to send you what I think is a good list of the current free resources in terms of books about DSP:
Introduction to Signal Processing (Orfanidis)
http://www.ece.rutgers.edu/~orfanidi/intro2sp/
The Scientist and Engineer's Guide to Digital Signal Processing (Smith)
Foundations of Signal Processing
and
Fourier and Wavelet Signal Processing
http://www.fourierandwavelets.org/ <----- Muito interessante
WAVELETS AND SUBBAND CODING
by Martin Vetterli and Jelena Kovačević
http://www.waveletsandsubbandcoding.org/
Online Books
-Mathematics of the Discrete Fourier Transform (DFT)
-Introduction to Digital Filters
-Physical Audio Signal Processing
-Spectral Audio Signal Processing
https://ccrma.stanford.edu/~jos/
[...]
This video is also interesting because it shows a simple and cheap way of doing real time DSP in the audio frequency (stereo) with just 15 dolares of hardware (ARM Cortex M4 microcontroller).
The author is also in the process of writing a book:
Digital Signal Processing and Applications Using the ARM Cortex M4 – November 3, 2014 by Donald Reay
There is also a course in DSP that is thought in Python that is very interesting:
EE123: Digital Signal Processing
https://inst.eecs.berkeley.edu/~ee123/sp14/
One site that has many cool projects in DSP with Arduino Uno and DUE is
http://coolarduino.wordpress.com/
This are real time projects
(This site had much more projects but the author took some of them away)
One that I mentioned in class: Implement something like AutoTune and see if you can improve the violin recording.
And a couple of past Kaggle competitions involving sound:
http://www.kaggle.com/c/whale-detection-challenge
https://www.kaggle.com/c/multilabel-bird-species-classification-nips2013
https://www.kaggle.com/c/mlsp-2013-birds
More from João Nuno Carvalho:
Example of projects:
-Detect the voice of a child, a women or a men (FFT - segment on different range of frequencies).
-Detect the frequency of a sound, How a guitar tuner works, with auto-correlation, comparing between zero crossing, auto correlation and FFT approaches .
-Detect weasels, and different kind of wisalls.
-How to detect a sound, or the similarity of a sound to a pre-recorded sound with Dynamic time warp algorithm.
-How the generation of speech works.
-How the recognition of speech works (with markov Hidden Models)
-How the cocktail party problem is solved.
-How SETI detects faint periodic signals, that are below de SNR.
Or how the Voyager 1 signals can be received on earth, and sended to voyager 1.
-Detect the direction of the most powerful sound or impulse,like a shoot or to track a quadricopter only by it’s sound
-How can you generate the sound of an instrument, like a guitar or a trompete. (Karplus strong)
-Directional Sound Bar (how to make phased arrays or beam forming)
-How phased array of microphones works, and how to make a directional microphone, that without motors move it’s direction.
-Acoustic Radar in 1D
-Acoustic Radar in 2D and 3D (the 2D version can be made with a 20 dolar usb external card like Behringer UCA 222 USB Audio Interface, that has 2 inputs and 2 outputs)
-Acoustic Camera ( Can be made using two usb sound cards Behringer UCA 222 USB)
-How to compress an image with wavelets.
-How to make the sound recording go faster in preview mode, without altering the pitch of the voice.
-How the the DSP of a ultrasound array of a echography works, to detect different kind of biological material
-how to make a 3d Scanner just with sound, microphones and speaker.
-How an acoustic spot light works (explaining the demodulation at high sound pressures)
-Explaining how to make a radar with Doppler Effect to measure the velocity.
-Explaining how to detect an event in a time series like the stock marker with wavelets, typical of an imminent buy or sell moment, with old financial data from yahoo site.
-Explaining a little bit why statistics is important in DSP, for signal estimation and detection.
-How to make a AM or FM radio receiver with just a low frequency microcontroller, using an band pass filter and carful a aliasing sample frequency.
-How to extend the range of a text radio emitter/receiver by repeating the message many times.
-How modulation works, and how can you do it.
-How Shazam works, how can you in a simple way identify every music in the world with a simple 15 seconds snipet.
-How to have more bit’s of resolution from an ADC using multiple samples.
----------------------------------------------------------------------------------
-Detect the position of the touch on a table based on the triangulation of the signal to 3 piezo.
Virtual Keyboard
-Determine the position of a person in a room based on triangulation of the steps with a piezo.
-Determine the velocity of a car based only on the Doppler effect when it passes perpendicular to a road side person. Android Phone/FFT
-Measure the heart rate with a piezo or a accelerometer on a phone that is taped to the arm.
-Measure the heart rate with a camera and a band pass filter on the change of color in the pixels of the image (MIT).
-Detect the velocity RPM of a car motor with just a piezo.
-Detect a gerar that is connected to a motor is near it's fail point, by putting a vibrations microphone (Piezo), and them doing a FFT and seing the principal componentes of the signal, the RPM and the number of theeth give the wear of the gear.
---------------------------------------------------------------------------------
-Voice Pitch changer
-scrambler for voice?
-Noise canceling Phones (ADC + Delay and Phase shift + DAC).
-Spike Noise canceler for LP Records.
-Audio Effects (echo, reverb, phaser, ring modulation)
-Audio equalizer.
-Audio Bandwidth simulator for Telephone, AM Radio, FM Audio or CD Audio.
-Implement a Digital CrossOver for multiamplifier speakers
-Ambient noise canceling with 2 microphones Front of phone back of phone placement.
-Vocal removal from Music.
-Speaker recognition, recognizing which person is speaking.
-Program to extract the musical notes from a music, manual help just do the FFT and a graph of frequency vs time, in which amplitude is maped to color.
-Implementation of ADPCM Compression and decompression algorithm.
-Video Stabilization using correlation between n and n-1 video frames.