1 ENGI 2420 Structured Programming (Lab Tutorial 7) Memorial University of Newfoundland.

Slides:



Advertisements
Similar presentations
Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Advertisements

This Time Whitespace and Input/Output revisited The Programming cycle Boolean Operators The “if” control structure LAB –Write a program that takes an integer.
Using Multimedia on the Web Enhancing a Web Site with Sound, Video, and Applets.
What is a pointer? First of all, it is a variable, just like other variables you studied So it has type, storage etc. Difference: it can only store the.
1 ENGI 2420 Structured Programming (Lab Tutorial 0) Memorial University of Newfoundland.
 2005 Pearson Education, Inc. All rights reserved Introduction.
1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
Chapter 10.
Java Programming Working with TextPad. Using TextPad to Work with Java This text editor is designed for working with Java You can download a trial version.
Introduction to C Programming Overview of C Hello World program Unix environment C programming basics.
ImageJ Tutorial.
Copyright 2003 Scott/Jones Publishing Brief Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Modular Programming Chapter Value and Reference Parameters t Function declaration: void computesumave(float num1, float num2, float& sum, float&
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Microsoft Office Excel Copyright © 2008 Pearson Prentice Hall. All rights reserved
Modular Programming Chapter Value and Reference Parameters computeSumAve (x, y, sum, mean) ACTUALFORMAL xnum1(input) ynum2(input) sumsum(output)
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
A1 Visual C++.NET Intro Programming in C++ Computer Science Dept Va Tech August, 2002 © Barnette ND & McQuain WD 1 Quick Introduction The following.
CS 114 – Class 02 Topics  Computer programs  Using the compiler Assignments  Read pages for Thursday.  We will go to the lab on Thursday.
ImageJ EE4H, M.Sc Computer Vision Dr. Mike Spann
C++ Programming: From Problem Analysis to Program Design, Fifth Edition, Fifth Edition Chapter 7: User-Defined Functions II.
Intro and Review Welcome to Java. Introduction Java application programming Use tools from the JDK to compile and run programs. Videos at
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
COMPUTER PROGRAMMING. A Typical C++ Environment Phases of C++ Programs: 1- Edit 2- Preprocess 3- Compile 4- Link 5- Load 6- Execute Loader Primary Memory.
DATA STRUCTURES LAB 1 TA: Nouf Al-harbi
9/2/ CS171 -Math & Computer Science Department at Emory University.
 Pearson Education, Inc. All rights reserved Introduction to Java Applications.
Using Microsoft Visual Studio 2005 Original by Suma Rao Revised by John G. McMahon ( 9/6/2008 )
1 ENGI 2420 Structured Programming (Lab Tutorial 4) Memorial University of Newfoundland.
Discussion 4. Labs public MyPoint(double xInit, double yInit ) { MyPoint p = new MyPoint(0, 0); } ClassProblem.java recursive java.lang.StackOverflowError.
Chapter 6 Review: User Defined Functions Introduction to MATLAB 7 Engineering 161.
Chapter 2 part #1 C++ Program Structure
1 ENGI 2420 Structured Programming (Lab Tutorial 7) Memorial University of Newfoundland.
Data Display Debugger (DDD)
Java Programming, Second Edition Appendix A Working with Java SDK 1.4.
Final Revision I 1020: Introduction to Programming Mohamed Shehata November 30, 2015.
C++ / G4MICE Course Session 1 - Introduction Edit text files in a UNIX environment. Use the g++ compiler to compile a single C++ file. Understand the C++
XP Tutorial 8 New Perspectives on Microsoft Windows XP 1 Microsoft Windows XP Object Linking and Embedding Tutorial 8.
1 ENGI 2420 Structured Programming (Lab Tutorial 8) Memorial University of Newfoundland.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 6: User-Defined Functions I.
1 ENGI 2420 Structured Programming (Lab Tutorial 5) Memorial University of Newfoundland.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 6: User-Defined Functions I.
Chapter 8 Arrays. A First Book of ANSI C, Fourth Edition2 Introduction Atomic variable: variable whose value cannot be further subdivided into a built-in.
Chapter 3: User-Defined Functions I
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 6: User-Defined Functions I.
1 ENGI 2420 Structured Programming (Lab Tutorial 3) Memorial University of Newfoundland.
PHP Form Processing * referenced from
Chapter – 8 Software Tools.
Review. Problem 1 What is the output of the following piece of code void increment(int x) { x++; } int main() { int y = 10; increment(y); cout
1 Project 5: Leap Years. 222 Leap Years Write a program that reads an integer value from the user representing a year and determines if the year is a.
1 ENGI 2420 Structured Programming (Lab Tutorial 2) Memorial University of Newfoundland.
Introduction to Programming Python Lab 8: Loops 26 February PythonLab8 lecture slides.ppt Ping Brennan
1 Input (Read) Statement. Variable Declaration (Definition) Initialization Assignment Displaying variables: using cout statement Reading variables from.
FUNCTIONS (C) KHAERONI, M.SI. OBJECTIVE After this topic, students will be able to understand basic concept of user defined function in C++ to declare.
Problem: Take Two Numbers, Add Them Together And Display The Results. Now To Build The Flowchart… We Probably Need One Like This… Let’s Add The Routines…
Linux Administration Working with the BASH Shell.
1 Section 5.4 Digital Sound Processing Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
DEVRY CIS 170 C I L AB 1 OF 7 G ETTING S TARTED Check this A+ tutorial guideline at
Chapter 6: User-Defined Functions I
Chapter 7: User-Defined Functions II
A Short DOS Presentation
Testing and Debugging.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
الوحدة الرابعة البرمجة وصياغة حل المسائل البرمجة وأهميتها أهداف الدرس الأول مفهوم البرمجة. الفرق بين المبرمج ومستخدم البرنامج. الحاجة إلى البرامج.
Lab 1 Introduction to C++.
Programming Fundamentals Lecture #3 Overview of Computer Programming
Chapter 6: User-Defined Functions I
Computer Programming-1 CSC 111
Chapter 1 c++ structure C++ Input / Output
Java Code Review with CheckStyle
Presentation transcript:

1 ENGI 2420 Structured Programming (Lab Tutorial 7) Memorial University of Newfoundland

ENGI 2420 – Structured Programming Lab Tutorial 7 2 Preferences in Eclipse  Warning message “no newline at end of file”  How to enable automatic newline insertion in Eclipse check Window -> Preferences -> C/C++ -> Editor -> Ensure newline at end of file when saving  How to show line number in Eclipse check Window -> Preferences -> General -> Editors -> Text Editors -> Show line numbers

ENGI 2420 – Structured Programming Lab Tutorial 7 3 Assignment-7  Purpose of this assignment a filter to implement a fuzzbox effect on a sound (music) file or an echo effect  Structure of C++ files - assign7.h (downloadable): contains the declarations for the functions - a7main.cpp (downloadable): main function that can be used as test code - assign7.cpp: contains your implemented functions (only submit this one via web-submit) - you may want to create your own test code in a separate.cpp file (do NOT submit your test code)

ENGI 2420 – Structured Programming Lab Tutorial 7 4 readSoundData  int readSoundData(int snd[])  Read the sound data from cin and store it in snd, which can be assumed to be big enough for at least MAX_SND_SIZE (500000) samples. Return the number of samples read, if successful. If the number of samples input is invalid, then return 0

ENGI 2420 – Structured Programming Lab Tutorial 7 5 Data Format  Must be strictly adhered to so that your program can interact with MMGood  The data consists of a sequence of integers each on a separate line  The first number is to be interpreted as the number of samples to follow (i.e., the size of the data), while the remaining numbers are the data

ENGI 2420 – Structured Programming Lab Tutorial 7 6 writeSoundData  void writeSoundData(int snd[], int size)  Output (to cout) the size samples in snd using the format described above

ENGI 2420 – Structured Programming Lab Tutorial 7 7 fuzzBox  int fuzzBox(int snd[], int size, int clip)  Clip the size samples in snd to a maximum amplitude (magnitude) of clip. Elements of snd whose magnitude is greater than clip should be set to clip or -clip appropriately, so as not to change the sample's sign. Return the number of samples that had their value changed.

ENGI 2420 – Structured Programming Lab Tutorial 7 8 fuzzBox  Example:  Initial value of the array  clip = 100  Final value of the array

ENGI 2420 – Structured Programming Lab Tutorial 7 9 echoBox  void echoBox(int snd[], int size, int delayTime)  Add a delayed copy of the sound to the sound  Example and the delay time is 2, then the final value of the sample will be

ENGI 2420 – Structured Programming Lab Tutorial 7 10 Running the Program  Our main program uses a "program argument" to select the effect (fuzz or echo). 0 is for fuzz and 1 is for echo  Windows: from the (windows) command line you launch your program as follows: C:\My Documents\courses\sp\workspace\A7>.\debug\A7 0 or C:\My Documents\courses\sp\workspace\A7>.\debug\A7 1  In Eclipse, you can use the "Run > Open Run Dialog..." command and then edit the "program arguments" to be either "0" or "1" to select fuzzBox or echoBox respectively

ENGI 2420 – Structured Programming Lab Tutorial 7 11 Running with MMGood  MMGood is a java program that will execute your program on actual.wav files so you can hear them working  Download mmgood.jar to your hard drive  Download the sample.wav files: engage.wav and guitar.wav  For windows –Download mmgood.bat and put it in the same directory –Double click on mmgood.bat  For unix/linux/mac –Download mmgood.sh to the same directory –Make this file executable. –Execute the mmgood.sh file

ENGI 2420 – Structured Programming Lab Tutorial 7 12 Running with MMGood  Once mmgood's main window has appeared, and you have compiled your project, you can –Load an input.wav file –Play the input.wav file

ENGI 2420 – Structured Programming Lab Tutorial 7 13 Running with MMGood –Select your assignment 7 executable. (It is in the Debug subdirectory of your project directory and, in Windows, its name will end with ".exe".) –Set the argument to be 0 or 1 –Run the executable –Wait patiently for your program to finish –Play the output sound

ENGI 2420 – Structured Programming Lab Tutorial 7 14 Running with MMGood –Wait patiently for your program to finish –Play the output sound