首先取一个wav文件,其次找一个wav文件格式简单符合pcm编码的,也就是文件的第14字节位置要为1
确认此wav文件此处为01 00 然后进行解析
然后我们还要知道他的位宽(8位还是16位)、几声道(单声道还是双声道)
14h位置为1代表为pcm编码格式的wav文件
16h位置为2双声道
22h位置为pcm位宽 16
8bit也就是8位也就是等于一字节
8bit单声道用一字节表示一次采样数据
双声道用两字节,前一字节为第一个声道后一字节为第二声道的采样数据
我们16位双声道用四字节表示一次采样数据
前两字节表示第一次采样的一声道数据,后两字节表示第一次采样的二声道数据
那么我们开始解析,一般这种文件文件头为44字节,所以去掉头部44字节后面就是实际的数据。
最终我们要解析成波形图。
双声道就是两条折线图的意思
先解析第一个点02 00 02 00 也就是
第一条折线图的第一个点的y坐标是2,第二条折线图的第一个点的y坐标也是2
第一条折线图的第二个点的y坐标是1,第二条折线图的第二个点的y坐标也是1
。 。
。 。
。 。
。 。
。 。
。 。
以此类推最后画出波形图
好了我们这个音乐是嘟的响一声
如果我们要把改成两声就把数据区域复制粘贴插在文件尾,然后修改28h-2bh位置的数据乘2即可。
附:语音数据16进制
52494646045B000057415645666D7420100000000100020044AC000010B102000400100064617461C0B5000002000200010001000000000000000000000000000100000001000200000002000000010000000100000001000000020000000300000002000000000000000000000000000000000000000000FFFF0000FEFF0000FDFF0000FDFF0000FEFF0000FFFF000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000010000000100000000000000000000000000000000000000000000000000000002000000000000000000FEFF0000FEFF0000FFFF0000FEFF0000FEFF00000000000000000000FFFF0000FEFF0000FFFF0000FFFF0000FFFF0000FEFF0000FEFF0000000002000000000000000000000000000000010000000200000001000000000000000000FFFF0000FFFF0000000000000000000000000000FFFF0000FFFF0000000001000000010000000000000000000000000000000000000000000000000000000000FFFF0000000002000000FFFFFFFFE8FFF2FFB7FFD5FF6EFFA7FF13FF71FFB3FE36FF61FE04FF2AFEDFFE14FED1FE26FEDDFE62FE01FFC5FE3DFF49FF8FFFE9FFEFFF9A005B005701D00015024601D202BC0188032B0235049502D804F9026D055703F205AB037106F903E6063F044C077D04AE07BB040308EF04400816056C0832058D084605A8085805BC086405CA086B05D3087105D4087305CE087005C2086A05B0085E0597084D0575083B054D0822051D080305E407DE04A107B5045607880404075704AB0620044B06E503E305A6037505630301051C038704D1020B0482028C0333020A03E20184029201FF0141017C01EF00F9009C0076004C00FBFF000080FFB4FF07FF6AFF92FE22FF23FEDDFEB8FD99FE4FFD58FEE8FC19FE85FCDEFD28FCA3FDCDFB6DFD76FB37FD21FB02FDD3FAD2FC89FAA3FC41FA77FCFFF94DFCC3F926FC8BF904FC58F9E6FB29F9CBFB02F9B1FBE1F89BFBC5F88AFBAEF87DFB9FF874FB97F86FFB95F86EFB9CF870FBA8F878FBBBF884FBD5F895FBF6F8A8FB20F9C1FB4FF9DDFB82F9FEFBBCF922FCFEF949FC46FA75FC93FAA5FCE8FAD8FC41FB11FD9FFB4CFD02FC89FD6AFCC6FDD5FC08FE43FD4FFEB4FD95FE25FEDAFE9AFE23FF0FFF6BFF83FFB2FFF4FFF8FF60003B00CC007D003601BE009C01FD00FE013A015A027401B202AA010403DC0153030C029D033A02E103650222048E025F04B4029504D502C704F402F7041003220528034605420367055803850568039B057603AC058203B8058A03BF058E03C1058E03BC058D03B2058603A2057C038D05700372055E0351054A032B05340300051903D004FC029A04DA025F04B4021C048C02D5036002880331023703FF01E102C9018502910125025601C10118015A01D700EE0095007D0050000B000B009AFFC5FF24FF7AFFAEFE31FF36FEE8FEBEFD9FFE49FD57FED8FC11FE69FCCCFDFBFB8BFD92FB49FD2FFB0BFDD2FAD2FC79FA9AFC26FA66FCD9F937FC94F90AFC52F9E3FB14F9BFFBDEF89BFBAEF87DFB85F863FB60F84DFB3FF839FB25F829FB0EF81BFBFBF70FFBF1F707FBEDF704FBEEF707FBF3F70AFBFCF70FFB0BF81AFB22F826FB3DF836FB5FF84AFB85F861FBAEF87BFBDDF898FB10F9B8FB48F9DAFB85F9FEFBC7F928FC0DFA54FC56FA82FCA4FAB1FCF6FAE4FC4BFB19FDA8FB51FD08FC8BFD6AFCC8FDCFFC07FE38FD49FEA6FD8CFE13FED1FE81FE16FFF3FE5BFF66FFA1FFD9FFE8FF48002A00B8006E002401B2008E01F300F401330155027001B102A8010A03DE015C031002A6034002EC036C022A0493026204B6029404D502C104F002E704080305051C031E052B0333053503410540034A0546034C0546034805440340053F03310536031C05280303051903E4040703C104F1029904D6026904B90236049A02FF037B02C403560285032E0244030502FF02DB01B602AF016A0281011C024F01C9011D017401E8001D01B000C300770066003E0007000300A7FFCBFF42FF8DFFDCFE4CFF76FE0DFF0DFECDFEA2FD8AFE37FD47FECDFC06FE63FCC6FDFBFB86FD95FB47FD36FB0AFDD7FAD0FC7BFA97FC26FA63FCDAF933FC91F905FC4FF9DCFB14F9B9FBE1F89AFBB4F87DFB90F866FB70F851FB56F843FB45F83AFB3BF833FB37F830FB39F831FB40F835FB4FF83DFB64F84BFB7DF85CFB9DF86FFBC3F885FBEDF89EFB1DF9BCFB55F9DEFB8EF901FCCBF928FC0EFA53FC55FA7EFC9EFAAAFCEAFAD8FC3AFB0AFD8CFB3DFDDEFB70FD32FCA3FD89FCDBFDE3FC11FE3FFD49FE9CFD84FEFBFDBEFE5CFEFAFEBEFE36FF23FF74FF88FFB3FFECFFF2FF4F002E00B6006D001D01AD008201ED00E7012A014C026901AE02A6010D03E10169031802C1034E02140483026204B402AC04E002EF040A03290530035E054F038C056A03B1058303D1059503E905A403FB05AF030406B7030906B9030706B703FB05B003E905A603D3059903B6058703930570036A0556033B053A0306051C03CF04F9029104D1024F04A80208047B02BE034F02700320022203EF01D002BC017C02880127025401D2011E017C01EA002401B500CD007E007700470020001100C8FFDDFF6DFFA6FF15FF6EFFBAFE36FF5FFEFDFE03FEC4FEA9FD8BFE4EFD53FEF3FC1CFE99FCE5FD40FCAFFDE9FB79FD94FB43FD43FB10FDF6FADFFCADFAB3FC66FA8AFC26FA63FCF0F93EFCBCF91FFC90F903FC6CF9EBFB4DF9D9FB35F9CBFB26F9C0FB1CF9BAFB19F9B9FB20F9BEFB2BF9C5FB3DF9CFFB55F9DFFB77F9F3FB9FF90BFCCDF928FCFEF947FC36FA69FC74FA8FFCB8FAB8FC00FBE5FC4EFB15FD9EFB47FDF3FB7CFD4BFCB3FDA6FCEAFD02FD23FE61FD5CFEC0FD98FE1EFED3FE7DFE0EFFDCFE48FF3CFF83FF9AFFBEFFF8FFF8FF53002F00AF0068000901A0006301D600BB010E01120246016A027D01C202B1011603E5016A031A02BD034D0210047E025F04AE02A904DE02F2040D033705370375055E03B1058203E805A5031606C2034206DB036806F303850604049C061404AD061E04B8062304BA062604B4062304A8061C04960611047B0602045A06ED033406D5030706B803D30599039A0576035B054F0317052503CF04F9028104C8022C049402D5035E027B0327021C03ED01BE02B2015F027701FF013C019C01FF003A01C200DA0088007D004D0022001400CAFFDFFF71FFA7FF19FF71FFC1FE3BFF6CFE06FF1AFED1FEC9FDA0FE79FD6FFE2BFD3FFEDFFC0EFE95FCE3FD4EFCB8FD0AFC8CFDC8FB61FD89FB3CFD4EFB19FD15FBF6FCE2FAD4FCB4FAB9FC89FA9EFC64FA85FC45FA71FC2BFA61FC14FA57FC08FA4EFC02FA4AFC01FA4BFC07FA4FFC13FA55FC26FA60FC41FA6FFC5FFA82FC85FA99FCB1FAB6FCE4FAD5FC1CFBF8FC5AFB1EFD9EFB46FDE6FB73FD33FCA5FD87FCD8FDDEFC0DFE38FD46FE98FD82FEFCFDC0FE61FEFDFEC9FE3CFF30FF7CFF97FFBFFFFFFFFEFF65003B00CA007C002F01B8008E01F300EB012E01460266019F029C01F302CF014603020294033302DC03610225048D026C04BA02AF04E402EE040A032C053003670555039F057603D2059603FE05B3032A06CE035206E6037506FA0393060E04AB061F04BD062A04CB063304D5063A04D7063B04D3063804C9063004B8062704A50619048A0608046806F3034106DD031506C203E205A103A9057F036A05590327052E03E10404039304D50240049F02E8036A02900334023403FB01D102BE016B02800106023F019E0100013501C100CD007F0065004000000002009EFFC6FF3EFF89FFDFFE4EFF84FE14FF2CFEDEFED8FDAAFE87FD78FE3AFD49FEF2FC1DFEADFCF4FD6AFCCCFD2EFCA6FDF6FB82FDC2FB61FD92FB44FD67FB29FD3EFB10FD1AFBFBFCFCFAE7FCE2FAD5FCCCFAC6FCB9FABAFCADFAB4FCA4FAAFFCA0FAABFCA3FAAEFCAAFAB4FCB6FABBFCC9FAC5FCDFFAD3FCFAFAE6FC1CFBF9FC43FB11FD6FFB30FDA0FB4DFDD6FB6DFD12FC91FD51FCB8FD96FCE2FDDFFC11FE2DFD41FE7FFD74FED7FDA9FE32FEE1FE91FE1BFFF1FE58FF56FF96FFBDFFD6FF230014008B005300F30093005E01D500C70116012C0256018F029401F002CF014C030802A3033F02F80372024704A4029204D202D804FC02180524035205490389056B03BE058B03ED05A9031506C1033906D8035806ED037306FA038A0608049C061604A8061C04B0062104B4062504B1062404AA0620049F0617048D060D047806FF035D06F0033D06DB031806C403F105AB03C4059003930572035D05510325052E03E8040803A504DF026004B40216048702C8035702760327022203F201C902BA016E027F0110024601B0010C014E01D000EB009000840050001D001400B9FFD7FF53FF96FFEEFE58FF8AFE1AFF28FEDDFEC9FDA3FE70FD6EFE1CFD38FECCFC05FE80FCD6FD3AFCAEFDFAFB85FDBFFB61FD8CFB40FD5FFB24FD36FB0AFD13FBF5FCF6FAE4FCDEFAD5FCCCFACAFCBFFAC1FCB5FABBFCB0FABAFCB3FABAFCB9FABEFCC5FAC5FCD7FACEFCEBFADBFC03FBEDFC23FB00FD48FB14FD71FB2DFD9CFB49FDCBFB68FD00FC88FD37FCA9FD72FCCCFDAEFCF3FDF0FC1DFE33FD47FE7AFD72FEC6FD9FFE13FECFFE62FE01FFB2FE34FF07FF69FF61FFA0FFBCFFD7FF17000E0077004900D60083003701BE009A01FB00F90139015A027501BC02B0011903EC0176032502D1035D02260490027704C302C304F3020A051E034B05460388056B03BF058D03ED05AB031606C4033B06D9035A06ED036F06FC03800608048D06100494061304930613048F06110486060B04750601045E06F3034406E3032506CF030206B803DA059F03AB058503790564034205410307051D03C904F9028904D1024804A80204047D02BC035102730325022A03F701DE02C8018E0295013D026401EC0133019801FF004201C900ED00930097005E003E002700E4FFF2FF89FFB8FF2DFF7FFFD1FE47FF75FE0EFF18FED4FEBCFD9CFE64FD65FE0DFD2FFEBAFCFCFD6BFCCCFD22FC9DFDDDFB72FD9BFB49FD5FFB25FD2BFB06FD00FBE9FCD9FAD1FCB7FABDFC9DFAAEFC8AFAA2FC7CFA99FC74FA93FC71FA90FC75FA93FC81FA9BFC91FAA5FCA4FAB1FCBFFAC1FCDFFAD5FC05FBEEFC2FFB07FD5FFB25FD93FB46FDCEFB68FD0AFC8DFD49FCB5FD8DFCE0FDD4FC0BFE1CFD37FE66FD65FEB0FD95FEFEFDC4FE4DFEF3FE9CFE24FFEBFE56FF3CFF88FF8EFFBAFFE0FFECFF31001E0083005300D50086002901B9007E01ED00D2012101280254017B028901CD02BD011F03F00170032202C00352020C0481025704AF029E04DC02E204050321052D035B05520391057103C2058F03EB05A9030C06C0032A06D2034006E0034E06EA035A06EF035E06F1035A06EE034F06E7033F06DE032A06CF030D06C003EB05AC03C505940398057803660558032F053703F4041203B404EA027004BF0228049302DB0366028B0336023A030302EA02CF0198029D0145026A01EF0134019A0100014601CC00F3009800A00064004D003000FCFFFFFFACFFCCFF5AFF9BFF09FF6AFFBBFE36FF6AFE06FF1AFED6FECCFDA3FE7FFD74FE32FD46FEE7FC18FE9EFCEBFD57FCBFFD13FC94FDD2FB6CFD95FB46FD5BFB22FD27FB01FDF7FAE4FCCAFACAFCA4FAB3FC