[Acoustics from the beginning] the No. 206 section sends acoustic data

Source: Internet
Author: User

Plot summary:
[Machine Xiao Wei] in the [engineer Ah Wei] accompanied by the practice of acoustic avatar.
This time, we are going to study [acoustic data].

Drama Start:


Star Calendar May 05, 2016 10:58:13, the Milky Way Galaxy Earles the Chinese Empire Jiangnan Line province.
[Engineer Ah Wei] is working with [machine Xiao Wei] to study [hair acoustic data].


English Phonetic Alphabet:





Phonetic transcription of Hanyu Pinyin:



















Why some sound high school bass can not mix up, feel the dry each.



This can be mixed up.


What's the difference? Xiao Wei temporarily do not understand, it seems to be systematic to learn a bit of knowledge.
Idlewave = [B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', B ' \x00 ', B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ' , B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', B ' \  X00 ', B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', B ' \x xx ', B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', B ' \x0 0 ', B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', B ' \  X00 ', B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', B ' \x xx ', B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', B ' \x0 0 ', B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', B ' \x00 ', B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', B ' \x00 ', B ' \x00 ', b ' \x00 ', B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', B ' \x xx ', B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', B ' \x0 0 ', B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', B ' \x00 ', B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', B ' \x00 ', B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ' , B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', B ' \ X00 ', B ' \x00 ', b ' \x00 ',B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', B ' \x0 0 ', B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', B ' \x00 ', B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', B ' \x00 ', B ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x00 '    ]; #把十进制数按照小尾字节序切割def Littleendian (number, Byte = 4): result = [0]*byte;        For I in Range (byte): result[i] = number%256;    number//=256;    return result;    #把UltraEdit中的值字串转化为hex序列组def hexexpr (string): Resultstring = ";    Size = Len (string);        For I in range (size): if (i = = 0): resultstring + = ' 0x ' +string[i];      Elif (string[i] = = "):      Resultstring + = ', 0x ';    Else:resultstring + = String[i]; Print (resultstring); # # # # # # # # # # # # # @usage write a. wav file that writes the array of sonic data into a binary. wav.  # @author mw# @date April 28, 2016 Thu 14:31:34 # @param # @return # # # #def writewav (index, filename): ByteArray =    [];        DataArray = [];    #样本数据阵列 Samplearray = wavedatachoose (index, filename);    #样本数据点数 N = Len (Samplearray);    times = 2;        DataSize = N*times; FileSize = datasize+44;  #44为格式头部分所用字节数 #RIFF WAVE CHUNK riff_id = [0x52, 0x49, 0x46, 0x46]; # ' RIFF ' riff_size = Littleendian (fileSize-8, 4); #文件总字节数减去8 Riff_type = [0x57, 0x41,0x56, 0x45, 0x66, 0x6d, 0x74, 0x20]; # ' Wavefat ' #Format Chunk format_10_17 = [0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00]; #过滤4 + format 2 = 8 bytes Forma T_18_1B = [0x11, 0x2B, 0x00, 0x00]; #采样频率0x2B11 = 11025 format_1c_1f = [0x22, 0x56, 0x00, 0x00]; #比持率 = frequency * Channel * Sample bit = 22050 format_20_23 = [0x02, 0x00, 0x10, 0x00]; #块对齐 = number of channels * sample bits = 1*2 = 2 #Fact ChuNK (optional) #Data Chunk data_24_27 = [0x64, 0x61, 0x74, 0x61]; # ' DATA ' tag data_size = Littleendian (fileSize-44, 4);        #下面的Data部分的字节数, total number of files bytes -44 #RIFF WAVE CHUNK "For I in Range (4): byte = Struct.pack (' B ', riff_id[i]);    Bytearray.append (byte);    "' RIFF = [b ' R ', b ' I ', B ' f ', B ' f '];    For I in range (4): Bytearray.append (Riff[i]);        For I in range (4): byte = Struct.pack (' B ', riff_size[i]);    Bytearray.append (byte);        ' For I in range (8): byte = Struct.pack (' B ', riff_type[i]);    Bytearray.append (byte);        #Format Chunk for I in range (8): byte = Struct.pack (' B ', format_10_17[i]);    Bytearray.append (byte);        For I in range (4): byte = Struct.pack (' B ', format_18_1b[i]);    Bytearray.append (byte);        For I in range (4): byte = Struct.pack (' B ', format_1c_1f[i]);    Bytearray.append (byte);        For I in range (4): byte = Struct.pack (' B ', format_20_23[i]); Bytearray.append (Byte);        #Data Chunk for I in range (4): byte = Struct.pack (' B ', data_24_27[i]);    Bytearray.append (byte);                   "#Format_28_2B是数据块大小, Formathead is all part of the front of it formathead = [B ' W ', b ' A ', b ' V ', b ' E ', B ' f ', B ' m ', B ' t ', B ', B ' \x10 ', b ' \x00 ', b ' \x00 ', b ' \x00 ', b ' \x01 ', b ' \x00 ', b ' \x01 ', b ' \x00 ', b ' \x11 ', B ' + ', B ' \x00 ',                   B ' \x00 ', b ' "', B ' V ', b ' \x00 ', b ' \x00 ', b ' \x02 ', b ' \x00 ', b ' \x10 ', b ' \x00 ',    B ' d ', B ' a ', B ' t ', B ' a '];    For I in range (len (formathead)): Bytearray.append (Formathead[i]);        For I in range (4): byte = Struct.pack (' B ', data_size[i]);    Bytearray.append (byte); #写出到文件 print (' File write start.    >>> ');    fout= open (filename[index]+ '. wav ', ' WB ');        size = Len (ByteArray);               For I in range (size): Fout.write (Bytearray[i]);    size = Len (Samplearray);            Sizeidle = Len (idlewave); For j in Range (times): For I in range (siZe): Fout.write (Samplearray[i]);    Fout.close (); Print (' The file is finished writing.    #生成声音样本, returns the sample matrix Def samplegen (N, freq1, FREQ2, freq3): #设立20000个数值点, about 2 seconds to listen Samplearray = [];    Coef = 2*math.pi/11025;    COEF1 = coef*freq1;    Coef2 = COEF*FREQ2;        COEF3 = COEF*FREQ3;        For I in Range (N): value = (Math.sin (I*COEF1) + Math.sin (I*COEF2) + Math.sin (I*COEF3))/3;        if (value < 0): value *= 32768;        Else:value *= 32767;    Samplearray.append (Round (value));    Return samplearray;def Wavedatagen (freq1, FREQ2, freq3): N = 200;    Samplearray = Samplegen (N, freq1, FREQ2, FREQ3);        DataArray = [];        For I in Range (N): value = Littleendian (Samplearray[i], 2);            For j in Range (2): byte = Struct.pack (' B ', value[j]);        Dataarray.append (byte);        return Dataarray;def Genidle (): DataArray = [];        For I in range: value = Littleendian (0, 2); For j in Range (2): byte =Struct.pack (' B ', value[j]);        Dataarray.append (byte);        Print (DataArray); #波形选择def wavedatachoose (index, filename): Import wavedata; Tmpdata = eval (' Wavedata. ')    +filename[index]);    Sampledata = [];        For I in range (1, +): for J in range: Sampledata + = Idlewave;        For j in Range (i): Sampledata + = Tmpdata;    For j in range: Sampledata + = Idlewave;     return sampledata;        #调用入口, generate WAV file def tmp (filename): size = len (filename);                For I in range: if I > 300:break; Writewav (i, filename); #生成声波数据def tmp2 (): Print (' Generate waveform starts.        >>> ');        fout= open (' Output.txt ', ' W ');    I, k = 200, 1600;        For j in Range (551, 1001, 1): Datastr = ' combinewave_ ' +str (i) + ' _ ' +str (j) + ' _ ' +str (k) + ' = [';        Fout.write (DATASTR);        data = Wavedatagen (I, J, K);        size = len (data);  For n in range (size): Fout.write (str (data[n));          if (n < size-1): Fout.write (', ');                    Fout.write (']; ');    Fout.write (' \ r \ n ');    Fout.close (); Print (' Generate waveform end, please go to output.txt to check.        '); #打印文件名 def tmp3 (): filename = [];    I, k = 200, 1600;        For j in Range (1001, 1): Datastr = ' combinewave_ ' +str (i) + ' _ ' +str (j) + ' _ ' +str (k);    Filename.append (DATASTR);    print (filename); if __name__ = = ' __main__ ': Import wavename;        filename = wavename.wavename;    part = 1;    if (part = = 3): Tmp3 ();    Elif (part = = 2): TMP2 ();         Elif (part = = 1): tmp (filename);


The end of this section, to know how to funeral, please see tell.

[Acoustics from the beginning] the No. 206 section sends acoustic data

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.