600.429 FUNCTIONAL PROGRAMING AT WORK - HASKELL AND DOMAIN SPECIFIC LANGUAGES Dr. John Peterson Western State Colorado University.

Slides:



Advertisements
Similar presentations
Computer Vision Lecture 7: The Fourier Transform
Advertisements

Spectral Leakage Pp289 jdsp. Freq of kth sample, No centering.
LECTURE Copyright  1998, Texas Instruments Incorporated All Rights Reserved Use of Frequency Domain Telecommunication Channel |A| f fcfc Frequency.
Monday, November 15, 2010 English II Complete the “How well do you know Shakespeare’s language” quiz. Complete this by yourself. Don’t talk to anyone about.
Unit Generators and V.I.s Patches are configurations of V.I.s Both Patches & Virtual Instruments can be broken down into separate components called Unit.
Probability theory and average-case complexity. Review of probability theory.
25 May May May 2015Week 5-2D Transformations1 2D Transformations By: KanwarjeetSingh.
Dr. Holbert Dr. Holbert April 23, 2008
Week 1 Chapter 1 + Appendix A Signals carry information Signals are represented by functions Systems transform signals Systems are represented by functions,
Gheorghe M. Ştefan
Rate Conversion. 2 Outline Problem statement Standard approach Decimation by a factor D Interpolation by a factor I Sampling rate conversion by a rational.
EECS 20 Chapter 21 Defining Signals and Systems Last time we Introduced mathematical notation to help define sets Learned the names of commonly used sets.
CS 280 Data Structures Professor John Peterson. Goals Understand “Programming in the small” Java programming Know what’s under the hood in complex libraries.
1 COMP541 Combinational Logic - 2 Montek Singh Jan 18, 2007.
CS 300 – Lecture 20 Intro to Computer Architecture / Assembly Language Caches.
CS 280 Data Structures Professor John Peterson. Test #1 We’ll do a test next week on Wednesday. It will take the entire period. You can have 1 page of.
Chapter 1 Problem Solving, Programming, and Calculation.
CS 280 Data Structures Professor John Peterson. Goals Understand “Programming in the small” Java programming Know what’s under the hood in complex libraries.
Combinational Logic Discussion D2.5. Combinational Logic Combinational Logic inputsoutputs Outputs depend only on the current inputs.
Week 1 1.websitewebsite 2.takehome examtakehome 3.Chapter Appendix A.
CS 280 Data Structures Professor John Peterson. Lexer Project Questions? Must be in by Friday – solutions will be posted after class The next project.
Operational Definitions In our last class, we discussed (a) what it means to quantify psychological variables and (b) the different scales of measurement.
Where we’re going Speed, Storage Issues Frequency Space.
1 CS/COE0447 Computer Organization & Assembly Language Pre-Chapter 2.
ECE 720T5 Winter 2014 Cyber-Physical Systems Rodolfo Pellizzoni.
XP Practical PC, 3e Chapter 16 1 Looking “Under the Hood”
The Discrete Fourier Transform. The Fourier Transform “The Fourier transform is a mathematical operation with many applications in physics and engineering.
CS1Q Computer Systems Lecture 9 Simon Gay. Lecture 9CS1Q Computer Systems - Simon Gay2 Addition We want to be able to do arithmetic on computers and therefore.
September 19, 2012Introduction to Artificial Intelligence Lecture 5: Functional Programming with Haskell 1 Functional Programming Symbolic AI is based.
Peeter EllerveeCEBE - Jäneda, Application Specific Processors for Signal Processing / Rakendus-spetsiifilised protsessorid signaalitöötluseks.
Relations and Functions
WARM UP Copy the ENTIRE Question with Answers and Circle your answer A student conducted an original, well- designed experiment carefully following the.
CIS 280 Hashing and Hash Tables. Calendar Today: Hashing and Hash Tables Wednesday: Calculus due, work Friday: Cuckoo hashing and linear hashing Monday:
Week 3 – Wednesday.  What did we talk about last time?  ADTs  List implementation with a dynamic array.
Lecture 7: Sampling Review of 2D Fourier Theory We view f(x,y) as a linear combination of complex exponentials that represent plane waves. F(u,v) describes.
Fundamentals of Algorithms MCS - 2 Lecture # 8. Growth of Functions.
Fitting: The Hough transform
Algorithm Analysis CS 400/600 – Data Structures. Algorithm Analysis2 Abstract Data Types Abstract Data Type (ADT): a definition for a data type solely.
© M. Winter COSC 4P41 – Functional Programming Programming with actions Why is I/O an issue? I/O is a kind of side-effect. Example: Suppose there.

