1 Audio input and output Speaker: Ching Chen Chang Date:2006.10.30.

Slides:



Advertisements
Similar presentations
Reading and Writing Text Files Svetlin Nakov Telerik Corporation
Advertisements

Audio 2 Subject:T0934 / Multimedia Programming Foundation Session:9 Tahun:2009 Versi:1/0.
WaveIO Speaker: Paul Date: Outline Wave File Format Multi-Media API (Output) Damo Multi-Media API (Input) Damo Reference 2.
SWE 423: Multimedia Systems Chapter 3: Audio Technology (2)
File Organizations Sept. 2012Yangjun Chen ACS-3902/31 Outline: File Organization Hardware Description of Disk Devices Buffering of Blocks File Records.
CSCI 3280 Tutorial 3 Project (C++)
Web siteWeb site ExamplesExamples 1 Mode of Operation Protected mode  4 GB  32-bit address  Windows, Linux Real-address mode  1 MB space  20-bit address.
Copyright © 2012 Pearson Education, Inc. Chapter 12: Advanced File Operations.
Java Audio.
Ceng 351 Lab1 Introduction to File Structures. Input Output Functions in C In C there is not any predefined commands for data transfer. – C functions.
Project 1 Speech Detection Due: Sunday, February 1 st, 11:59pm.
Introduction To XAudio2 © Allan C. Milne Abertay University v
SMAF What Is SMAF? What Is Is SMAF? What Can Use SMAF? SMAF Structure How SMAF files are Created MIDI and SMAF Demo.
Speech Detection Project 1. Outline Motivation Problem Statement Details Hints.
Chapter 9 Audio.
Chapter 8 Printing 1. In COBOL you send data to the printer by writing data to a file. In COBOL, the printer is defined as a file, and it is opened, closed,
Windows audio architecture Win MM Application DirectSound Application SysAudio.SYS Kmixer.SYS WinMM.DLLDSound.DLL Device Drive Container USB Device Driver.
Operating System Program 5 I/O System DMA Device Driver.
EEC-492/592 Kinect Application Development
University of Calgary – CPSC 441. C PROGRAM  Collection of functions  One function “main()” is called by the operating system as the starting function.
How to Add WMI Interfaces to SCSIPort and Storport Miniports
ACE Address Configuration Executive. Why ACE? ACE provides access to several address resolution protocols under a single API ACE is the only API available.
P2P VoIP Speaker : Ching Chen Chang Date: 2007/09/27.
CP104 Introduction to Programming File I/O Lecture 33 __ 1 File Input/Output Text file and binary files File Input/output File input / output functions.
TWAIN Open industry standard interface for the input devices to capture multimedia objects More and more sophisticated devies are developed to cater to.
Douglas Boling President Boling Consulting Inc. SESSION CODE: WEM304.
1 Programs Composed of Several Functions Syntax Templates Legal C++ Identifiers Assigning Values to Variables Declaring Named Constants String Concatenation.
Introduction to Biometrics Dr. Bhavani Thuraisingham The University of Texas at Dallas Lecture #23 Biometrics Standards - II November 14, 2005.
File Handling In C By - AJAY SHARMA. We will learn about- FFile/Stream TText vs Binary Files FFILE Structure DDisk I/O function OOperations.
Advanced File Operations Chapter File Operations File: a set of data stored on a computer, often on a disk drive Programs can read from, write to.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 12: Advanced File Operations.
Multimedia File Format Heejune AHN Embedded Communications Laboratory Seoul National Univ. of Technology Fall 2011 Last updated
2015/11/141 Audio I/O Speaker : Wei-Shin Pan DATE :
Speech Processing and Recognition © Florida Institute of Technology Access audio data in real time and apply to speech recognition Final Exam Project By.
Audio Yu Feng CGDD Review 1. Set up 2. IOS sound – Core Audio – Short Sound – Long Sound – Control Sound – Background Sound 3.Cocos2d sound.
Chapter 13 DirectSound 로 잡음 만들기. 2 History of Sound Programming Sound programming always gets put off until the end DOS –Third party sound libraries:
Sound DirectMusic & DirectSound. Sound Formats Wav Midi (Musical Instrument Digital Interface) DLS (Downloadable Sounds) DirectMusic Producer Segments.
1 Simple Input/Output  C++ offers the iostream library, which defines a system of character-oriented Input/Output (I/O) using object oriented programming.
Writing and Reading Files Methods for processing disk files File Control Blocks (FCBs) –Supported by DOS –Can address drives and filenames.
Glencoe Introduction to Multimedia Chapter 8 Audio 1 sound effect An artificially created or enhanced sound used to achieve an effect (without speech or.
1 Audio input and output Speaker: Ching Chen Chang Date:
READING AND WRITING FILES. READING AND WRITING FILES SEQUENTIALLY  Two ways to read and write files  Sequentially and RA (Random Access  Sequential.
Basic I/O in C Computer Organization I 1 August 2009 © McQuain, Feng & Ribbens Stream Model of I/O header file: A stream provides a connection.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Chapter -7 Basic function of Input/output system basics and file processing Stream classes : I/O Streams. A stream is a source or destination for collection.
1 CSC103: Introduction to Computer and Programming Lecture No 28.
Chapter 16 GPDUMB Engine Part II. 2 GPDUMB2 Engine.
Files A collection of related data treated as a unit. Two types Text
Advanced File Operations Chapter File Operations File: a set of data stored on a computer, often on a disk drive Programs can read from, write to.
C Programming Day 2. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/LA07/003 Version No. 1.0 Union –mechanism to create user defined data types.
File Operations. FILE PROCESSING For the purposes of the following discussion, reading means copying all or part of an existing file into memory Writing.
Silberschatz and Galvin  C Programming Language Kingdom of Saudi Arabia Ministry of Higher Education Al-Majma’ah University College of Education.
File I/O. I/O Flags Flags are passed to give some information about how the file is to be used. – Read only file – flag=0x0 – Write only file – flag=0x1.
Keerthi Nelaturu Url: site.uottawa.ca/~knela006
Yongchang, Kai, Justin, Rama
Chapter 7 Text Input/Output Objectives
Chapter 7 Text Input/Output Objectives
EEC-693/793 Applied Computer Vision with Depth Cameras
Chapter 22 – part a Stream refer to any source of input or any destination for output. Many small programs, obtain all their input from one stream usually.
Chapter 7 Text Input/Output Objectives
File I/O.
EEC-693/793 Applied Computer Vision with Depth Cameras
Beginning C Lecture 11 Lecturer: Dr. Zhao Qinpei
EEC-693/793 Applied Computer Vision with Depth Cameras
Chapter 12: Advanced File Operations.
A Simple Two-Pass Assembler
System Programming by Leland L. Beck Chapter 2
Console A presentation by Inti Vincenzo Pizzoni.
C Preprocessing File I/O
File Handling in C.
Presentation transcript:

1 Audio input and output Speaker: Ching Chen Chang Date:

2 Outline Multi-Media API (Input) Wave File Format Multi-Media API (Output) Sample program record1.cpp

3 WAVEFORMATEX typedef struct { WORD wFormatTag; WORD nChannels; DWORD nSamplesPerSec; DWORD nAvgBytesPerSec; WORD nBlockAlign; WORD wBitsPerSample; WORD cbSize; } WAVEFORMATEX; This structure defines the format of waveform-audio data.

4 WAVEHDR typedef struct { LPSTR lpData; DWORD dwBufferLength; DWORD dwBytesRecorded; DWORD dwUser; DWORD dwFlags; DWORD dwLoops; struct wavehdr_tag* lpNext; DWORD reserved; } WAVEHDR; This structure defines the header used to identify a waveform- audio buffer.

5 waveInOpen() MMRESULT waveInOpen(HWAVEIN &ihandle, UINT DeviceID, WAVEFORMATEX &waveformat, DWORD dwCallback, DWORD dwInstance, DWORD fdwOpen ); Open a specified waveform input device for recording. uDeviceID : WAVE_MAPPER fdwOpen : CALLBACK_WINDOW,CALLBACK_THREAD Return MMSYSERR_NOERROR means success

6 waveInPrepareHeader() MMRESULT waveInPrepareHeader( HWAVEIN ihandle, WAVEHDR &wh, UINT cbwh ); Prepares a buffer for waveform input. Returns MMSYSERR_NOERROR if successful.

7 waveInAddBuffer() MMRESULT waveInAddBuffer( HWAVEIN ihandle, WAVEHDR &wh, UINT cbwh ); Sends an input buffer to the specified waveform-audio input device. Returns MMSYSERR_NOERROR if successful.

8 waveInStart() MMRESULT waveInStart( HWAVEIN ihandle ); Starts input on the specified waveform input device. Returns MMSYSERR_NOERROR if successful.

9 waveInReset() MMRESULT waveInReset( HWAVEIN ihandle ); Stops input on a specified waveform input device and resets the current position to 0. Returns MMSYSERR_NOERROR if successful.

10 waveInUnprepareHeader() MMRESULT waveInUnprepareHeader( HWAVEIN ihandle, WAVEHDR &wh, UINT cbwh ); Cleans up the preparation performed by waveInPrepareHeader. Returns MMSYSERR_NOERROR if successful.

11 waveInClose() MMRESULT waveInClose( HWAVEIN ihandle); Closes the specified waveform-audio input device. Returns MMSYSERR_NOERROR if successful.

12 Wave File Format

13 MMCKINFO typedef struct { FOURCC ckid; DWORD cksize; FOURCC fccType; DWORD dwDataOffset; DWORD dwFlags; } MMCKINFO; The structure contains information about a chunk in a RIFF file.

14 mmioOpen() HMMIO mmioOpen( LPSTR Filename, MMIOINFO mmioinfo, DWORD dwOpenFlags ); The mmioOpen function opens a file for unbuffered or buffered I/O. Returns a handle of the opened file. If the file cannot be opened, the return value is NULL. dwOpenFlags :MMIO_CREATE 、 MMIO_WRITE 、 MMIO_READ …etc.

15 mmioCreateChunk() MMRESULT mmioCreateChunk( HMMIO hmmio, MMCKINFO &ck, UINT wFlags ); The mmioCreateChunk function creates a chunk in a RIFF file that was opened by using the mmioOpen function.mmioOpen wFlags :MMIO_CREATERIFF Returns MMSYSERR_NOERROR if successful

16 mmioFOURCC() FOURCC mmioFOURCC( CHAR ch0, CHAR ch1, CHAR ch2, CHAR ch3 ); The mmioFOURCC macro converts four characters into a four-character code. Returns the four-character code created from the given characters.

17 mmioWrite() LONG mmioWrite( HMMIO hmmio, char _huge* pch, LONG cch ); The mmioWrite function writes a specified number of bytes to a file opened by using the mmioOpen function mmioOpen Returns the number of bytes actually written.

18 mmioAscend() MMRESULT mmioAscend( HMMIO hmmio, MMCKINFO &ck, UINT wFlags ); The mmioAscend function ascends out of a chunk in a RIFF file wFlags : must be zero. Returns MMSYSERR_NOERROR if successful

19 mmioClose() MMRESULT mmioClose( HMMIO hmmio, UINT wFlags ); Returns zero if successful or an error otherwise.

20 waveOutOpen() MMRESULT waveOutOpen( HWAVEOUT &ohandle, UINT uDeviceID, WAVEFORMATEX &wf, DWORD dwCallback, DWORD dwInstance, DWORD fdwOpen ); Opens a specified waveform output device for playback. Returns MMSYSERR_NOERROR if successful.

21 waveOutPrepareHeader() MMRESULT waveOutPrepareHeader( HWAVEOUT ohandle, WAVEHDR &wh, UINT cbwh ); Prepares a waveform data block for playback. Returns MMSYSERR_NOERROR if successful.

22 waveOutWrite() MMRESULT waveOutWrite( HWAVEOUT ohandle, WAVEHDR &wh, UINT cbwh ); Sends a data block to the specified waveform output device. Returns MMSYSERR_NOERROR if successful.

23 waveOutReset() MMRESULT waveOutReset( HWAVEOUT ohandle ); Stops playback on a specified waveform output device and resets the current position to 0. Returns MMSYSERR_NOERROR if successful.

24 waveOutUnprepareHeader() MMRESULT waveOutUnprepareHeader( HWAVEOUT ohandle, WAVEHDR &wh, UINT cbwh ); Cleans up the preparation performed by waveOutPrepareHeader. Returns MMSYSERR_NOERROR if successful.

25 waveOutClose( ) MMRESULT waveOutClose( HWAVEOUT ohandle ); Closes the specified waveform output device. Returns MMSYSERR_NOERROR if successful.

26 Sample Program Record Produce the Wave file Play the record voice nChannels=1 nSamplesPerSec=8000 wBitsPerSample=8 Demo

27 Reference(1/2) Wavefomat /projects/WaveFormat/ Multimedia FILE I/O us/multimed/htm/_win32_multimedia_file_i_o.asp

28 Reference(2/2) Waveform Audio us/multimed/htm/_win32_about_waveform_audio.asp