Disassembling a Windows Wave File (.wav)



Similar documents
WAVE PCM soundfile format

Specification of the Broadcast Wave Format (BWF)

For full instructions on how to install Simsound please see the Technical Guide at the end of this document.

Documentation on Audio sound formats (wav, midi, aiff, au.) M.chandrasekhar (96D07008) WAVE Audio soundfile format

Analog Representations of Sound

Long-form file format for the international exchange of audio programme materials with metadata

The Answer to the 14 Most Frequently Asked Modbus Questions

CBS RECORDS PROFESSIONAL SERIES CBS RECORDS CD-1 STANDARD TEST DISC

Base Conversion written by Cathy Saxton

CS101 Lecture 11: Number Systems and Binary Numbers. Aaron Stevens 14 February 2011

Data Storage 3.1. Foundations of Computer Science Cengage Learning

Preservation Handbook

Counting in base 10, 2 and 16

Useful Number Systems

C Implementation & comparison of companding & silence audio compression techniques

Computer Networks and Internets, 5e Chapter 6 Information Sources and Signals. Introduction

Konexx USB Phone 2 PC Products. White Paper

The Sonometer The Resonant String and Timbre Change after plucking

Digital Transmission of Analog Data: PCM and Delta Modulation

The New IoT Standard: Any App for Any Device Using Any Data Format. Mike Weiner Product Manager, Omega DevCloud KORE Telematics

PCM Encoding and Decoding:

Binary Representation. Number Systems. Base 10, Base 2, Base 16. Positional Notation. Conversion of Any Base to Decimal.

Binary Representation

Sampling Theorem Notes. Recall: That a time sampled signal is like taking a snap shot or picture of signal periodically.

The number of channels represented in the waveform data, such as 1 for mono or 2 for stereo.

Department of Electrical and Computer Engineering Ben-Gurion University of the Negev. LAB 1 - Introduction to USRP

FREQUENCY RESPONSE OF AN AUDIO AMPLIFIER

CONNECTION MANAGEMENT

Computer Science 281 Binary and Hexadecimal Review

Computers. Hardware. The Central Processing Unit (CPU) CMPT 125: Lecture 1: Understanding the Computer

Technical Information. Digital Signals. 1 bit. Part 1 Fundamentals

Action Plan Background: WAVE. Author: Andrea Goethals Last Revision Date: 03/29/04

Chapter 4: Computer Codes

DDX 7000 & Digital Partial Discharge Detectors FEATURES APPLICATIONS

Digitizing Sound Files

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

EE 261 Introduction to Logic Circuits. Module #2 Number Systems

Introduction and Comparison of Common Videoconferencing Audio Protocols I. Digital Audio Principles

Red Bee Media. Technical file and tape delivery specification for Commercials. Applies to all channels transmitted by Red Bee Media

We KNOW We CARE We SERVE. Helping Businesses Make Intelligent Use of Technology. Sample Company. Telephone Engineering Analysis

Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8

Data Storage. Chapter 3. Objectives. 3-1 Data Types. Data Inside the Computer. After studying this chapter, students should be able to:

DDX 7000 & Digital Partial Discharge Detectors FEATURES APPLICATIONS

Dayton Audio is proud to introduce DATS V2, the best tool ever for accurately measuring loudspeaker driver parameters in seconds.

CPEN Digital Logic Design Binary Systems

Basics. Mbox 2. Version 7.0

The string of digits in the binary number system represents the quantity

GUIDELINES FOR THE CREATION OF DIGITAL COLLECTIONS

Type of Party on Hold. SIP Trunk, / ISDN CO/ ISDN Trunk via FXO gateway (Incoming) SIP Trunk, ISDN CO/ ISDN Trunk via FXO gateway (Outgoing)

Moven Studio realtime. streaming

Voxengo SPAN User Guide

CONCEPT1 RS232 COMMUNICATION

Constructing a precision SWR meter and antenna analyzer. Mike Brink HNF, Design Technologist.

Software Manual RS232 Laser Merge Module. Document # SU Rev A

First Bytes Programming Lab 2

Chapter 1: Digital Systems and Binary Numbers

Manual for the sound card oscilloscope V1.24 C. Zeitnitz english translation by P. van Gemmeren and K. Grady

Introduction to FM-Stereo-RDS Modulation

QUICK SETUP GUIDE SETUP FOR ICONNEX SOUNDCARD AND AUDACITY RECORDING SOFTWARE

Voice---is analog in character and moves in the form of waves. 3-important wave-characteristics:

73M1866B/73M1966B FXOCTL Application User Guide November 2, 2009 Rev. 4.1 UG_1x66B_009

RightMark Audio Analyzer 6.0. User s Guide

The Effective Number of Bits (ENOB) of my R&S Digital Oscilloscope Technical Paper

Memory Systems. Static Random Access Memory (SRAM) Cell

Keil Debugger Tutorial

Byte Ordering of Multibyte Data Items

Software Defined Radio

AFG-100/200 series USB Modular Arbitrary Function Generator. Date: Oct, 2014

Experiment # (4) AM Demodulator

