Slides from PyCon 2013 tutorial reformatted for self-study. Code at https://github.com/mchua/pycon-sigproc, original description follows: Why do pianos sound different from guitars? How can we visualize how deafness affects a child's speech? These are signal processing questions, traditionally tackled only by upper-level engineering students with MATLAB and differential equations; we're going to do it with algebra and basic Python skills. Based on a signal processing class for audiology graduate students, taught by a deaf musician.
Using this software any 50 sec audio message can be decrypted into image file and then original message can again be recovered from image file. This project is coded in Matlab and gui is also built in Matlab.
Using this software any 50 sec audio message can be decrypted into image file and then original message can again be recovered from image file. This project is coded in Matlab and gui is also built in Matlab.
Security Concepts: Introduction, The need for security, Security approaches, Principles of security, Types of Security attacks, Security services, Security Mechanisms, A model for Network Security Cryptography Concepts and Techniques: Introduction, plain text and cipher text, substitution techniques, transposition techniques, encryption and decryption, symmetric and asymmetric key cryptography, steganography, key range and key size, possible types of attacks
Error control codes are necessary for transmission and storage of large volumes of date sensitive to errors. BCH codes and Reed Solomon codes are the most important class of multiple error correcting codes for binary and non-binary channels respectively. Peterson and later Berlekamp and Massey discovered powerful algorithms which became viable with the help of new digital technology. Use of Galois fields gave a structured approach to designing of these codes. This presentation deals with above in a very structured and systematic manner.
This presentation on Pseudo Random Number Generator enlists the different generators, their mechanisms and the various applications of random numbers and pseudo random numbers in different arenas.
Security Concepts: Introduction, The need for security, Security approaches, Principles of security, Types of Security attacks, Security services, Security Mechanisms, A model for Network Security Cryptography Concepts and Techniques: Introduction, plain text and cipher text, substitution techniques, transposition techniques, encryption and decryption, symmetric and asymmetric key cryptography, steganography, key range and key size, possible types of attacks
Error control codes are necessary for transmission and storage of large volumes of date sensitive to errors. BCH codes and Reed Solomon codes are the most important class of multiple error correcting codes for binary and non-binary channels respectively. Peterson and later Berlekamp and Massey discovered powerful algorithms which became viable with the help of new digital technology. Use of Galois fields gave a structured approach to designing of these codes. This presentation deals with above in a very structured and systematic manner.
This presentation on Pseudo Random Number Generator enlists the different generators, their mechanisms and the various applications of random numbers and pseudo random numbers in different arenas.
Deep Learning with Audio Signals: Prepare, Process, Design, ExpectKeunwoo Choi
Is deep learning Alchemy? No! But it heavily relies on tips and tricks, a set of common wisdom that probably works for similar problems. In this talk, I’ll introduce what the audio/music research societies have discovered while playing with deep learning when it comes to audio classification and regression -- how to prepare the audio data and preprocess them, how to design the networks (or choose which one to steal from), and what we can expect as a result.
An introduction to Deep Learning (DL) concepts, such as neural networks, back propagation, activation functions, CNNs, and GANs, along with a simple yet complete neural network.
A fast-paced introduction to Deep Learning concepts, such as activation functions, cost functions, back propagation, and then a quick dive into CNNs, followed by a Keras code sample for defining a CNN. Basic knowledge of vectors, matrices, and derivatives is helpful in order to derive the maximum benefit from this session. Then we'll see a short introduction to TensorFlow 1.x and some insights into TF 2 that will be released some time this year.
Introduction to Deep Learning, Keras, and TensorFlowSri Ambati
This meetup was recorded in San Francisco on Jan 9, 2019.
Video recording of the session can be viewed here: https://youtu.be/yG1UJEzpJ64
Description:
This fast-paced session starts with a simple yet complete neural network (no frameworks), followed by an overview of activation functions, cost functions, backpropagation, and then a quick dive into CNNs. Next, we'll create a neural network using Keras, followed by an introduction to TensorFlow and TensorBoard. For best results, familiarity with basic vectors and matrices, inner (aka "dot") products of vectors, and rudimentary Python is definitely helpful. If time permits, we'll look at the UAT, CLT, and the Fixed Point Theorem. (Bonus points if you know Zorn's Lemma, the Well-Ordering Theorem, and the Axiom of Choice.)
Oswald's Bio:
Oswald Campesato is an education junkie: a former Ph.D. Candidate in Mathematics (ABD), with multiple Master's and 2 Bachelor's degrees. In a previous career, he worked in South America, Italy, and the French Riviera, which enabled him to travel to 70 countries throughout the world.
He has worked in American and Japanese corporations and start-ups, as C/C++ and Java developer to CTO. He works in the web and mobile space, conducts training sessions in Android, Java, Angular 2, and ReactJS, and he writes graphics code for fun. He's comfortable in four languages and aspires to become proficient in Japanese, ideally sometime in the next two decades. He enjoys collaborating with people who share his passion for learning the latest cool stuff, and he's currently working on his 15th book, which is about Angular 2.
Introduction to Deep Learning, Keras, and TensorflowOswald Campesato
A fast-paced introduction to Deep Learning concepts, such as activation functions, cost functions, back propagation, and then a quick dive into CNNs. Basic knowledge of vectors, matrices, and derivatives is helpful in order to derive the maximum benefit from this session. Then we'll see how to create a Convolutional Neural Network in Keras, followed by a quick introduction to TensorFlow and TensorBoard.
A fast-paced introduction to Deep Learning (DL) concepts, starting with a simple yet complete neural network (no frameworks), followed by aspects of deep neural networks, such as back propagation, activation functions, CNNs, and the AUT theorem. Next, a quick introduction to TensorFlow and TensorBoard, along with some code samples with TensorFlow. For best results, familiarity with basic vectors and matrices, inner (aka "dot") products of vectors, the notion of a derivative, and rudimentary Python is recommended.
Intro to Deep Learning, TensorFlow, and tensorflow.jsOswald Campesato
This fast-paced session introduces Deep Learning concepts, such gradient descent, back propagation, activation functions, and CNNs. We'll look at creating Android apps with TensorFlow Lite (pending its availability). Basic knowledge of vectors, matrices, and Android, as well as elementary calculus (derivatives), are strongly recommended in order to derive the maximum benefit from this session.
"A fast-paced introduction to Deep Learning (DL) concepts, such as neural networks, back propagation, activation functions, and CNNs. We'll also look at JavaScript-based toolkits (such as TensorFire and deeplearning.js) that leverage the power of WebGL. Basic knowledge of elementary calculus (e.g., derivatives) is recommended in order to derive the maximum benefit from this session.
PyCon Toronto 2013: EduPsych Theory for Python Hackers 2.0Mel Chua
A hacker's translation of engineering education graduate school.
How can we think about designing learning experiences? How do we understand ourselves as individual learners with distinct styles? How can we describe the way community interactions help us learn?
These questions -- and more -- are tackled and illustrated with examples from Python development (and occasional pictures of cats). If you're a hacker, you're already doing awesome learning stuff -- now learn a vocabulary you can use to talk about it!
Edupsych Theory for Hacker School: Summer 2013 editionMel Chua
Based on my PyCon talk "EduPsych Theory for Python Hackers," here are the slides for my Summer 2013 Hacker School talk. The intent is to give this summer's batch of Hacker Schoolers ways to metacogitate about the self-directed learning they're embarking on.
Tech Talk on how and why students can get involved in open source projects. Delivered at Georgia Gwinnett College on March 22, 2013. (Note that there were several websites displayed in the browser that are not in the slides; however, the URLs of those sites are on the last slide of the deck.)
The core deck of the "choose your own adventure" style talk at the 2011 Ohio LinuxFest. It's about using FOSS tools and practices to support life-gamification -- putting behavorial psychology to work on your brain as a platform. The talk was a nonlinear narrative; start with this deck, then whenever you hit a slide that says "Let's Play A Game," branch out to one of the other talks I've uploaded with the olf-2011 tag.
A sample jazz slidedeck, used during the "Music Game" portion of my OLF talk (see other talks with the olf-2011tag) -- an example of how to repurpose simple FOSS tools (in this case, OpenOffice Impress) for lifehacking (in this case, auto-advance slides to help me memorize chords for a jazz piece I'm learning).
One of the "choose your own adventure" decks used during my 2011 Ohio LinuxFest talk, "Level-up with Lies, Damned Lies, and Statistics: Turn your Life into a Data-Driven Video Game with FOSS," which is about using FOSS tools and practices to support life-gamification -- putting behavorial psychology to work on your brain as a platform. The talk was a nonlinear narrative, so if you've just stumbled across this one, check out my other talks with the olf-2011 tag and start with the one called "Main Talk" -- you'll know when it's time to branch out to the other decks.
One of the "choose your own adventure" decks used during my 2011 Ohio LinuxFest talk, "Level-up with Lies, Damned Lies, and Statistics: Turn your Life into a Data-Driven Video Game with FOSS," which is about using FOSS tools and practices to support life-gamification -- putting behavorial psychology to work on your brain as a platform. The talk was a nonlinear narrative, so if you've just stumbled across this one, check out my other talks with the olf-2011 tag and start with the one called "Main Talk" -- you'll know when it's time to branch out to the other decks.
One of the "choose your own adventure" decks used during my 2011 Ohio LinuxFest talk, "Level-up with Lies, Damned Lies, and Statistics: Turn your Life into a Data-Driven Video Game with FOSS," which is about using FOSS tools and practices to support life-gamification -- putting behavorial psychology to work on your brain as a platform. The talk was a nonlinear narrative, so if you've just stumbled across this one, check out my other talks with the olf-2011 tag and start with the one called "Level-Up Main Talk" -- you'll know when it's time to branch out to the other decks.
The Invisible Traceback: blockers that make potential contributors drop out (and how to fix them) - originally presented at the 2009 Ontario Linux Festival.
Abstract:
Unix Philosophy #12, Rule of Repair: "When you must fail, fail noisily and as soon as possible." This applies to both code and culture; when someone gets stuck and hollers for help, they are helping their community find and fix a participation process bug. However, the new contributor on-ramp pipeline is particularly tricky to debug; potential participants often struggle in silence, giving you no indication of their presence, let alone why they were unable to begin working with your project community. We'll go over some common blockers that quietly prevent students (and other new contributors) from beginning to participate in open source, and how to fix them no matter who you are.
Beginners enthusiastically welcomed - this talk is for everyone who's ever wanted to contribute to open source as well as everyone who's ever wanted to help someone else get started. It took me over 6 years of banging my head against a solitary wall to figure out how to contribute back to open source (and it's been worth it); here's how to figure out (or help someone figure out) the same thing in 99.999% less time.
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
Generating a custom Ruby SDK for your web service or Rails API using Smithyg2nightmarescribd
Have you ever wanted a Ruby client API to communicate with your web service? Smithy is a protocol-agnostic language for defining services and SDKs. Smithy Ruby is an implementation of Smithy that generates a Ruby SDK using a Smithy model. In this talk, we will explore Smithy and Smithy Ruby to learn how to generate custom feature-rich SDKs that can communicate with any web service, such as a Rails JSON API.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Key Trends Shaping the Future of Infrastructure.pdf
Digital signal processing through speech, hearing, and Python
1. Digital Signal Processing through
Speech, Hearing, and Python
Mel Chua
PyCon 2013
This tutorial was designed to be run on a free
pythonanywhere.com Python 2.7 terminal.
If you want to run the code directly on your machine,
you'll need python 2.7.x, numpy, scipy, and
matplotlib.
Either way, you'll need a .wav file to play with
(preferably 1-2 seconds long).
2. Agenda
● Introduction
● Fourier transforms, spectrums, and spectrograms
● Playtime!
● SANITY BREAK
● Nyquist, sampling and aliasing
● Noise and filtering it
● (if time permits) formants, vocoding, shifting, etc.
● Recap: so, what did we do?
3. What's signal processing?
● Usually an upper-level undergraduate engineering
class
● Prerequisites: circuit theory, differential equations,
MATLAB programming, etc, etc...
● About 144 hours worth of work (3 hours per credit
per week, 3 credits, 16 weeks)
● We're going to do this in 3 hours (1/48th the time)
● I assume you know basic Python and therefore
algebra
5. We will not...
● Do circuit theory, differential equations,
MATLAB programming, etc, etc...
● Work with images
● Write tons of code from scratch
● See rigorous proofs, math, and/or definitions
6. We will...
● Play with audio
● Visualize audio
● Generate and record audio
● In general, play with audio
● Do a lot of “group challenge time!”
7. Side notes
● This is based on a graduate class teaching
signal processing to audiology majors
● We've had half a semester to do everything
(about 70 hours)
● I'm not sure how far we will get today
10. Let's write some code.
Open up the terminal and follow along.
We assume you have a file called 'flute.wav' in
the directory you are running the terminal from.
12. ...and create some data.
Here we're making a signal
consisting of 2 sine waves
(1250Hz and 625Hz)
sampled at a 10kHz rate.
x = arange(256.0)
sin1 = sin(2*pi*(1250.0/10000.0)*x)
sin2 = sin(2*pi*(625.0/10000.0)*x)
sig = sin1 + sin2
13. What does this look like?
Let's plot it and find out.
import matplotlib.pyplot as pyplot
pyplot.plot(sig)
pyplot.savefig('sig.png')
pyplot.clf() # clear plot
15. While we're at it, let's define a
graphing function so we don't need
to do this all again.
def makegraph(data, filename):
pyplot.clf()
pyplot.plot(data)
pyplot.savefig(filename)
16. Our first plot showed the signal in
the time domain. We want to see it
in the frequency domain.
A numpy function that implements
an algorithm called the Fast Fourier
Transform (FFT) can take us there.
data = fft.rfft(sig)
# note that we use rfft because
# the values of sig are real
makegraph(data, 'fft0.png')
18. That's a start.
We had 2 frequencies in the signal,
and we're seeing 2 spikes here, so
that seems reasonable.
But we did get this warning.
>>> makegraph(data, 'fft0.png')
/usr/local/lib/python2.7/site-
packages/numpy/core/numeric.py:320:
ComplexWarning:
Casting complex values to real discards the
imaginary part
return array(a, dtype, copy=False, order=order)
19. That's because the fourier transform
gave us a complex output – so we
need to take the magnitude of the
complex output...
data = abs(data)
makegraph(data, 'fft1.png')
# more detail: sigproc-outline.py
# lines 42-71
21. But this is displaying raw power
output, and we usually think of audio
volume in terms of decibels.
Wikipedia tells us decibels (dB) are
the original signal plotted on a
10*log10 y-axis, so...
data = 10*log10(data)
makegraph(data, 'fft2.png')
23. We see our 2 pure tones showing
up as 2 peaks – this is great. The
jaggedness of the rest of the signal
is quantization noise, a.k.a.
numerical error, because we're
doing this with approximations.
Question: what's the relationship of
the x-axis of the graph and the
frequency of the signal?
24. Answer: the numpy fft function goes
from 0-5000Hz by default.
This means the x-axis markers
correspond to values of 0-5000Hz
divided into 128 slices.
5000/128 = 39.0625 Hz per marker
25. The two peaks are at 16 and 32.
(5000/128)*16 = close to 625Hz
(5000/128)*32 = close to 1250Hz
...which are our 2 original tones.
29. Do you see how the spectrogram is
sort of like our last plot, extruded
forward out of the screen, and
looked down upon from above?
That's a spectrogram. Time is on the
x-axis, frequency on the y-axis,and
amplitude is marked by color.
30. Now let's do this with a more
complex sound. We'll need to use a
library to read/write .wav files.
import scipy
from scipy.io.wavfile import read
31. Let's define a function to get the
data from the .wav file, and use it.
def getwavdata(file):
return scipy.io.wavfile.read(file)[1]
audio = getwavdata('flute.wav')
# more detail on scipy.io.wavfile.read
# in sigproc-outline.py, lines 117-123
32. Hang on! How do we make sure
we've got the right data? We could
write it back to a .wav file and make
sure they sound the same.
from scipy.io.wavfile import write
def makewav(data, outfile, samplerate):
scipy.io.wavfile.write(outfile, samplerate, data)
makewav(audio, 'reflute.wav', 44100)
# 44100Hz is the default CD sampling rate, and
# what most .wav files will use.
33. Now let's see what this looks like in
the time domain. We've got a lot of
data points, so we'll only plot the
beginning of the signal here.
makegraph(audio[0:1024], 'flute.png')
35. What does this look like in the
frequency domain?
audiofft = fft.rfft(audio)
audiofft = abs(audiofft)
audiofft = 10*log10(audiofft)
makegraph(audiofft, 'flutefft.png')
37. This is much more complex. We can
see harmonics on the left side.
Perhaps this will be clearer if we plot
it as a spectrogram.
pyplot.clf()
sgram = specgram(audio)
pyplot.savefig('flutespectro.png')
39. You can see the base note of the
flute (a 494Hz B) in dark red at the
bottom, and lighter red harmonics
above it.
http://www.bgfl.org/custom/resources_ftp/client_ftp/ks2/music/piano/flute.htm
http://en.wikipedia.org/wiki/Piano_key_frequencies
40. Your Turn: Challenge
● That first signal we made? Make a wav of it.
● Hint: you may need to generate more samples.
● Bonus: the flute played a B (494Hz) – generate
a single sinusoid of that.
● Megabonus: add the flute and sinusoid signals
and play them together
41. Your turn: Challenge 2
● Record some sounds on your computer
● Do an FFT on it
● Plot the spectrum
● Plot the spectrogram
● Bonus: add the flute and your sinusoid and plot their
spectrum and spectrogram together – what's the x scale?
● Bonus: what's the difference between fft/rfft?
● Bonus: numpy vs scipy fft libraries?
● Bonus: try the same sound at different frequencies (example:
vowels)
42. Sanity break?
Come back in 20 minutes, OR: stay for a demo
of the wave library (aka “why we're using scipy”)
note: wavlibraryexample.py contains the
wave library demo (which we didn't get to in the
actual workshop)
43. Things people found during break
Problem #1: When trying to generate a pure-tone
(sine wave) .wav file, the sound is not audible.
Underlying reason: The amplitude of a sine wave is
1, which is really, really tiny. Compare that to the
amplitude of the data you get when you read in the
flute.wav file – over 20,000.
Solution: Amplify your sine wave by multiplying it by
a large number (20,000 is good) before writing it to
the .wav file.
44. More things people found
Problem #2: The sine wave is audible in the
.wav file, but sounds like white noise rather
than a pure tone.
Underlying reason: scipy.io.wavfile.write()
expects an int16 datatype, and you may be
giving it a float instead.
Solution: Coerce your data to int16 (see next
slide).
45. Coercing to int16
# option 1: rewrite the makewav function
# so it includes type coercion
def savewav(data, outfile, samplerate):
out_data = array(data, dtype=int16)
scipy.io.wavfile.write(outfile, samplerate, out_data)
# option 2: generate the sine wave as int16
# which allows you to use the original makewav function
def makesinwav(freq, amplitude, sampling_freq,
num_samples):
return array(sin(2*pi*freq/float(sampling_freq)
*arange(float(num_samples)))*amplitude,dtype=int16)
46. Post-break: Agenda
● Introduction
● Fourier transforms, spectrums, and spectrograms
● Playtime!
● SANITY BREAK
● Nyquist, sampling and aliasing
● Noise and filtering it
● (if time permits) formants, vocoding, shifting, etc.
● Recap: so, what did we do?
47. Nyquist: sampling and aliasing
● The sample rate matters.
● Higher is better.
● There is a tradeoff.
50. Nyquist-Shannon sampling theorem
(Shannon's version)
If a function x(t) contains no frequencies higher
than B hertz, it is completely determined by
giving its ordinates at a series of points spaced
1/(2B) seconds apart.
52. Let's explore the effects of sample
rate. When you listen to these .wav
files, note that doubling/halfing the
sample rate moves the sound
up/down an octave, respectively.
audio = getwavdata('flute.wav')
makewav(audio, 'fluteagain44100.wav', 44100)
makewav(audio, 'fluteagain22000.wav', 22000)
makewav(audio, 'fluteagain88200.wav', 88200)
53. Your turn
● Take some of your signals from earlier
● Try out different sample rates and see what
happens
● Hint: this is easier with simple sinusoids at first
● Hint: determine the highest frequency (your Nyquist
frequency), double it (that's your highest sampling
rate) and try sampling above, below, and at that
sampling frequency
● What do you find?
54. What do aliases alias at?
● They reflect around the sampling frequency
● Example: 40kHz sampling frequency
● Implies 20kHz Nyquist frequency
● So if we try to play a 23kHz frequency...
● ...it'll sound like 17kHz.
Your turn: make this happen with pure sinusoids
Bonus: with non-pure sinusoids
55. Agenda
● Introduction
● Fourier transforms, spectrums, and spectrograms
● Playtime!
● SANITY BREAK
● Nyquist, sampling and aliasing
● Noise and filtering it
● (if time permits) formants, vocoding, shifting, etc.
● Recap: so, what did we do?
58. Noise and filtering it
● High pass
● Low pass
● Band pass
● Band stop
● Notch
● (there are many more, but these basics)
59. Notice that all these filters work in
the frequency domain.
We went from the time to the
frequency domain using an FFT.
# get audio (again) in the time domain
audio = getwavdata('flute.wav')
# convert to frequency domain
flutefft = fft.rfft(audio)
60. We can go back from the frequency
to the time domain using an inverse
FFT (IFFT).
reflute.wav should sound identical to
flute.wav.
reflute= fft.irfft(flutefft, len(audio))
reflute_coerced = array(reflute,
dtype=int16) # coerce to int16
makewav(reflute_coerced,
'fluteregenerated.wav', 44100)
61. Let's look at flute.wav in the
frequency domain again...
# plot on decibel (dB) scale
makegraph(10*log10(abs(flutefft)),
'flutefftdb.png')
62. What if we wanted to cut off all the
frequencies higher than the 5000th
index? (low-pass filter)
63. Implement and plot the low-pass
filter in the frequency domain...
# zero out all frequencies above
# the 5000th index
# (BONUS: what frequency does this
# correspond to?)
flutefft[5000:] = 0
# plot on decibel (dB) scale
makegraph(10*log10(abs(flutefft)),
'flutefft_lowpassed.png')
65. Going from frequency back to time
domain so we can listen
reflute = fft.irfft(flutefft,
len(audio))
reflute_coerced = array(reflute,
dtype=int16) # coerce it
makewav(reflute_coerced,
'flute_lowpassed.wav', 44100)
66. What does the spectrogram of the
low-passed flute sound look like?
pyplot.clf()
sgram = specgram(audio)
pyplot.savefig('reflutespectro.png')
69. Your turn
● Take some of your .wav files from earlier, and
try making...
● Low-pass or high-pass filters
● Band-pass, band-stop, or notch filters
● Filters with varying amounts of rolloff
70. Agenda
● Introduction
● Fourier transforms, spectrums, and spectrograms
● Playtime!
● SANITY BREAK
● Nyquist, sampling and aliasing
● Noise and filtering it
● (if time permits) formants, vocoding, shifting, etc.
● Recap: so, what did we do?