CLAW Columbia Language for Altering Waveforms Shloke Mittal Jeffrey Polanco Vivek Ramdev Bill Wang Contents Chapter 1 4 1 1 Introduction 4 CLAW 4 Columbia Language for Altering Waveforms 4 1 2 Background 4 1 2 1 Introduction to Sound WAVE 4 1 2 2 Introduction to the Java Sound API 5 1 3 Goals of our language 6 1 3 1 Powerful 6 1 3 2 Practical 6 1 3 3 Simple 7 1 3 4 Portable 7 1 3 5 Efficient 7 Chapter 2 8 Tutorial 8 2 1 The Block 8 2 2 The OUT Block 8 2 3 The claw File Structure 9 Chapter 3 11 Reference Manual 11 3 1 Lexical Conventions 11 3 1 1 Whitespace 11 3 1 2 Comments 11 3 1 3 Identifiers 11 3 1 4 Separators 11 3 1 5 Keywords 12 3 1 6 Constants 12 3 2 Description of Reserved Words 13 3 3 Grammar 14 Chapter 4 15 Project Plan 15 4 1 Process 15 4 2 Roles and Responsibilities 15 4 3 Code Style Conventions 15 4 3 1 General Principles 16 4 3 2 Line Spacing 16 4 4 Project Timeline 16 Chapter 5 17 Architecture 17 5 1 Program flow 17 5 1 1 Lexer Parser and Tree Parser 17 5 1 2 Java Backend 19 2 5 2 Wave Format 26 5 2 1 CLAW Modifications to Wave Files 27 Chapter 6 29 Test Plan 29 6 1 ANTLR Testing 29 6 2 Java Testing 30 6 2 1 White Box Examples 31 6 2 2 Regression and Black Box Testing Examples 31 Chapter 7 33 Lessons Learned 33 Chapter 8 34 Appendix Code Listing 34 3 Chapter 1 1 1 Introduction CLAW Columbia Language for Altering Waveforms CLAW is a programming language that allows the user to easily modify wav samples and mix them together to create personalized music tracks CLAW implements a language of simple commands that enables the everyday user to mix together wav files and manipulate them in a variety of ways The user can also add effects such as reverb and fade and then synchronize the samples together and output them as a single wav file Likewise the volume sample rate and balance of a sound file can be altered according to the user s preference CLAW s simple syntax in combination with its implementation in Java makes it a quick and efficient way for novice programmers to turn their electronic beats into masterpieces 1 2 Background 1 2 1 Introduction to Sound WAVE For as long as there has been recorded music there have been ways to combine instruments and songs to create new sounds and compilations of music In the past these methods have been analog The simple four track recorder allowed the music enthusiast to use audio tapes to record sounds on four separate tracks tweak the sound and combine them into one track for the finished product Another way that musicians have combined music is by using a mixer that uses vinyl records This is similar to what you would see a DJ using in a club All of these mixers have similar characteristics They allow someone to take music from separate sources modify them and combine them again to create a new sound These are the goals of CLAW However CLAW uses digital audio files stored on your computer for additional clarity and precision of sound CLAW takes one or multiple audio samples as inputs allows you to modify them and outputs a single wav file that combines it all WAVE has been a standard for digital music for many years It was developed jointly by Microsoft and IBM for use on PCs but has become a widely accepted standard that is available on almost all platforms It can also be played back in all standard web browsers The incorporation of wav files into CLAW means that you can rest assured that the code that you write on one machine will work on another 4 An analog signal and its digital interpretation 1 2 2 Introduction to the Java Sound API The backbone implementation of the CLAW language is that of the Java Sound API which provides the lowest level of sound support on the Java platform The Java Sound API does not include sophisticated sound editors or graphical tools but it provides capabilities upon which such programs as CLAW can be built It emphasizes low level control beyond that commonly expected by the end user The Java Sound API includes support for both digital audio and MIDI data These two major modules of functionality are provided in separate packages javax sound sampled This package specifies interfaces for capture mixing and playback of digital sampled audio javax sound midi This package provides interfaces for MIDI synthesis sequencing and event transport CLAW does not support midi synthesis and thus the only relevant package used is the javax sound sampled The javax sound sampled package is fundamentally concerned with audio transport it focuses on playback and capture The main task that the Java Sound API addresses is how to move bytes of formatted audio data into and out of the system This task involves opening audio input and output devices and managing buffers that get filled with realtime sound data It can also involve mixing multiple streams of audio into one stream 5 To support this focus on basic audio input and output the Java Sound API provides methods for converting between various audio data formats and for reading and writing common types of sound files A file format specifies the structure of a sound file including not only the format of the raw audio data in the file but also other information that can be stored in the file The sound file CLAW deals with is the WAVE WAV as discussed above The different types of sound file have different structures For example they might have a different arrangement of data in the file s header A header contains descriptive information that typically precedes the file s actual audio samples although some file formats allow successive chunks of descriptive and audio data The header includes a specification of the data format that was used for storing the audio in the sound file Any of these types of sound file can contain various data formats although usually there is only one data format within a given file and the same data format can be used in files that have different file formats In the Java Sound API a file format is represented by an AudioFileFormat object which contains The file type WAVE AIFF etc The file s length in bytes The length in frames of the audio data contained in the file An AudioFormat object that specifies the data format of the audio data contained in the file It is this foundation which the CLAW language has in its framework Effective potent and easy to use CLAW is an easy effective way to harness the power of the Java Sound API 1 3 Goals of our language 1 3 1 Powerful Designed to be able to perform most of the functions found on your …
View Full Document
Unlocking...