Audio Coding, Psycho- Accoustic model and MP3

Lecture 2. Binary and Hexadecimal Numbers

Agilent 8904A Multifunction Synthesizer dc to 600 khz

LS9 Short Cuts &Tips. Using Steinberg Cubase 4 or Nuendo 4

Measuring Impedance and Frequency Response of Guitar Pickups

plc numbers Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

Decimal to Binary Conversion

DVPPF02-H2. PROFIBUS DP Slave Communication Module Application Manual

USB-MIDI Setup Guide. Operating requirements

RLC Series Resonance

Different Ways of Connecting to. 3DLevelScanner II. A.P.M Automation Solutions LTD. Version 3.0

Digital Image Fundamentals. Selim Aksoy Department of Computer Engineering Bilkent University

Lab 1: The Digital Oscilloscope

2011, The McGraw-Hill Companies, Inc. Chapter 3

Desktop Headphone amplifier with Advanced DAC

COMPACT DISK STANDARDS & SPECIFICATIONS

Ch 25 Chapter Review Q & A s

Smarthome SELECT Bluetooth Wireless Stereo Audio Receiver and Amplifier INTRODUCTION

MSR605. Programmer s Manual. Magnetic Stripe Card Reader/Writer (High & Low Coercivity) Revision B

EXPERIMENT NUMBER 8 CAPACITOR CURRENT-VOLTAGE RELATIONSHIP

Management Challenge. Managing Hardware Assets. Central Processing Unit. What is a Computer System?

CSI 333 Lecture 1 Number Systems

Lab #9: AC Steady State Analysis

Fundamentals of Signature Analysis

Compression Workshop. notes. The Illities. Richard Harrington. With RICHARD HARRINGTON

DRIVING LOOOONG CABLES

Binary Numbers. Binary Octal Hexadecimal

Hideo Okawara s Mixed Signal Lecture Series. DSP-Based Testing Fundamentals 46 Per-pin Signal Generator

UNIVERSITY OF CALICUT

microgranny 2.0 manual draft

Table 1 below is a complete list of MPTH commands with descriptions. Table 1 : MPTH Commands. Command Name Code Setting Value Description

Transcription:

Disassembling a Windows Wave File (.wav) The aim of this project was to create a nice sine wave as a test signal to trace the function of the electronic circuit of a tube amplifier by oscilloscope: By adding two simple sine waves (red and green) a more complex test sine curve is calculated (violet). The plan was to reach this goal with a computer sound card equipment and a Microsoft wave file, without the need of buying expensive wave form generator hardware equipment. To be able to create my own custom wave file containing a test signal, I had to understand how a windows wave file is built. In this document I disassemble a sine tone wave file and match the findings with a wave file documentation from the web. An excellent documentation for Windows wave files can be found here: https://ccrma.stanford.edu/courses/422/projects/waveformat/ Before reading on, have a look at that documentation first. My document very closely follows the information provided there, my contribution is the disassembly of a file (screenshots) and some more detailed calculation

steps. In the following, a Windows example file is disassembled and analyzed step by step for people less familiar with computer math (like me). The analyzed example file ( a 5.3 second long 1khz 16 bit stereo sine wave, 0 dbfs [ 0 decibel full scale meaning: using maximal possible amplitude at sine wave peak or as loud as technically possible without causing clipping ] ) can be found here: http://www.rme-audio.de/old/download/audtest.htm The editor used to analyze the file is HxD Before starting with this project I wasn t very familiar with the terms little and big endian. A good introduction about endianess is the corresponding wikipedia article. Besides I can recommend to have a look at the very entertaining, initially not quite seriously meant, 1980 first of April rfc article of Danny Cohen that inadvertedly introduced the usage of the terms big / little endian to informatics. It is funny! Please apologize the usage of German (weird language ) Windows Vista (outdated, not very popular OS ) screenshots, this unfortunately is the current setup of my laptop ( ).

Open the example sine wave testone.wav file with a hex editor (for expamle HxD) The first four hex figures designate the file container format used, which was termed RIFF (Resource Interchange File Format) by Microsoft, this field is called ChunkID and it is four bytes long ChunkID: field size of 4 Bytes, the four capital letters RIFF in hexadecimal ASCII form

52 49 46 46 hex numbers representing the string RIFF R I F F corresponding ASCII Code representation The ChunkID is followed by the ChunkSize field, this field indicates the size of the following file in bytes. The field has a size of 4 bytes. It does not includes the size of the two trailing fields ChunkID and ChunkSize, thus the size it indicates is: full file size - ChunkID fieldsize ChunkSize fieldsize which equals: full file size - 4 bytes - 4 bytes = full file size 8 bytes Our example file has a size of 991 284 bytes:

ChunkSize: Contains the size of the following chunk in bytes It is a field of 4 Bytes in hexadecimal little endian form ChunkSize = Filesize 8 Bytes (size of field ChunkID and field ChunkSize) Because of this 4 Bytes limitation in field length, maximal file size of.wav files is limited to 4 GB (4 Bytes = 4 x 8 Bits = 32 Bits, 2 32 = 4 294 967 296) Example: ChunkSize of a file with a size of 991'284 bytes is 991284 bytes 8 bytes = 991276 bytes Dezimal to Hex conversion: 991276 (dec) = F202C (hex) 991 276 decimal representation 00 0F 20 2C big endian hex representation 2C 20 0F 00 little endian representation This fits our example file screenshot:

