The tool--nn2utau of the sound source turning Utau

Source: Internet
Author: User
Tags list of attributes

Python writes, the function is, will curl the source of INF.D and voice.d two files into Utau sound source, and restore before packaging WAV files and INF files, can be analyzed with the curl source maker.

The disassembled folder can be dragged to the Utau directory for use as a source and has been brought oto. Generate FRQ with the auto-generate Frq function of Utau.

Tools and instructions for use Http://files.cnblogs.com/files/bdbmb/nn2utau.zip

In order to facilitate the students do not want to install Python, with Py2exe made an EXE version, only for 64-bit system, 32-bit system and XP please download the above, follow the instructions to install Python and then run ~

EXE version Http://files.cnblogs.com/files/bdbmb/nn2utau.rar

Code

#Coding:utf-8#Curl Source Disassembly & curl Sound source to Utau audio Source Tool#known issue: Red area coverage is fixed and does not change according to the actual situation#known issue: The Green Line is always placed between the red and start One-second (this is actually the way the transition between the Curl processing sample)#known issue: The sound end of the expanded sound needs to be set manuallyImportSYSImportOSImportBase64ImportBinasciiinf_file='INF.D'      #INF package fileVoice_file ='VOICE.D'  #wav Package fileNn_dir ='nn'           #The directory where the unpacked files are placed, which are subdirectories of the current directoryOto_type = 0#Oto in the right-hand side of the blue area, 0 is the whole tone, 1 for the expansion of the whole sound, 2 for the Japanese individual toneRed_area = 55#the distance of the red area from the red line, MsEX_FWD = 20#the distance, in milliseconds, that the blue area moves forward than the tail frame when it is turned into an expansion sound#decodes the INF.D content and returns it as a row. Each line of content is split into a single list. defRparams (): F= Open (Inf_file,'R') Params=F.readlines ()delParams[0:2]#Delete the V1 and the total number of pronounced marksCTN = []     forLineinchParams:line=base64.decodestring (line) line=line.split () ctn.append (line) f.close ()returnctn#accept a list of each line converted to, write to the corresponding INF filedefinfwriter (param): filename= Param[0] +'. inf'F= Open ('nn\\'+ filename,'WB') F.write ('0')#starting frame, because the source maker has cut the blanks off, so it's all 0.F.write (str (int (param[2))/2) +' ')#Number of Samples     forIinchRange (3,7): F.write (Param[i]+' ') F.write (param[7])#the above write a few values and spaces that do not need to be processedf.close ()#converts the length of a byte representation into a representation that can be written to the WAV file header. See the article on the online WAV file header structure. defhexlength (length): a= Hex (length) [2:].upper ()#Remove 0xA ='0'* (8-len (a)) + a#remaining bit 0b = []     forPninch[6,4,2,0]:#write down in two-bit unitsB.append (a[pn:pn+2])    return(Binascii.a2b_hex ("'. Join (b)))#string converted to hexadecimal value by meaning#write a WAV file in the given list of attributesdefwavewriter (param): filename= Param[0] +'. wav'F= Open ('nn\\'+ filename,'WB')    #write file header, because Curl requires 16 bit mono 44100Hz wave file, so the file header is almost fixed, except for the length of the logo    #Thanks for the article about WAV file structure online ~F.write ('RIFF') F.write (hexlength (int (param[2]) +44)) F.write ('wavefmt \x10\x00\x00\x00\x01\x00\x01\x00\x44\xac\x00\x00\x88\x58\x01\x00\x02\x00\x10\x00data') F.write (hexlength (int (param[2])))    #writes data at a given offsets = open (Voice_file,'RB') s.seek (int (param[1]) Temp= S.read (int (param[2]) f.write (temp) f.close () s.close ()#Enter a list of attributes to return a row of the Oto filedefrotoline (param):defCVT (BYTE):#converts the length of a byte representation into milliseconds        returnInt (byte) *500/44100ctn= ["','0']#No auxiliary marks, the left blue area is 0lt = CVT (param[2]) s= 2 * CVT (Param[3])#consonant startCtn.append (str (s+red_area))#Red Area    #calculate the blue area to the right, depending on the build mode    #I do the Chinese full tone Oto set when the blue area is often covered by half of the end of the sound, so as not to cut off the end of the sound will not cause a longer bass amount of time    ifOto_type = =0:ctn.append (str (LT-CVT ((int (param[2)) +2*int (Param[4])/2)))    #The expansion of the sound will completely cut off the end of the sound, and with the additional sound end set to do X-fade. Additional sound-end settings need to be done manually, about more than 10    elifOto_type = = 1: Ctn.append (str (LT-CVT (2*int (param[4)) +ex_fwd)) #Japanese single tone, blue at one-third points, personal experience    elifOto_type = = 2: Ctn.append (str (LT-CVT ((int (param[2)) +4*int (Param[4])/3)) ) Ctn.append (str (s) )#consonant startCtn.append (str (S/2))#Green Line, lazy by the way the curl, please manually adjust    returnParam[0] +'. wav='+','. Join (CTN) +'\ n'#Main functiondefMain ():PrintU'Curl Source Library Disassembly & Curl Sound source to Utau audio Source Tool'    PrintU'Please enter the Oto generation method, 0 for the Chinese full tone, 1 for the expansion of the full tone (please manually add a few sound-end settings), 2 for the Japanese individual tone, directly enter the default Chinese full tone'    GlobalOto_type Oto_type=raw_input ()ifOto_type not inch['0','1','2']: Oto_type=0 Oto_type=Int (oto_type)PrintU'processing, please wait a moment ~'Os.mkdir (nn_dir) params=rparams () ctn= []     forParaminchparams:infwriter (param) wavewriter (param) ctn.append (rotoline (param)) Oto= Open ('nn\\'+'Oto.ini','W') Oto.writelines (CTN) oto.close ()PrintU'Success! Press ENTER to exit'    PrintU'You can now use the NN directory directly as a Utau source, or open it with a curl-up source tool.'    PrintU'do not forget to double-click the blank area between the two buttons in the lower left corner of the Utau Source Library Settings dialog box to generate a Frq file'raw_input ()if __name__=='__main__': Main ()

Tool--nn2utau to Utau the sound source to the audio source

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.