Today in Precalculus Go over homework Notes: Graphs of Polar Equations Homework.
FUNCTIONAL PROGRAMING AT WORK - HASKELL AND DOMAIN SPECIFIC LANGUAGES Dr. John Peterson Western State Colorado University.
ELECTRIC FIELD AND MAYBE CHARGE W2-D1 Answer to a Question “Was this a typical class”? (Friday) My answers: – No – it was a bit screwed up. – Usually.
FUNCTIONAL PROGRAMING AT WORK - HASKELL AND DOMAIN SPECIFIC LANGUAGES Dr. John Peterson Western State Colorado University.
Input Function x(t) Output Function y(t) T[ ]. Consider The following Input/Output relations.
Do Now Find the domain & range:. Answers to Homework
POPULATION  an entire group of people or objects that you want information about. Sample  the part of the group that is surveyed. This is not new – we.
Antenna and Microwave Laboratory Babol Noshirvani University of Technology Antenna and Microwave Laboratory Babol Noshirvani University.
November 2013 Functional Reactive Programming Simplifying Interaction John Peterson Western State Colorado University Gunnison, CO.
FUNCTIONAL PROGRAMING AT WORK - HASKELL AND DOMAIN SPECIFIC LANGUAGES Dr. John Peterson Western State Colorado University.
FUNCTIONAL PROGRAMING AT WORK - HASKELL AND DOMAIN SPECIFIC LANGUAGES Dr. John Peterson Western State Colorado University.
Sin x = Solve for 0° ≤ x ≤ 720°
November 7, 2011 Objective: Students will understand how to read a credit report and begin to understand how to analyze a credit report to make a credit.
Function Notation and Making Predictions Section 2.3.
Chapter 6 Section 6.1 What is Group Theory?. Patterns in Mathematical Objects and Numbers The study of different patterns that can occur in numbers, shapes.
Welcome! Simone Campanoni
FUNCTIONAL PROGRAMING AT WORK - HASKELL AND DOMAIN SPECIFIC LANGUAGES Dr. John Peterson Western State Colorado University.
PROGRAMMABLE LOGIC CONTROLLERS SINGLE CHIP COMPUTER
CS 591 S1 – Computational Audio -- Spring, 2017
Datapaths For the rest of the semester, we’ll focus on computer architecture: how to assemble the combinational and sequential components we’ve studied.
Theory of Computation Turing Machines.
Day 16: Domain and Range..
CS/COE0447 Computer Organization & Assembly Language
Cornell Notes Section 1.6 Day 2 Section 1.6 Day 3 Section 1.7 Day 1
Warm-Up For the following, make a T-Chart and sketch a graph for x ={-2, -1, 0, 1, 2}
Introduction to Algorithm and its Complexity Lecture 1: 18 slides
Isolation Of Individual Tracks From Polyphonic Music
Rocky K. C. Chang September 11, 2018
Warm-Up #21 (Tuesday, 10/20) Given 3x + y = 3, if y = 3 find the value of x 4x + 2x – 2 = 42 solve for x.
Presentation transcript:

FUNCTIONAL PROGRAMING AT WORK - HASKELL AND DOMAIN SPECIFIC LANGUAGES Dr. John Peterson Western State Colorado University

This Week Homework 6: Last questions? Homwork 7 should be ready to go later today. It will be due next Friday. Next Monday will be spent getting organized on the projects – come ready to work. I’ll be talking to each group during class.

SPJ! The God of Haskell will be here next week. Talk is at 11:15 – Be There!

A New FRP – Arrows! Problems with the original FRP: No way to capture system inputs. The type Behavior a does not make the source of a explicit Nasty implementation issues involving space / time leaks The solution: Arrows (Yay for Category Theory)

A New Abstraction

Example: Stream Processors data Stream a b = Stream ([a] -> [b]) runS :: Stream a b -> [a] -> [b] runS (Stream f) inputs = f inputs instance Arrow Stream where arr g = Stream (map g) Stream f1 >>> Stream f2 = Stream (\input -> f2 (f1 input)) first (Stream f) = Stream (\s -> zip (f (map fst s)) (map snd s))

Euterpea Signal Processors The basic type is Clock c => SigFun c a b This allows different streams to have different sampling rates. Note that the arrow notation will require all components share a common clock You can explicitly upsample / downsample clocks using conversion functions

Oscillators osc :: Clock c => Table -> Double -> SigFun c () Double oscFixed :: Clock c => Double -> SigFun c () Double Tables are a fast way of representing functions They allow arbitrary functions to be pre-computed Instead of calculating values on the fly (sin and cos are computationally complex!)

Example: 3 Harmonics s :: Clock c => Sigfun c () Double s = proc () -> do f0 <- oscFixed 440 -< () f1 <- oscFixed 880 -< () f2 <- oscFixed < () outA -< (f0 * f1 * f2 * 0.33)/1.83

Instruments reedyWav = tableSinesN 1024 [0.4, 0.3, 0.35, 0.5, 0.1, 0.2, 0.15, 0.0, 0.02, 0.05, 0.03] reed :: Instr (Stereo AudRate) reed dur pch vol params = let reedy = osc reedyWav 0 freq = apToHz pch vel = fromIntegral vol / 127 / 3 env = envLineSeg [0, 1, 0.8, 0.6, 0.7, 0.6, 0] (replicate 6 (fromRational dur/6))

Instruments in proc _ -> do amp <- env -< () r1 <- reedy -< freq r2 <- reedy -< freq + (0.023 * freq) r3 <- reedy -< freq + (0.019 * freq) let [a1, a2, a3] = map (* (amp * vel)) [r1, r2, r3] let rleft = a1 * a2 * 0.44 * a3 * 0.26 * 0.65 rright = a1 * a2 * 0.44 * a3 * 0.26 * 0.35 outA -< (rleft, rright)