
Generating Waveforms: Learn Experiment with Ministry of Higher Education
Discover how to generate waveforms effectively in Experiment No. (13) conducted by Al-Mustansiriyah University's Faculty of Engineering Computer Engineering Department. Learn about the theory behind waveforms and practical steps to generate sinewaves. Explore file formats, data types, and ranges to enhance your understanding. Get hands-on with Matlab codes for audio processing and visualization. Elevate your knowledge and skills in waveform generation through this comprehensive experiment.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Ministry of Higher Education and Scientific Research Al-Mustansiriyah University Faculty of Engineering Computer Engineering Department Experiment No. (13) - Generating Waveforms Object: Learn to generate waveforms. Theory: Waveforms are just long vectors with one number per amplitude sample. Usually they are best kept scaled so that each amplitude is between 1 and 1. To generate a sinewave, first generate a time sequence t representing the times of each sampling instant; for example y = sin(2*pi*F*t); to read wave file in mathlab by using wavread instruction. y = wavread(filename) loads a WAVE file specified by the string filename, returning the sampled data in y. If filename does not include an extension, wavread appends .wav. [y, Fs] = wavread(filename) returns the sample rate (Fs) in Hertz used to encode the data in the file. [y, Fs, nbits] = wavread(filename) returns the number of bits per sample (nbits). Procedure Calculate the fundamental period 1 clear screen, clearworkspace 2Read wavefile 3-do loop 4-calculate N(N=2pik/w ) 5-increment k by 1 6 end do until int(N)=N 7 display N and plot the wave signal 67 | P a g e
File Format BitsPerSample Data Type of Y Data Range of Y ---------------------------------------------------------------------- WAVE (.wav) 8 uint8 0 <= Y <= 255 16 int16 -32768 <= Y <= 32767 24 int32 -2^31 <= Y <= 2^31-1 32 int32 -2^31 <= Y <= 2^31-1 32 single -1.0 <= Y <= +1.0 ---------------------------------------------------------------------- WAVE (.wav) (u-law) 8 int16 -32124 <= Y <= 32124 ---------------------------------------------------------------------- WAVE (.wav) (A-law) 8 int16 -32256 <= Y <= 32256 ---------------------------------------------------------------------- FLAC (.flac) 8 uint8 0 <= Y <= 255 16 int16 -32768 <= Y <= 32767 24 int32 -2^31 <= Y <= 2^31-1 ---------------------------------------------------------------------- MP3 (.mp3) N/A single -1.0 <= Y <= +1.0 MPEG-4(.m4a,.mp4) OGG (.ogg) ---------------------------------------------------------------------- Call audioinfo to learn the BitsPerSample of the file. Note that where Y is single or double and the BitsPerSample is 32 or 64, values in Y might exceed +1.0 or -1.0.
Matlab code: load handel.mat audiowrite('handel.wav',y,Fs) clear y Fs info = audioinfo('handel.wav') [y,Fs] = audioread('handel.wav'); sound(y,Fs) t = 0:seconds(1/Fs):seconds(info.Duration); t = t(1:end-1); plot(t,y) xlabel('Time') ylabel('Audio Signal')
Ministry of Higher Education and Scientific Research Al-Mustansiriyah University Faculty of Engineering Computer Engineering Department Procedure: Q/ using waveform generator block for generate different wave forms: 1. Sin inside Sin (1,1,2). 2. Guassian (0,10,1). 3. Step (1,0,1). 68 | P a g e