91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

JAVA VOX轉(zhuǎn)WAR轉(zhuǎn)換器

資源截圖

代碼片段和文件信息

package?com.lakala.callcenter.utils;

import?java.io.File;
import?java.io.FileInputStream;
import?java.io.FileOutputStream;

public?class?VoxConvert?{

????private?int?convertFormat?=?1;

????private?int?convertRate?=?8000;

????private?int?convertBits?=?1;

????private?final?int?WAV_HEAD?=?36;//?wav文件頭長度

????private?static?final?int?VF_ADPCM?=?1;//?編碼格式

????private?static?final?int?BIT_RATE_VB_8?=?1;//?每個樣本位數(shù)

????private?static?final?int?BIT_RATE_VB_16?=?2;//?每個樣本位數(shù)

????private?final?int?RESET_VALUE?=?48;

????private?byte?out_val;

????/**
?????*?
?????*?@param?inFile
?????*?@param?outFile
?????*?@param?voxFormat?格式?取值范圍:VF_ADPCM?=?1?VF_MULAW?=?2?VF_ALAW?=?3
?????*?@param?voxRate?采樣率?取值范圍:VR_6K?=?6000?VR_8K?=?8000
?????*?@param?bit_rate?位數(shù)?取值范圍:VB_8?=?1?VB_16?=?2
?????*?@return
?????*/
????public?VoxConvert(String?inFile?String?outFile?int?voxFormat?int?voxRate?int?bit_rate)?throws?Exception?{
????????if?(voxFormat?!=?0)?{
????????????convertFormat?=?voxFormat;
????????}
????????if?(voxRate?!=?0)?{
????????????convertRate?=?voxRate;
????????}
????????if?(bit_rate?!=?0)?{
????????????convertBits?=?bit_rate;
????????}
????????if?(outFile?==?null)?{
????????????outFile?=?inFile.substring(0?inFile.length()?-?3);
????????????outFile?=?outFile?+?“wav“;
????????}

????????File?outF?=?new?File(outFile);
????????File?inF?=?new?File(inFile);

????????long?inFileSize?=?inF.length();
????????if?(voxFormat?==?VF_ADPCM)?{?//?if?using?ADPCM?input?format...
????????????inFileSize?=?inFileSize?*?2;
????????}//?change?from?bytes?to?samples

????????FileOutputStream?filewriter?=?new?FileOutputStream(outF?false);
????????String?wavBegin?=?“RIFF“;
????????filewriter.write(wavBegin.getBytes());//?WAV?文件頭

????????long?wavLength?=?inFileSize?*?bit_rate?+?WAV_HEAD;
????????byte[]?tmpArr?=?new?byte[4];
????????longToIntBinary(wavLength?tmpArr?0);
????????filewriter.write(tmpArr);//?文件總長度

????????String?wavTag?=?“WAVEfmt?“;
????????filewriter.write(wavTag.getBytes());//?WAV?文件標識

????????int?headLength?=?16;
????????tmpArr?=?new?byte[4];
????????longToIntBinary(headLength?tmpArr?0);
????????filewriter.write(tmpArr);//?size?of?.WAV?file?header

????????int?wFormatTag?=?1;?//?format?tag?(01?=?Windows?PCM)
????????tmpArr?=?new?byte[2];
????????toShortBinary(wFormatTag?tmpArr?0);
????????filewriter.write(tmpArr);//?format?tag?(01?=?Windows?PCM)

????????int?nChannels?=?1;?//?channels?(1=mono?2=stereo)
????????tmpArr?=?new?byte[2];
????????toShortBinary(nChannels?tmpArr?0);
????????filewriter.write(tmpArr);//?channels?(1=mono?2=stereo)

????????int?nSamplesPerSec?=?voxRate;?//?samples?per?second
????????tmpArr?=?new?byte[4];
????????longToIntBinary(nSamplesPerSec?tmpArr?0);
????????filewriter.write(tmpArr);

????????int?nAvgBytesPerSec?=?voxRate?*?bit_rate;?//?bytes?per?second
????????//?during?play
????????tmpArr?=?new?byte[4];
????????longToIntBinary(nAvg

評論

共有 條評論

相關(guān)資源