diff --git a/.classpath b/.classpath
index 65b6f8a..da3f236 100644
--- a/.classpath
+++ b/.classpath
@@ -10,5 +10,7 @@
+
+
diff --git a/res/Encoding.csv b/res/Encoding.csv
index c034b88..61f8acb 100644
--- a/res/Encoding.csv
+++ b/res/Encoding.csv
@@ -6,7 +6,7 @@
4,0x0004,Compaq VSELP (Vector Sum Excited Linear Prediction)
5,0x0005,IBM CVSDM (Continuously Variable Slope Delta Modulation)
6,0x0006,ITU G.711 a-law
-7,0x0007,ITU G.711 u-law
+7,0x0007,ITU G.711 Āµ-law
8,0x0008,Microsoft DTS
9,0x0009,DRM
10,0x000A,WMA 9 Speech
@@ -131,7 +131,7 @@
355,0x0163,Windows Media Audio Lossless V9
356,0x0164,WMA Pro over S/PDIF
357,0x0165,XMA (Xbox Media Audio)
-358,0x0166,XMA2 (Xbox Media Audio V2)
+358,0x0166,XMA2 (Xbox Media Audio 2)
368,0x0170,UNISYS NAP ADPCM
369,0x0171,UNISYS NAP ULAW
370,0x0172,UNISYS NAP ALAW
diff --git a/res/manufacturer.csv b/res/manufacturer.csv
new file mode 100644
index 0000000..9043aad
--- /dev/null
+++ b/res/manufacturer.csv
@@ -0,0 +1,684 @@
+SysEx ID Number,Company Name
+00H,Unspecified
+01H,Sequential Circuits
+02H,IDP
+03H,"Voyetra Turtle Beach, Inc."
+04H,Moog Music
+05H,Passport Designs
+06H,Lexicon Inc.
+07H,Kurzweil / Young Chang
+08H,Fender
+09H,MIDI9
+0AH,AKG Acoustics
+0BH,Voyce Music
+0CH,WaveFrame (Timeline)
+0DH,"ADA Signal Processors, Inc."
+0EH,Garfield Electronics
+0FH,Ensoniq
+10H,Oberheim
+11H,Apple
+12H,Grey Matter Response
+13H,Digidesign Inc.
+14H,Palmtree Instruments
+15H,JLCooper Electronics
+16H,Lowrey Organ Company
+17H,Adams-Smith
+18H,E-mu
+19H,Harmony Systems
+1AH,ART
+1BH,Baldwin
+1CH,Eventide
+1DH,Inventronics
+1EH,Key Concepts
+1FH,Clarity
+20H,Passac
+21H,Proel Labs (SIEL)
+22H,Synthaxe (UK)
+23H,Stepp
+24H,Hohner
+25H,Twister
+26H,Ketron s.r.l.
+27H,Jellinghaus MS
+28H,Southworth Music Systems
+29H,PPG (Germany)
+2AH,CESYG Ltd.
+2BH,Solid State Logic Organ Systems
+2CH,Audio Veritrieb-P. Struven
+2DH,Neve
+2EH,Soundtracs Ltd.
+2FH,Elka
+30H,Dynacord
+31H,Viscount International Spa (Intercontinental Electronics)
+32H,Drawmer
+33H,Clavia Digital Instruments
+34H,Audio Architecture
+35H,Generalmusic Corp SpA
+36H,Cheetah Marketing
+37H,C.T.M.
+38H,Simmons UK
+39H,Soundcraft Electronics
+3AH,Steinberg Media Technologies GmbH
+3BH,Wersi Gmbh
+3CH,AVAB Niethammer AB
+3DH,Digigram
+3EH,Waldorf Electronics GmbH
+3FH,Quasimidi
+40H to 5FH,[Assigned by AMEI for Japanese Manufacturers]
+60H to 7FH,[Reserved for Other Uses]
+00H 00H 01H,Time/Warner Interactive
+00H 00H 02H,Advanced Gravis Comp. Tech Ltd.
+00H 00H 03H,Media Vision
+00H 00H 04H,Dornes Research Group
+00H 00H 05H,K-Muse
+00H 00H 06H,Stypher
+00H 00H 07H,Digital Music Corp.
+00H 00H 08H,IOTA Systems
+00H 00H 09H,New England Digital
+00H 00H 0AH,Artisyn
+00H 00H 0BH,IVL Technologies Ltd.
+00H 00H 0CH,Southern Music Systems
+00H 00H 0DH,Lake Butler Sound Company
+00H 00H 0EH,Alesis Studio Electronics
+00H 00H 0FH,Sound Creation
+00H 00H 01H,Time/Warner Interactive
+00H 00H 10H,DOD Electronics Corp.
+00H 00H 11H,Studer-Editech
+00H 00H 12H,Sonus
+00H 00H 13H,Temporal Acuity Products
+00H 00H 14H,Perfect Fretworks
+00H 00H 15H,KAT Inc.
+00H 00H 16H,Opcode Systems
+00H 00H 17H,Rane Corporation
+00H 00H 18H,Anadi Electronique
+00H 00H 19H,KMX
+00H 00H 1AH,Allen & Heath Brenell
+00H 00H 1BH,Peavey Electronics
+00H 00H 1CH,360 Systems
+00H 00H 1DH,Spectrum Design and Development
+00H 00H 1EH,Marquis Music
+00H 00H 1FH,Zeta Systems
+00H 00H 20H,Axxes (Brian Parsonett)
+00H 00H 21H,Orban
+00H 00H 22H,Indian Valley Mfg.
+00H 00H 23H,Triton
+00H 00H 24H,KTI
+00H 00H 25H,Breakaway Technologies
+00H 00H 26H,Leprecon / CAE Inc.
+00H 00H 27H,Harrison Systems Inc.
+00H 00H 28H,Future Lab/Mark Kuo
+00H 00H 29H,Rocktron Corporation
+00H 00H 2AH,PianoDisc
+00H 00H 2BH,Cannon Research Group
+00H 00H 2CH,Reserved
+00H 00H 2DH,Rodgers Instrument LLC
+00H 00H 2EH,Blue Sky Logic
+00H 00H 2FH,Encore Electronics
+00H 00H 30H,Uptown
+00H 00H 31H,Voce
+00H 00H 32H,"CTI Audio, Inc. (Musically Intel. Devs.)"
+00H 00H 33H,S3 Incorporated
+00H 00H 34H,Broderbund / Red Orb
+00H 00H 35H,Allen Organ Co.
+00H 00H 36H,Reserved
+00H 00H 37H,Music Quest
+00H 00H 38H,Aphex
+00H 00H 39H,Gallien Krueger
+00H 00H 3AH,IBM
+00H 00H 3BH,Mark Of The Unicorn
+00H 00H 3CH,Hotz Corporation
+00H 00H 3DH,ETA Lighting
+00H 00H 3EH,NSI Corporation
+00H 00H 3FH,"Ad Lib, Inc."
+00H 00H 40H,Richmond Sound Design
+00H 00H 41H,Microsoft
+00H 00H 42H,Mindscape (Software Toolworks)
+00H 00H 43H,Russ Jones Marketing / Niche
+00H 00H 44H,Intone
+00H 00H 45H,Advanced Remote Technologies
+00H 00H 46H,White Instruments
+00H 00H 47H,GT Electronics/Groove Tubes
+00H 00H 48H,Pacific Research & Engineering
+00H 00H 49H,"Timeline Vista, Inc."
+00H 00H 4AH,Mesa Boogie Ltd.
+00H 00H 4BH,FSLI
+00H 00H 4CH,Sequoia Development Group
+00H 00H 4DH,Studio Electronics
+00H 00H 4EH,"Euphonix, Inc"
+00H 00H 4FH,"InterMIDI, Inc."
+00H 00H 50H,MIDI Solutions Inc.
+00H 00H 51H,3DO Company
+00H 00H 52H,Lightwave Research / High End Systems
+00H 00H 53H,Micro-W Corporation
+00H 00H 54H,"Spectral Synthesis, Inc."
+00H 00H 55H,Lone Wolf
+00H 00H 56H,Studio Technologies Inc.
+00H 00H 57H,"Peterson Electro-Musical Product, Inc."
+00H 00H 58H,Atari Corporation
+00H 00H 59H,Marion Systems Corporation
+00H 00H 5AH,Design Event
+00H 00H 5BH,Winjammer Software Ltd.
+00H 00H 5CH,AT&T Bell Laboratories
+00H 00H 5DH,Reserved
+00H 00H 5EH,Symetrix
+00H 00H 5FH,MIDI the World
+00H 00H 60H,Spatializer
+00H 00H 61H,Micros eN MIDI
+00H 00H 62H,Accordians International
+00H 00H 63H,EuPhonics (now 3Com)
+00H 00H 64H,Musonix
+00H 00H 65H,Turtle Beach Systems (Voyetra)
+00H 00H 66H,Loud Technologies / Mackie
+00H 00H 67H,Compuserve
+00H 00H 68H,BEC Technologies
+00H 00H 69H,QRS Music Inc
+00H 00H 6AH,P.G. Music
+00H 00H 6BH,Sierra Semiconductor
+00H 00H 6CH,EpiGraf
+00H 00H 6DH,Electronics Diversified Inc
+00H 00H 6EH,Tune 1000
+00H 00H 6FH,Advanced Micro Devices
+00H 00H 70H,Mediamation
+00H 00H 71H,Sabine Musical Mfg. Co. Inc.
+00H 00H 72H,Woog Labs
+00H 00H 73H,Micropolis Corp
+00H 00H 74H,Ta Horng Musical Instrument
+00H 00H 75H,e-Tek Labs (Forte Tech)
+00H 00H 76H,Electro-Voice
+00H 00H 77H,Midisoft Corporation
+00H 00H 78H,QSound Labs
+00H 00H 79H,Westrex
+00H 00H 7AH,Nvidia
+00H 00H 7BH,ESS Technology
+00H 00H 7CH,Media Trix Peripherals
+00H 00H 7DH,Brooktree Corp
+00H 00H 7EH,Otari Corp
+00H 00H 7FH,"Key Electronics, Inc."
+00H 01H 00H,Shure Incorporated
+00H 01H 01H,AuraSound
+00H 01H 02H,Crystal Semiconductor
+00H 01H 03H,Conexant (Rockwell)
+00H 01H 04H,Silicon Graphics
+00H 01H 05H,M-Audio (Midiman)
+00H 01H 06H,PreSonus
+00H 01H 08H,Topaz Enterprises
+00H 01H 09H,Cast Lighting
+00H 01H 0AH,Microsoft Consumer Division
+00H 01H 0BH,Sonic Foundry
+00H 01H 0CH,Line 6 (Fast Forward)?(Yamaha)
+00H 01H 0DH,Beatnik Inc
+00H 01H 0EH,Van Koevering Company
+00H 01H 0FH,Altech Systems
+00H 01H 10H,S & S Research
+00H 01H 11H,VLSI Technology
+00H 01H 12H,Chromatic Research
+00H 01H 13H,Sapphire
+00H 01H 14H,IDRC
+00H 01H 15H,Justonic Tuning
+00H 01H 16H,TorComp Research Inc.
+00H 01H 17H,Newtek Inc.
+00H 01H 18H,Sound Sculpture
+00H 01H 19H,Walker Technical
+00H 01H 1AH,Digital Harmony (PAVO)
+00H 01H 1BH,InVision Interactive
+00H 01H 1CH,T-Square Design
+00H 01H 1DH,Nemesys Music Technology
+00H 01H 1EH,DBX Professional (Harman Intl)
+00H 01H 1FH,Syndyne Corporation
+00H 01H 20H,Bitheadz
+00H 01H 21H,BandLab Technologies
+00H 01H 22H,Analog Devices
+00H 01H 23H,National Semiconductor
+00H 01H 24H,Boom Theory / Adinolfi Alternative Percussion
+00H 01H 25H,Virtual DSP Corporation
+00H 01H 26H,Antares Systems
+00H 01H 27H,Angel Software
+00H 01H 28H,St Louis Music
+00H 01H 29H,Passport Music Software LLC (Gvox)
+00H 01H 2AH,Ashley Audio Inc.
+00H 01H 2BH,Vari-Lite Inc.
+00H 01H 2CH,Summit Audio Inc.
+00H 01H 2DH,Aureal Semiconductor Inc.
+00H 01H 2EH,SeaSound LLC
+00H 01H 2FH,U.S. Robotics
+00H 01H 30H,Aurisis Research
+00H 01H 31H,Nearfield Research
+00H 01H 32H,FM7 Inc
+00H 01H 33H,Swivel Systems
+00H 01H 34H,Hyperactive Audio Systems
+00H 01H 35H,MidiLite (Castle Studios Productions)
+00H 01H 36H,Radikal Technologies
+00H 01H 37H,Roger Linn Design
+00H 01H 38H,TC-Helicon Vocal Technologies
+00H 01H 39H,Event Electronics
+00H 01H 3AH,Sonic Network Inc
+00H 01H 3BH,Realtime Music Solutions
+00H 01H 3CH,Apogee Digital
+00H 01H 3DH,"Classical Organs, Inc."
+00H 01H 3EH,Microtools Inc.
+00H 01H 3FH,Numark Industries
+00H 01H 40H,"Frontier Design Group, LLC"
+00H 01H 41H,Recordare LLC
+00H 01H 42H,Starr Labs
+00H 01H 43H,Voyager Sound Inc.
+00H 01H 44H,Manifold Labs
+00H 01H 45H,Aviom Inc.
+00H 01H 46H,Mixmeister Technology
+00H 01H 47H,Notation Software
+00H 01H 48H,Mercurial Communications
+00H 01H 49H,Wave Arts
+00H 01H 4AH,Logic Sequencing Devices
+00H 01H 4BH,Axess Electronics
+00H 01H 4CH,Muse Research
+00H 01H 4DH,Open Labs
+00H 01H 4EH,Guillemot Corp
+00H 01H 4FH,Samson Technologies
+00H 01H 50H,Electronic Theatre Controls
+00H 01H 51H,Blackberry (RIM)
+00H 01H 52H,Mobileer
+00H 01H 53H,Synthogy
+00H 01H 54H,Lynx Studio Technology Inc.
+00H 01H 55H,Damage Control Engineering LLC
+00H 01H 56H,"Yost Engineering, Inc."
+00H 01H 57H,Brooks & Forsman Designs LLC / DrumLite
+00H 01H 58H,Infinite Response
+00H 01H 59H,Garritan Corp
+00H 01H 5AH,"Plogue Art et Technologie, Inc"
+00H 01H 5BH,RJM Music Technology
+00H 01H 5CH,Custom Solutions Software
+00H 01H 5DH,Sonarcana LLC / Highly Liquid
+00H 01H 5EH,Centrance
+00H 01H 5FH,Kesumo LLC
+00H 01H 60H,Stanton (Gibson Brands)
+00H 01H 61H,Livid Instruments
+00H 01H 62H,First Act / 745 Media
+00H 01H 63H,"Pygraphics, Inc."
+00H 01H 64H,Panadigm Innovations Ltd
+00H 01H 65H,Avedis Zildjian Co
+00H 01H 66H,Auvital Music Corp
+00H 01H 67H,You Rock Guitar (was: Inspired Instruments)
+00H 01H 68H,Chris Grigg Designs
+00H 01H 69H,Slate Digital LLC
+00H 01H 6AH,Mixware
+00H 01H 6BH,Social Entropy
+00H 01H 6CH,Source Audio LLC
+00H 01H 6DH,Ernie Ball / Music Man
+00H 01H 6EH,Fishman
+00H 01H 6FH,Custom Audio Electronics
+00H 01H 70H,American Audio/DJ
+00H 01H 71H,Mega Control Systems
+00H 01H 72H,Kilpatrick Audio
+00H 01H 73H,iConnectivity
+00H 01H 74H,Fractal Audio
+00H 01H 75H,NetLogic Microsystems
+00H 01H 76H,Music Computing
+00H 01H 77H,Nektar Technology Inc
+00H 01H 78H,Zenph Sound Innovations
+00H 01H 79H,DJTechTools.com
+00H 01H 7AH,Rezonance Labs
+00H 01H 7BH,Decibel Eleven
+00H 01H 7CH,CNMAT
+00H 01H 7DH,Media Overkill
+00H 01H 7EH,Confusion Studios
+00H 01H 7FH,moForte Inc
+00H 02H 00H,Miselu Inc
+00H 02H 01H,Ameliafs Compass LLC
+00H 02H 02H,Zivix LLC
+00H 02H 03H,Artiphon
+00H 02H 04H,Synclavier Digital
+00H 02H 05H,Light & Sound Control Devices LLC
+00H 02H 06H,Retronyms Inc
+00H 02H 07H,JS Technologies
+00H 02H 08H,Quicco Sound
+00H 02H 09H,A-Designs Audio
+00H 02H 0AH,McCarthy Music Corp
+00H 02H 0BH,Denon DJ
+00H 02H 0CH,Keith Robert Murray
+00H 02H 0DH,Google
+00H 02H 0EH,ISP Technologies
+00H 02H 0FH,Abstrakt Instruments LLC
+00H 02H 10H,Meris LLC
+00H 02H 11H,Sensorpoint LLC
+00H 02H 12H,Hi-Z Labs
+00H 02H 13H,Imitone
+00H 02H 14H,Intellijel Designs Inc.
+00H 02H 15H,Dasz Instruments Inc.
+00H 02H 16H,Remidi
+00H 02H 17H,Disaster Area Designs LLC
+00H 02H 18H,Universal Audio
+00H 02H 19H,Carter Duncan Corp
+00H 02H 1AH,Essential Technology
+00H 02H 1BH,Cantux Research LLC
+00H 02H 1CH,Hummel Technologies
+00H 02H 1DH,Sensel Inc
+00H 02H 1EH,DBML Group
+00H 02H 1FH,Madrona Labs
+00H 02H 20H,Mesa Boogie
+00H 02H 21H,Effigy Labs
+00H 02H 22H,Amenote
+00H 02H 23H,Red Panda LLC
+00H 02H 24H,OnSong LLC
+00H 02H 25H,Jamboxx Inc.
+00H 02H 26H,Electro-Harmonix?
+00H 02H 27H,RnD64 Inc
+00H 02H 28H?,Neunaber Technology LLC?
+00H 02H 29H,Kaom Inc.
+00H 02H 2AH,Hallowell EMC
+00H 02H 2BH,"Sound Devices, LLC"
+00H 02H 2CH,"Spectrasonics, Inc"
+00H 02H 2DH,"Second Sound, LLC"
+00H 02H 2EH,8eo (Horn)
+00H 02H 2FH,VIDVOX LLC
+00H 02H 30H,Matthews Effects
+00H 02H 31H,Bright Blue Beetle
+00H 02H 32H,Audio Impressions
+00H 02H 33H,?Looperlative
+00H 02H 34H?,Steinway
+00H 02H 35H,Ingenious Arts and Technologies LLC
+00H 02H 36H,DCA Audio
+00H 02H 37H,Buchla USA
+00H 02H 38H,Sinicon
+00H 02H 39H,Isla Instruments
+00H 02H 3AH,Soundiron LLC
+00H 02H 3BH,"Sonoclast, LLC"
+00H 02H 3CH,Copper and Cedar
+00H 02H 3DH,Whirled Notes
+00H 02H 3EH,"Cejetvole, LLC"
+00H 02H 3FH,DAWn Audio LLC
+00H 02H 40H,Space Brain Circuits
+00H 02H 41H,Caedence?
+00H 02H 42H,"HCN Designs, LLC (The MIDI Maker)"
+00H 02H 43H,PTZOptics
+00H 02H 44H,Noise Engineering
+00H 02H 45H,Synthesia LLC
+00H 02H 46H,Jeff Whitehead Lutherie LLC
+00H 02H 47H,Wampler Pedals Inc.
+00H 02H 48H,Tapis Magique
+00H 02H 49H,Leaf Secrets
+00H 02H 4AH,Groove Synthesis
+00H 02H 4BH,Audiocipher Technologies LLC
+00H 02H 4CH,Mellotron Inc.
+00H 02H 4DH,Hologram Electronics LLC
+00H 02H 4EH,"iCON Americas, LLC"
+00H 02H 4FH,Singular Sound
+00H 02H 50H,Genovation Inc
+00H 02H 51H,Method Red
+00H 02H 52H,Brain Inventions
+00H 02H 53H,Synervoz Communications Inc.
+00H 02H 54H,Hypertriangle Inc
+00H 20H 00H,Dream SAS
+00H 20H 01H,Strand Lighting
+00H 20H 02H,Amek Div of Harman Industries
+00H 20H 03H,Casa Di Risparmio Di Loreto
+00H 20H 04H,B?hm electronic GmbH
+00H 20H 05H,Syntec Digital Audio
+00H 20H 06H,Trident Audio Developments
+00H 20H 07H,Real World Studio
+00H 20H 08H,"Evolution Synthesis, Ltd"
+00H 20H 09H,Yes Technology
+00H 20H 0AH,Audiomatica
+00H 20H 0BH,Bontempi SpA (Sigma)
+00H 20H 0CH,F.B.T. Elettronica SpA
+00H 20H 0DH,MidiTemp GmbH
+00H 20H 0EH,LA Audio (Larking Audio)
+00H 20H 0FH,Zero 88 Lighting Limited
+00H 20H 10H,Micon Audio Electronics GmbH
+00H 20H 11H,Forefront Technology
+00H 20H 12H,Studio Audio and Video Ltd.
+00H 20H 13H,Kenton Electronics
+00H 20H 14H,Celco/ Electrosonic
+00H 20H 15H,ADB
+00H 20H 16H,Marshall Products Limited
+00H 20H 17H,DDA
+00H 20H 18H,BSS Audio Ltd.
+00H 20H 19H,MA Lighting Technology
+00H 20H 1AH,Fatar SRL c/o Music Industries
+00H 20H 1BH,QSC Audio Products Inc.
+00H 20H 1CH,Artisan Clasic Organ Inc.
+00H 20H 1DH,Orla Spa
+00H 20H 1EH,Pinnacle Audio (Klark Teknik PLC)
+00H 20H 1FH,TC Electronics
+00H 20H 20H,Doepfer Musikelektronik GmbH
+00H 20H 21H,Creative ATC / E-mu
+00H 20H 22H,Seyddo/Minami
+00H 20H 23H,LG Electronics (Goldstar)
+00H 20H 24H,Midisoft sas di M.Cima & C
+00H 20H 25H,Samick Musical Inst. Co. Ltd.
+00H 20H 26H,Penny and Giles (Bowthorpe PLC)
+00H 20H 27H,Acorn Computer
+00H 20H 28H,LSC Electronics Pty. Ltd.
+00H 20H 29H,Focusrite/Novation
+00H 20H 2AH,Samkyung Mechatronics
+00H 20H 2BH,Medeli Electronics Co.
+00H 20H 2CH,Charlie Lab SRL
+00H 20H 2DH,Blue Chip Music Technology
+00H 20H 2EH,BEE OH Corp
+00H 20H 2FH,LG Semicon America
+00H 20H 30H,TESI
+00H 20H 31H,EMAGIC
+00H 20H 32H,Behringer GmbH
+00H 20H 33H,Access Music Electronics
+00H 20H 34H,Synoptic
+00H 20H 35H,Hanmesoft
+00H 20H 36H,Terratec Electronic GmbH
+00H 20H 37H,Proel SpA
+00H 20H 38H,IBK MIDI
+00H 20H 39H,IRCAM
+00H 20H 3AH,Propellerhead Software
+00H 20H 3BH,Red Sound Systems Ltd
+00H 20H 3CH,Elektron ESI AB
+00H 20H 3DH,Sintefex Audio
+00H 20H 3EH,MAM (Music and More)
+00H 20H 3FH,Amsaro GmbH
+00H 20H 40H,CDS Advanced Technology BV (Lanbox)
+00H 20H 41H,Mode Machines (Touched By Sound GmbH)
+00H 20H 42H,DSP Arts
+00H 20H 43H,Phil Rees Music Tech
+00H 20H 44H,Stamer Musikanlagen GmbH
+00H 20H 45H,Musical Muntaner S.A. dba Soundart
+00H 20H 46H,C-Mexx Software
+00H 20H 47H,Klavis Technologies
+00H 20H 48H,Noteheads AB
+00H 20H 49H,Algorithmix
+00H 20H 4AH,Skrydstrup R&D
+00H 20H 4BH,Professional Audio Company
+00H 20H 4CH,NewWave Labs (MadWaves)
+00H 20H 4DH,Vermona
+00H 20H 4EH,Nokia
+00H 20H 4FH,Wave Idea
+00H 20H 50H,Hartmann GmbH
+00H 20H 51H,Lionfs Tracs
+00H 20H 52H,Analogue Systems
+00H 20H 53H,Focal-JMlab
+00H 20H 54H,Ringway Electronics (Chang-Zhou) Co Ltd
+00H 20H 55H,Faith Technologies (Digiplug)
+00H 20H 56H,Showworks
+00H 20H 57H,Manikin Electronic
+00H 20H 58H,1 Come Tech
+00H 20H 59H,Phonic Corp
+00H 20H 5AH,Dolby Australia (Lake)
+00H 20H 5BH,Silansys Technologies
+00H 20H 5CH,Winbond Electronics
+00H 20H 5DH,Cinetix Medien und Interface GmbH
+00H 20H 5EH,A&G Soluzioni Digitali
+00H 20H 5FH,Sequentix GmbH
+00H 20H 60H,Oram Pro Audio
+00H 20H 61H,Be4 Ltd
+00H 20H 62H,Infection Music
+00H 20H 63H,Central Music Co. (CME)
+00H 20H 64H,genoQs Machines GmbH
+00H 20H 65H,Medialon
+00H 20H 66H,Waves Audio Ltd
+00H 20H 67H,Jerash Labs
+00H 20H 68H,Da Fact
+00H 20H 69H,Elby Designs
+00H 20H 6AH,Spectral Audio
+00H 20H 6BH,Arturia
+00H 20H 6CH,Vixid
+00H 20H 6DH,C-Thru Music
+00H 20H 6EH,Ya Horng Electronic Co LTD
+00H 20H 6FH,SM Pro Audio
+00H 20H 70H,OTO Machines
+00H 20H 71H,ELZAB S.A. (G LAB)
+00H 20H 72H,Blackstar Amplification Ltd
+00H 20H 73H,M3i Technologies GmbH
+00H 20H 74H,Gemalto (from Xiring)
+00H 20H 75H,Prostage SL
+00H 20H 76H,Teenage Engineering
+00H 20H 77H,Tobias Erichsen Consulting
+00H 20H 78H,Nixer Ltd
+00H 20H 79H,Hanpin Electron Co Ltd
+00H 20H 7AH,gMIDI-hardwareh R.Sowa
+00H 20H 7BH,Beyond Music Industrial Ltd
+00H 20H 7CH,Kiss Box B.V.
+00H 20H 7DH,Misa Digital Technologies Ltd
+00H 20H 7EH,AI Musics Technology Inc
+00H 20H 7FH,Serato Inc LP
+00H 21H 00H,Limex
+00H 21H 01H,Kyodday (Tokai)
+00H 21H 02H,Mutable Instruments
+00H 21H 03H,PreSonus Software Ltd
+00H 21H 04H,Ingenico (was Xiring)
+00H 21H 05H,Fairlight Instruments Pty Ltd
+00H 21H 06H,Musicom Lab
+00H 21H 07H,Modal Electronics (Modulus/VacoLoco)
+00H 21H 08H,RWA (Hong Kong) Limited
+00H 21H 09H,Native Instruments
+00H 21H 0AH,Naonext
+00H 21H 0BH,MFB
+00H 21H 0CH,Teknel Research
+00H 21H 0DH,Ploytec GmbH
+00H 21H 0EH,Surfin Kangaroo Studio
+00H 21H 0FH,Philips Electronics HK Ltd
+00H 21H 10H,ROLI Ltd
+00H 21H 11H,Panda-Audio Ltd
+00H 21H 12H,BauM Software
+00H 21H 13H,Machinewerks Ltd.
+00H 21H 14H,Xiamen Elane Electronics
+00H 21H 15H,Marshall Amplification PLC
+00H 21H 16H,Kiwitechnics Ltd
+00H 21H 17H,Rob Papen
+00H 21H 18H,Spicetone OU
+00H 21H 19H,V3Sound
+00H 21H 1AH,IK Multimedia
+00H 21H 1BH,Novalia Ltd
+00H 21H 1CH,Modor Music
+00H 21H 1DH,Ableton
+00H 21H 1EH,Dtronics
+00H 21H 1FH,ZAQ Audio
+00H 21H 20H,Muabaobao Education Technology Co Ltd
+00H 21H 21H,Flux Effects
+00H 21H 22H,Audiothingies (MCDA)
+00H 21H 23H,Retrokits
+00H 21H 24H,Morningstar FX Pte Ltd
+00H 21H 25H,Changsha Hotone Audio Co Ltd
+00H 21H 26H,Expressive E
+00H 21H 27H,Expert Sleepers Ltd
+00H 21H 28H,Timecode-Vision Technology
+00H 21H 29H,Hornberg Research GbR
+00H 21H 2AH,Sonic Potions
+00H 21H 2BH,Audiofront
+00H 21H 2CH,Fredfs Lab
+00H 21H 2DH,Audio Modeling
+00H 21H 2EH,C. Bechstein Digital GmbH
+00H 21H 2FH,Motas Electronics Ltd
+00H 21H 30H,Elk Audio
+00H 21H 31H,Sonic Academy Ltd
+00H 21H 32H,Bome Software
+00H 21H 33H,AODYO SAS
+00H 21H 34H,Pianoforce S.R.O
+00H 21H 35H,Dreadbox P.C.
+00H 21H 36H,TouchKeys Instruments Ltd
+00H 21H 37H,The Gigrig Ltd
+00H 21H 38H,ALM Co
+00H 21H 39H,CH Sound Design
+00H 21H 3AH,Beat Bars
+00H 21H 3BH,Blokas
+00H 21H 3CH,GEWA Music GmbH
+00H 21H 3DH,dadamachines
+00H 21H 3EH,Augmented Instruments Ltd (Bela)
+00H 21H 3FH,Supercritical Ltd
+00H 21H 40H,Genki Instruments
+00H 21H 41H,Marienberg Devices Germany
+00H 21H 42H,Supperware Ltd
+00H 21H 43H,Imoxplus BVBA?
+00H 21H 44H,Swapp Technologies SRL
+00H 21H 45H,Electra One S.R.O.
+00H 21H 46H,Digital Clef Limited
+00H 21H 47H,Paul Whittington Group Ltd
+00H 21H 48H,Music Hackspace
+00H 21H 49H,Bitwig GMBH
+00H 21H 4AH,Enhancia
+00H 21H 4BH,KV 331
+00H 21H 4CH,Tehnicadelarte
+00H 21H 4DH,Endlesss Studio
+00H 21H 4EH,"Dongguan MIDIPLUS Co., LTD"
+00H 21H 4FH,Gracely Pty Ltd.
+00H 21H 50H,Embodme
+00H 21H 51H,MuseScore
+00H 21H 52H,EPFL (E-Lab)
+00H 21H 53H?,Orb3 Ltd.
+00H 21H 54H,Pitch Innovations
+00H 21H 55H,Playces?
+00H 21H 56H,UDO Audio LTD
+00H 21H 57H,RSS Sound Design
+00H 21H 58H,Nonlinear Labs GmbH
+00H 21H 59H,"Robkoo Information & Technologies Co., Ltd."
+00H 21H 5AH,Cari Electronic
+00H 21H 5BH,Oxi Electronic Instruments SL
+00H 21H 5CH,XMPT
+00H 21H 5DH,SHANGHAI HUAXIN MUSICAL INSTRUMENT?
+00H 21H 5EH,"Shenzhen Huashi Technology Co., Ltd"
+00H 21H 60H,"Guangzhou Rantion Technology Co., Ltd.?"
+00H 21H 61H,Ryme Music
+00H 21H 62H,GS Music
+00H 21H 63H,"Shenzhen Flamma Innovation Co., Ltd"
+?00H 21H 64H,"Shenzhen Mooer Audio Co.,LTD.?"
+?00H 21H 65H,Raw Material Software Limited (JUCE)
+?00H 21H 66H,Birdkids
+?00H 21H 67H,Beijing QianYinHuLian Tech. Co
+?00H 21H 68H,Nimikry Music OG
+00H 21H 69H,Newzik
+00H 21H 6AH,Hamburg Wave
+00H 21H 6BH,Grimm Audio
+00H 21H 6CH,Arcana Instruments LTD.
+00H 21H 6DH,GameChanger Audio
+00H 21H 6EH,OakTone
+00H 21H 6FH,The Digi-Gurdy: A MIDI Hurdy Gurdy
+00H 21H 70H,MusiKraken
+00H 21H 71H,PhotoSynth > InterFACE
+00H 21H 72H,Instruments of Things
+00H 21H 73H,oodi
+00H 21H 74H,Komires Sp. z o.o.
+00H 21H 75H,Lehle GmbH
+00H 21H 76H,Jou? Music Instruments
+00H 21H 77H,Guangzhou Pearl River Amason Digital Musical Instrument Co. Ltd
+00H 21H 78H,Rhesus Engineering GmbH
+40H,Kawai Musical Instruments MFG. CO. Ltd
+41H,Roland Corporation
+42H,Korg Inc.
+43H,Yamaha Corporation
+44H,Casio Computer Co. Ltd
+46H,Kamiya Studio Co. Ltd
+47H,Akai Electric Co. Ltd.
+48H,"Victor Company of Japan, Ltd."
+4BH,Fujitsu Limited
+4CH,Sony Corporation
+4EH,Teac Corporation
+50H,"Matsushita Electric Industrial Co. , Ltd"
+51H,Fostex Corporation
+52H,Zoom Corporation
+54H,"Matsushita Communication Industrial Co., Ltd."
+55H,"Suzuki Musical Instruments MFG. Co., Ltd."
+56H,Fuji Sound Corporation Ltd.
+57H,"Acoustic Technical Laboratory, Inc."
+59H,"Faith, Inc."
+5AH,Internet Corporation
+5CH,Seekers Co. Ltd.
+5FH,SD Card Association
+00H 40H 00H,Crimson Technology Inc.
+00H 40H 01H,Softbank Mobile Corp
+00H 40H 03H,D&M Holdings Inc.
+00H 40H 04H,Xing Inc.
+00H 40H 05H,AlphaTheta Corporation
+00H 40H 06H,Pioneer?Corporation
+00H 40H 07H,Slik?Corporation
diff --git a/src/goblincave/gitea/nes/AudioExtractor.java b/src/goblincave/gitea/nes/AudioExtractor.java
index f8a6d2d..ef9361a 100644
--- a/src/goblincave/gitea/nes/AudioExtractor.java
+++ b/src/goblincave/gitea/nes/AudioExtractor.java
@@ -7,16 +7,19 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
+import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.RandomAccessFile;
+import java.io.Reader;
import java.net.URISyntaxException;
import java.nio.file.Files;
-import java.nio.file.Path;
import java.util.LinkedHashMap;
import java.util.Set;
import javaFlacEncoder.FLAC_FileEncoder;
+import org.apache.commons.csv.CSVFormat;
+import org.apache.commons.csv.CSVRecord;
import org.apache.commons.io.FilenameUtils;
import com.diogonunes.jcolor.Ansi;
@@ -33,7 +36,7 @@ public class AudioExtractor {
* Activate alternate behavior for command line terminal.
* Specifically prints things in a narrower width, and overwrites previous lines to add color.
*/
- private final static boolean CMD_MODE = false;
+ private final static boolean CMD_MODE = true;
/**
* ANSI code to go up one line, followed by a carriage return.
@@ -81,6 +84,11 @@ public class AudioExtractor {
* Indicates the start of an XMA stream chunk in WAV files.
*/
private final static int ASCII_x2st = 0x7832_7374;
+ /**
+ * Hex value for the ASCII sequence "seek".
+ * Indicates the start of an XMA stream chunk in WAV files.
+ */
+ private final static int ASCII_seek = 0x7365_656B;
/**
* Hex value for the ASCII sequence "fLaC".
* Indicates the start of an FLAC file.
@@ -137,53 +145,60 @@ public class AudioExtractor {
System.out.println("Program:\tRidge Racer 6 Audio Extractor " + Ansi.colorize("v1.0", Attribute.BRIGHT_GREEN_TEXT()) + " by "
+ Ansi.colorize("Nes", Attribute.TEXT_COLOR(252, 42, 124)));
System.out.println("Repository:\t" + Ansi.colorize("https://gitea.goblincave.synology.me/Nes/RR6AudioExtractor", Attribute.CYAN_TEXT()));
+ System.out.println();
// Initialize user input reader
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- // determine which operation to execute
- String operationInput = null;
- if(args.length > 0)
- operationInput = args[0];
- String operation = retrieveOperation(reader, operationInput);
+ while(true) {
- if(args.length == 0) { // no arguments provided
-
- switch(operation) {
- case "identify":
- File unknownFile = retrieveFile(reader, "Please enter the path of a file: " + ANSI_BEIGE);
- identify(unknownFile);
- break;
- case "extract": // extract
- // Determine package directory
- File currentDir = new File(new File(AudioExtractor.class.getProtectionDomain().getCodeSource().getLocation().toURI())
- .getParent());
- boolean packDirFound = false;
- do {
- System.out.println(Ansi.colorize("\nPackage Directory:", Attribute.BOLD(), Attribute.CYAN_TEXT()));
- System.out.println("- " + Ansi.colorize("Current", Attribute.BRIGHT_RED_TEXT()) + " directory:\t"
- + Ansi.colorize(currentDir.getPath(), Attribute.BRIGHT_CYAN_TEXT()));
-
- } while(!packDirFound);
- break;
- case "package": // pack
- break;
- case "patch": // patch
- File waveFile = retrieveWave(reader);
- patch(waveFile);
- break;
- case "print": // print
- Attribute color = retrieveColor(reader);
- String message = retrieveInput(reader, "Please enter your logo message: " + ANSI_BEIGE);
- System.out.println(Ansi.colorize(logoFormat(message), color));
- break;
- case "exit": // exit
- System.out.println("Program closed.");
- System.exit(0);
- break;
+ // determine which operation to execute
+ String operationInput = null;
+ if(args.length > 0)
+ operationInput = args[0];
+ String operation = retrieveOperation(reader, operationInput);
+
+ if(args.length == 0) { // no arguments provided
+
+ switch(operation) {
+ case "identify":
+ File unknownFile = retrieveFile(reader, "Please enter the path of a file: " + ANSI_BEIGE);
+ identify(unknownFile);
+ break;
+ case "extract": // extract
+ // Determine package directory
+ File currentDir = new File(new File(AudioExtractor.class.getProtectionDomain().getCodeSource().getLocation().toURI())
+ .getParent());
+ boolean packDirFound = false;
+ do {
+ System.out.println(Ansi.colorize("\nPackage Directory:", Attribute.BOLD(), Attribute.CYAN_TEXT()));
+ System.out.println("- " + Ansi.colorize("Current", Attribute.BRIGHT_RED_TEXT()) + " directory:\t"
+ + Ansi.colorize(currentDir.getPath(), Attribute.BRIGHT_CYAN_TEXT()));
+
+ } while(!packDirFound);
+ break;
+ case "package": // pack
+ break;
+ case "patch": // patch
+ File waveFile = retrieveWave(reader);
+ patch(waveFile);
+ break;
+ case "print": // print
+ Attribute color = retrieveColor(reader);
+ String message = retrieveInput(reader, "Please enter your logo message: " + ANSI_BEIGE);
+ System.out.println(Ansi.colorize(logoFormat(message), color));
+ break;
+ case "exit": // exit
+ System.out.println("Program closed.");
+ System.exit(0);
+ break;
+ }
+
}
-
+
}
+
+/*
System.exit(0);
if(args.length > 0) {
@@ -260,6 +275,7 @@ public class AudioExtractor {
if(packMode)
pack(packDirectory, extractDirectory);
else extract(packDirectory, extractDirectory, compressBGM);
+*/
}
@@ -284,7 +300,7 @@ public class AudioExtractor {
if(operation == null) {
- String prompt = "\n" + Ansi.colorize("Operations", Attribute.BRIGHT_YELLOW_TEXT(), Attribute.BOLD()) + ":\n"
+ String prompt = Ansi.colorize("Operations", Attribute.BRIGHT_YELLOW_TEXT(), Attribute.BOLD()) + ":\n"
+ "- " + Ansi.colorize("Identify", Attribute.BRIGHT_RED_TEXT()) + " a package or audio file\n"
+ "- " + Ansi.colorize("Extract", Attribute.TEXT_COLOR(0xFF, 0x68, 0x1F)) + " audio tracks from a package (BIN -> WAV/XMA)\n"
+ "- " + Ansi.colorize("Convert", Attribute.TEXT_COLOR(0xFF, 0xEA, 0x00)) + " audio tracks to another format (XMA <-> WAV <-> FLAC)\n"
@@ -374,21 +390,25 @@ public class AudioExtractor {
break;
}
case ASCII_fmt: {
- readFormatChunk(file, (int) i);
+ i = readFormatChunk(file, (int) i) - 4;
break;
}
case ASCII_smpl: {
- readSampleChunk(file, (int) i);
+ i = readSampleChunk(file, (int) i) - 4;
break;
}
case ASCII_data: {
- readDataChunk(file, (int) i);
+ i = readDataChunk(file, (int) i) - 4;
break;
}
case ASCII_ALIG: {
readAlignmentChunk(file, (int) i);
break;
}
+ case ASCII_seek: {
+ readx2stChunk(file, (int) i);
+ break;
+ }
case ASCII_x2st: {
readx2stChunk(file, (int) i);
break;
@@ -406,19 +426,26 @@ public class AudioExtractor {
}
+ /**
+ * Helper function to read RIFF header information.
+ *
+ * @param file
+ * @param offset
+ * @throws IOException
+ */
public static void readRIFFChunk(RandomAccessFile file, int offset) throws IOException {
- System.out.println(formatAddress(offset) + ":\tRIFF (Resource Interchange File Format) chunk");
+ System.out.println(formatAddress(offset, file.length()) + ":\tRIFF (Resource Interchange File Format) file");
if(offset + 8 < file.length()) {
int riffSize = readChunkSize(file, offset);
- System.out.println(formatAddress(offset + 4) + ":\t" + riffSize + " Bytes" + (riffSize > 1024 ? " (" + convertBytes(riffSize) + ")" : ""));
+ System.out.println(formatAddress(offset + 4, file.length()) + ":\t" + riffSize + " Bytes" + (riffSize > 1024 ? " (" + convertBytes(riffSize) + ")" : ""));
}
if(offset + 12 < file.length()) {
file.seek(offset + 8);
if(file.readInt() == ASCII_WAVE)
- System.out.println(formatAddress(offset + 8) + ":\tWAVE (Waveform Audio File Format) type");
+ System.out.println(formatAddress(offset + 8, file.length()) + ":\tWAVE (Waveform Audio File Format) type");
offset += 8;
}
@@ -426,22 +453,32 @@ public class AudioExtractor {
}
- public static void readFormatChunk(RandomAccessFile file, int offset) throws IOException {
+
+ /**
+ * Helper method to read format chunk information.
+ *
+ * @param file
+ * @param offset from start of file to start of format chunk
+ * @return offset from start of file to end of format chunk
+ * @throws IOException
+ */
+ public static int readFormatChunk(RandomAccessFile file, int offset) throws IOException {
- System.out.println(formatAddress(offset) + ":\tfmt (Format) chunk");
+ System.out.println(formatAddress(offset, file.length()) + ":\tfmt (Format) chunk");
- int fmtSize = 8;
+ int size = 8;
if(offset + 8 < file.length()) {
- fmtSize = readChunkSize(file, (int) offset);
- System.out.println(formatAddress(offset + 4) + ":\t" + fmtSize + " Bytes" + (fmtSize > 1024 ? " (" + convertBytes(fmtSize) + ")" : ""));
+ size = readChunkSize(file, (int) offset);
+ System.out.println(formatAddress(offset + 0x04, file.length()) + ":\t" + size + " Bytes" + (size > 1024 ? " (" + convertBytes(size) + ")" : ""));
}
- if(offset + fmtSize < file.length()) {
- file.seek(offset + 8);
+ if(offset + size < file.length()) {
+
byte[] LEBytes = new byte[2];
+ file.seek(offset + 0x08);
file.read(LEBytes);
int encoding = littleEndianToInt(LEBytes);
- System.out.print(formatAddress(offset + 8) + "\t");
+ System.out.print(formatAddress(offset + 0x08, file.length()) + ":\t");
if(encoding == 0x0001)
System.out.print("PCM (Pulse-Code Modulation)");
else if(encoding == 0x0002)
@@ -450,37 +487,258 @@ public class AudioExtractor {
System.out.print("XMA (Xbox Media Audio)");
else if(encoding == 0x0166)
System.out.print("XMA2 (Xbox Media Audio 2)");
- else System.out.print("Unknown");
- // TODO lookup values from CSV
+ else {
+ boolean found = false;
+ InputStream filestream = AudioExtractor.class.getResourceAsStream("/encoding.csv");
+ InputStreamReader streamReader = new InputStreamReader(filestream);
+ Reader in = streamReader;
+ String[] headers = { "Decimal value", "Hexadecimal value", "Description" };
+ Iterable records = CSVFormat.EXCEL.builder().setHeader(headers).setSkipHeaderRecord(true).build().parse(in);
+ for (CSVRecord record : records) {
+ String dec = record.get("Decimal value");
+ String desc = record.get("Description");
+ if(encoding == Integer.parseInt(dec)) {
+ System.out.print(desc);
+ found = true;
+ break;
+ }
+ }
+ if(!found)
+ System.out.print("Unknown (" + encoding + ")");
+ }
System.out.println(" encoding");
+
+ if(encoding == 0x0165) {
+ LEBytes = new byte[2];
+ file.seek(offset + 0x10);
+ file.read(LEBytes);
+ int streams = littleEndianToInt(LEBytes);
+ System.out.println(formatAddress(offset + 0x10, file.length()) + ":\t" + streams + (streams == 1 ? " stream" : " streams"));
+ parseField(file, offset + 0x12, 1, " loop flag");
+ // unknown 5 bytes ?
+ parseField(file, offset + 0x18, 4, " Hz sampling rate");
+ parseField(file, offset + 0x1C, 4, " loop start");
+ parseField(file, offset + 0x20, 4, " loop end");
+ parseField(file, offset + 0x24, 1, " loop subframe");
+ // unknown 3 bytes ?
- offset += fmtSize;
+// int channels = 0;
+// for(int i = 0; i < streams; i++)
+// channels += parseField(file, offset + 0x08 + 0x0C + 0x14 * i + 0x11, 1, " channel");
+// System.out.println(channels + " channels");
+ } else {
+ parseField(file, offset + 0x0A, 2, " channels");
+ parseField(file, offset + 0x0C, 4, " Hz sampling rate");
+ parseField(file, offset + 0x10, 4, " average bytes per second");
+ parseField(file, offset + 0x14, 2, "-byte sample block size");
+ parseField(file, offset + 0x16, 2, " significant bits per sample");
+ LEBytes = new byte[2];
+ file.seek(offset + 0x18);
+ file.read(LEBytes);
+ int extra = littleEndianToInt(LEBytes);
+ if(extra != ASCII_smpl)
+ parseField(file, offset + 0x18, 2, " extra format bytes");
+ }
+
}
System.out.println();
+ return offset + size;
+
+ }
+
+ private static int readDataChunk(RandomAccessFile file, int offset) throws IOException {
+
+ System.out.println(formatAddress(offset, file.length()) + ":\tdata (Data) chunk");
+
+ int size = 8;
+ if(offset + 8 < file.length()) {
+ size = readChunkSize(file, (int) offset);
+ System.out.println(formatAddress(offset + 0x04, file.length()) + ":\t" + size + " Bytes" + (size > 1024 ? " (" + convertBytes(size) + ")" : ""));
+ }
+
+ System.out.println();
+ return offset + size;
}
- private static void readx2stChunk(RandomAccessFile file, int i) {
- // TODO Auto-generated method stub
+ private static int readSampleChunk(RandomAccessFile file, int offset) throws IOException {
+
+ System.out.println(formatAddress(offset, file.length()) + ":\tsmpl (Sample) chunk");
+
+ int size = 8;
+ if(offset + 8 < file.length()) {
+ size = readChunkSize(file, (int) offset);
+ System.out.println(formatAddress(offset + 0x04, file.length()) + ":\t" + size + " Bytes" + (size > 1024 ? " (" + convertBytes(size) + ")" : ""));
+ }
+
+ // 0x08 4B manufacturer code
+// parseField(file, offset + 0x08, 4, " manufacturer code");
+ byte[] bytes = new byte[4];
+ file.seek(offset + 0x08);
+ file.read(bytes);
+ int relevantBytes = bytes[0];
+ String code;
+ if(relevantBytes == 3)
+ code = String.format("%02XH %02XH %02XH", bytes[1], bytes[2], bytes[3]);
+ else code = String.format("%02XH", bytes[3]);
+
+ System.out.print(formatAddress(offset + 0x08, file.length()) + ":\t");
+
+ boolean found = false;
+ InputStream filestream = AudioExtractor.class.getResourceAsStream("/manufacturer.csv");
+ InputStreamReader streamReader = new InputStreamReader(filestream);
+ Reader in = streamReader;
+ String[] headers = { "SysEx ID Number", "Company Name" };
+ Iterable records = CSVFormat.EXCEL.builder().setHeader(headers).setSkipHeaderRecord(true).build().parse(in);
+ for (CSVRecord record : records) {
+ String ID = record.get("SysEx ID Number");
+ String manufacturer = record.get("Company Name");
+ if(code.equalsIgnoreCase(ID)) {
+ System.out.print(manufacturer + " (" + code + ")");
+ found = true;
+ break;
+ }
+ }
+ if(!found)
+ System.out.print("Unknown (" + code + ")");
+ System.out.println(" manufacturer");
+
+ // 0x0C 4B product code
+ parseField(file, offset + 0x0C, 4, " product code");
+ parseField(file, offset + 0x10, 4, "-nanosecond sample period");
+ parseField(file, offset + 0x14, 4, " MIDI unity note");
+ parseField(file, offset + 0x18, 4, " MIDI pitch fraction");
+ parseField(file, offset + 0x1C, 4, " SMPTE format");
+ parseField(file, offset + 0x20, 4, " SMPTE offset");
+ int loops = parseField(file, offset + 0x24, 4, " sample loops");
+ parseField(file, offset + 0x28, 4, " sample data");
+
+ for(int i = 0; i < loops; i++) {
+ int loopOffset = offset + 0x2C + i * 0x18;
+ parseField(file, loopOffset, 4, " loop ID");
+
+ bytes = new byte[4];
+ file.seek(loopOffset + 0x04);
+ file.read(bytes);
+ int loopType = littleEndianToInt(bytes);
+ System.out.print(formatAddress(loopOffset + 0x04, file.length()) + ":\t");
+ String type;
+ switch(loopType) {
+ case 0:
+ type = "Forward";
+ break;
+ case 1:
+ type = "Alternating";
+ break;
+ case 2:
+ type = "Backward";
+ break;
+ default:
+ type = "Unknown (" + loopType + ")";
+ break;
+ }
+ type += " loop type";
+ System.out.println(type);
+
+ file.seek(loopOffset + 0x08);
+ file.read(bytes);
+ int loopStart = littleEndianToInt(bytes);
+ System.out.println(formatAddress(loopOffset + 0x08, file.length()) + ":\tSample # " + loopStart + " loop start");
+
+ file.seek(loopOffset + 0x0C);
+ file.read(bytes);
+ int loopEnd = littleEndianToInt(bytes);
+ System.out.println(formatAddress(loopOffset + 0x08, file.length()) + ":\tSample # " + loopEnd + " loop end");
+
+ parseField(file, loopOffset + 0x10, 4, " loop fraction");
+ parseField(file, loopOffset + 0x14, 4, " repeat count");
+ }
+
+ System.out.println();
+ return offset + size;
+
+ }
+
+ public static int readSeekChunk(RandomAccessFile file, int offset) throws IOException {
+
+ System.out.println(formatAddress(offset, file.length()) + ":\tseek (Seek) chunk");
+
+ int size = 8;
+ if(offset + 8 < file.length()) {
+ size = readChunkSize(file, (int) offset);
+ System.out.println(formatAddress(offset + 0x04, file.length()) + ":\t" + size + " Bytes" + (size > 1024 ? " (" + convertBytes(size) + ")" : ""));
+ }
+
+ return offset + size;
+
+ }
+
+ /**
+ * Helper method to read a little-endian byte field and print its contents.
+ *
+ * @param file
+ * @param address
+ * @param size
+ * @param message
+ * @return value
+ * @throws IOException
+ */
+ public static int parseField(RandomAccessFile file, int address, int size, String message) throws IOException {
+
+ byte[] bytes = new byte[size];
+ file.seek(address);
+ file.read(bytes);
+ int value = littleEndianToInt(bytes);
+
+ System.out.println(formatAddress(address, file.length()) + ":\t" + value + message);
+
+ return value;
}
- private static void readAlignmentChunk(RandomAccessFile file, int i) {
- // TODO Auto-generated method stub
+ private static int readx2stChunk(RandomAccessFile file, int offset) throws IOException {
+
+ System.out.println(formatAddress(offset, file.length()) + ":\tx2st chunk");
+
+ int size = 8;
+ if(offset + 8 < file.length()) {
+ size = readChunkSize(file, (int) offset);
+ System.out.println(formatAddress(offset + 0x04, file.length()) + ":\t" + size + " Bytes" + (size > 1024 ? " (" + convertBytes(size) + ")" : ""));
+ }
+
+ System.out.println();
+ return offset + size;
}
- private static void readDataChunk(RandomAccessFile file, int i) {
- // TODO Auto-generated method stub
+ private static int readAlignmentChunk(RandomAccessFile file, int offset) throws IOException {
+
+ System.out.println(formatAddress(offset, file.length()) + ":\tALIG (Alignment) chunk");
+
+ int size = 8;
+ if(offset + 8 < file.length()) {
+ size = readChunkSize(file, (int) offset);
+ System.out.println(formatAddress(offset + 0x04, file.length()) + ":\t" + size + " Bytes" + (size > 1024 ? " (" + convertBytes(size) + ")" : ""));
+ }
+
+ System.out.println();
+ return offset + size;
}
- private static void readSampleChunk(RandomAccessFile file, int i) {
- // TODO Auto-generated method stub
+ private static String formatAddress(long address, long size) {
+
+ int digits = (int) Math.ceil(Math.log(size) / Math.log(16));
+
+ return String.format("%0" + digits + "X", address);
+
+// if(size <= 0xFFFF)
+// return String.format("%04X", address);
+// else return String.format("%08X", address);
}
-
+
/**
* Formats a file address with leading zeroes.
*
@@ -489,9 +747,9 @@ public class AudioExtractor {
*/
private static String formatAddress(long address) {
- if(address > 0xFFFF)
+// if(address > 0xFFFF)
return String.format("%08X", address);
- else return String.format("%04X", address);
+// else return String.format("%04X", address);
}
@@ -834,6 +1092,8 @@ public class AudioExtractor {
System.out.print(prompt);
try {
input = reader.readLine();
+ if(input == null)
+ throw new IOException("Invalid file.");
file = new File(input);
if(file.exists()) {
if(file.isFile()) {