The format field designates the format of data that follows, in our case this is WAVE, other formats would also be possible in a RIFF file container. Format: field of 4 bytes, the four capital letters WAVE in hexadecimal ASCII form 57 41 56 45 hex numbers (string WAVE ) W A V E ASCII representation The WAVE format requires two format specific subchunks, the describtive fmt subchunk and the data subchunk that contains the actual audio data.

Subchunk1ID: field of 4 bytes, the three lower case letters fmt followed by the space control command in hexadecimal ASCII form 66 6D 74 20 Hex Numbers f m t SPACE ASCII Representation Subchunk1Size: field of 4 Bytes, this is the size of the rest of the Subchunk which follows this number, in case of pulse code modulation PCM, Subchunk1 size is 16 Bytes 16 (dec) = 10 (hex) 4 Bytes big endian hex: 00 00 00 10 4 Bytes little endian hex: 10 00 00 00 10 00 00 00 Hex Numbers (little endian) 00 00 00 10 Hex Numbers (big endian) 16 decimal representation

AudioFormat: little endian field of 2 Bytes, for PCM the value is 1 (i.e. Linear quantization), values other than 1 indicate some form of compression 1 (dec) = 1 (hex) 2 Bytes big endian hex: 00 01 2 Bytes little endian hex: 01 00 01 00 Hex Numbers (little endian) 00 01 Hex Numbers (big endian) 1 decimal representation NumChannels: little endian field of 2 Bytes, designates the number of channels used, Mono = 1, Stereo = 2, etc. 2 (dec) = 2 (hex) 2 Bytes big endian hex: 00 02 2 Bytes little endian hex: 02 00

02 00 Hex Numbers (little endian) 00 02 Hex Numbers (big endian) 2 decimal representation SampleRate: little endian field of 4 Bytes, designates the sample rate used, like 8000, 44100, 48000, etc. 44100 (dec) = AC44 (hex) 4 Bytes big endian hex: 00 00 AC 44 4 Bytes little endian hex: 44 AC 00 00

44 AC 00 00 Hex Numbers (little endian) 00 00 AC 44 Hex Numbers (big endian) 44100 decimal representation ByteRate: little endian field of 4 Bytes, designates the byte rate == SampleRate * NumChannels * BitsPerSample/8 == 44100 * 2 * 16/8 = 176 400 176 400 (dec) = 2B110 (hex) 4 Bytes big endian hex: 00 02 B1 10 4 Bytes little endian hex: 10 B1 02 00 10 B1 02 00 Hex Numbers (little endian) 00 02 B1 10 Hex Numbers (big endian) 176 400 decimal representation

BlockAlign: little endian field of 2 Bytes, designates the The number of bytes for one sample including all channels == NumChannels * BitsPerSample/8 == 2 * 16 / 8 = 4 4 (dec) = 4 (hex) 2 Bytes big endian hex: 00 04 2 Bytes little endian hex: 04 00 04 00 Hex Numbers (little endian) 00 04 Hex Numbers (big endian) 4 decimal representation BitsPerSample: little endian field of 2 Bytes, designates the sampling Resolution, 8 bits = 8, 16 bits = 16, etc. 16 (dec) = 10 (hex) 2 Bytes big endian hex: 00 10 2 Bytes little endian hex: 10 00

10 00 Hex Numbers (little endian) 00 10 Hex Numbers (big endian) 16 decimal representation The data subchunks contains the size information oft he sound information and the raw data Subchunk2ID: field of 4 Bytes, the four lower case letters data in hexadecimal ASCII form (big endian)

64 61 74 61 Hex Numbers (big endian) d a t a ASCII Representation Subchunk2Size: field of 4 Bytes, this is the number of bytes in the data, you can also think of this as the size of the read of the subchunk following this number == NumSamples * NumChannels * BitsPerSample/8 for one second of a 44100 sample rate this is: = 44100 * 2 * 16 / 8 = 176400 176400 (hex) = 2B110 (dec) 4 Bytes big endian hex: 00 02 B1 10 4 Bytes little endian hex: 10 B1 02 00 10 B1 02 00 Hex Numbers (little endian) 00 02 B1 10 Hex Numbers (big endian) 176 400 decimal representation RawData: in case of 16 bit Stereo PCM this is a field of 4 bytes, the field contains one sample for each channel, the first 2 bytes contain the sample for the left channel, the second 2 bytes contain the sample for the right cannel, each byte pair is in little endian notation, in case of 16 bit PCM, 16-bit samples are stored as 2's-complement unsigned integers, ranging from 0 to 65535

DB 9F 25 60 D8 AC 28 53 86 BB Hex Numbers (little endian) 9F DB 60 25 AC D8 53 28 BB 86 Hex Numbers (big endian) 40923 24613 44248 21288 48006 decimal (2's-complement signed integers)