亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? findsts.java

?? 使用Exlipse編寫的一個(gè)語(yǔ)音程序
?? JAVA
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/** * Portions Copyright 2003 Sun Microsystems, Inc. * Portions Copyright 1999-2003 Language Technologies Institute, * Carnegie Mellon University. * All Rights Reserved.  Use is subject to license terms. * * See the file "license.terms" for information on usage and * redistribution of this file, and for a DISCLAIMER OF ALL * WARRANTIES. * */import java.io.FileInputStream;import java.io.DataInputStream;import java.io.OutputStreamWriter;import java.io.FileOutputStream;import java.io.IOException;import java.io.FileNotFoundException;import javax.sound.sampled.spi.AudioFileReader;import javax.sound.sampled.AudioInputStream;/** * Performs the generation of STS files in FestVox to FreeTTS * conversion. * * <p> * This program is a port from flite/tools/find_sts_main.c * </p> * * <p> * Note:  * The a/b diff result is slightly different than the C version due to * Intel floating-point math. * </p> */public strictfp class FindSTS {    /**     * Generate an sts file     *     * <p>     * <b>Usage</b>     * </p>     * <p>     *  <code> java FindSTS lpc_min lpc_range lpcFile waveFile stsFile     * </code>     * </p>     * <p>     * <code> stsFile </code> the output file.     * </p>     */    public static void main(String[] args) {        try {            if (args.length != 5) {                System.err.println("Usage: java FindSTS lpc_min lpc_range "                        + "lpcFile waveFile stsFile");            } else {                float lpc_min = Float.parseFloat(args[0]);                float lpc_range = Float.parseFloat(args[1]);                FileInputStream lpcFile = new FileInputStream(args[2]);                FileInputStream waveFile = new FileInputStream(args[3]);                FileOutputStream stsFile = new FileOutputStream(args[4]);                // Read input                LPC lpc = new LPC(new DataInputStream(lpcFile));                Wave wave = new Wave(new DataInputStream(waveFile));                lpcFile.close();                waveFile.close();                // Generate sts data                STS[] stsData = findSTS(wave, lpc, lpc_min, lpc_range);                // Verify STS data for sanity                Wave reconstructedWave = new                    Wave(wave.getSampleRate(), stsData, lpc,                            lpc_min, lpc_range);                wave.compare(reconstructedWave);                // Save output                OutputStreamWriter stsWriter = new OutputStreamWriter(stsFile);                saveSTS(stsData, lpc, wave, stsWriter, lpc_min, lpc_range);                stsWriter.close();                stsFile.close();            }        } catch (FileNotFoundException ioe) {            throw new Error("Error while running FindSTS" + ioe.getMessage());        } catch (IOException ioe) {            throw new Error("IO error while finding sts" + ioe.getMessage());        }    }    /**     * Find the sts data.     *     * @param wave the data from the wave file     * @param lpc the data from the lpc file     * @param lpc_min the minimum lpc value     * @param lpc_range the range of the lpc values     *     * @return an <code>STS</code> array containing the data     */    private static STS[] findSTS(Wave wave, LPC lpc, float lpc_min,            float lpc_range) {        int size;        int start = 0;        int end;        STS[] stsData = new STS[lpc.getNumFrames()];        // read wave data into a special array.        short[] waveData =            new short[wave.getNumSamples() + lpc.getNumChannels()];        System.arraycopy(wave.getSamples(), 0, waveData,                    lpc.getNumChannels(), wave.getNumSamples());        for (int i = 0; i < lpc.getNumFrames(); i++) {            double[] resd;            int[] frame;            short[] residual;            end = (int) ((float) wave.getSampleRate() * lpc.getTime(i));            size = end - start;            if (size <= 0) {                System.out.println("frame size at "                        + Float.toString(lpc.getTime(i)) + " is "                        + Integer.toString(size) + ".");            }            residual = generateResiduals(waveData,                    start + lpc.getNumChannels(), lpc.getFrame(i),                    lpc.getNumChannels(), size);            frame = new int[lpc.getNumChannels() - 1];            for (int j = 1; j < lpc.getNumChannels(); j++) {                frame[j - 1] = (int)                    ((((lpc.getFrameEntry(i, j) - lpc_min) / lpc_range))                     * (float) 65535.0);            }            stsData[i] = new STS(frame, size, residual);            start = end;        }        return stsData;    }    /**     * Generate the residuals for this sts     *     * @param wave specially formatted wave data     * @param start offset into the wave data     * @param frame frame data from the lpc     * @param order typically the number of lpc channels     * @param size size of the residual     *     * @return sts residuals     */    private static short[] generateResiduals(short[] wave, int start,            float[] frame, int order, int size) {        double r;        short[] residual = new short[size];        for (int i = 0; i < order; i++) {            r = wave[start + i];            for (int j = 1; j < order; j++) {                r -= frame[j] * ((double) wave[start + (i - j)]);            }            residual[i] = Utility.shortToUlaw((short) r);        }        for (int i = order; i < size; i++) {            r = wave[start + i];            for (int j = 1; j < order; j++) {                r -= frame[j] * ((double) wave[start + (i - j)]);            }             residual[i] = Utility.shortToUlaw((short) r);        }        return residual;    }    /**     * Save the sts data     *     * @param stsData generated sts data     * @param lpc data loaded from the lpc file     * @param wave data loaded from the wave file     * @param osw the OutputStreamWriter to write the sts data to     * @param lpc_min minimum lpc value     * @param lpc_range range of lpc values     *     */    private static void saveSTS(STS[] stsData, LPC lpc, Wave wave,            OutputStreamWriter osw, float lpc_min, float lpc_range) {        try {            osw.write("( " + Integer.toString(lpc.getNumFrames())                    + " " + Integer.toString(lpc.getNumChannels() - 1)                    + " " + Integer.toString(wave.getSampleRate())                    + " " + Float.toString(lpc_min)                    + " " + Float.toString(lpc_range)                    + ")\n");            for (int m=0, i=0; i < lpc.getNumFrames(); i++) {                osw.write("( " + Float.toString(lpc.getTime(i)) + " (");                // Use the following line instead to compare against                // the flite find_sts output                //osw.write("( " + Utility.hex(lpc.getTime(i)) + " (");                for (int j = 1; j < lpc.getNumChannels(); j++) {                    osw.write(" " +                            Integer.toString(stsData[i].getFrameEntry(j - 1)));                }                osw.write(" ) "                        + Integer.toString(stsData[i].getNumSamples())                        + " ( ");                for (int j = 0; j < stsData[i].getNumSamples(); j++) {                        osw.write(" " +                                Integer.toString(stsData[i].getResidual(j)));                }                osw.write(" ))\n");            }        } catch (IOException ioe) {            throw new Error("IO error while writing sts." + ioe.getMessage());        }    }}/** * The lpc data * */class LPC {    private int numFrames;    private int numChannels;    float[] times;    float[][] frames;    /** Create lpc data from an input stream     *     * @param dis DataInputStream to read the lpc in from     *     */    public LPC(DataInputStream dis) {        try {            if (!Utility.readWord(dis).equals("EST_File") ||                    !Utility.readWord(dis).equals("Track")) {                throw new Error("Lpc file not EST Track file");            }            boolean isBinary = false;            boolean isBigEndian = false;            // Read Header            String token = Utility.readWord(dis);            while (!token.equals("EST_Header_End")) {                if (token.equals("DataType")) {                    if (Utility.readWord(dis).equals("binary")) {                        isBinary = true;                    } else {                        isBinary = false;                    }                } else if (token.equals("ByteOrder")) {                    if (Utility.readWord(dis).equals("10")) {                        isBigEndian = true;                    } else {                        isBigEndian = false;                    }                } else if (token.equals("NumFrames")) {                    numFrames = Integer.parseInt(Utility.readWord(dis));                } else if (token.equals("NumChannels")) {                    numChannels = Integer.parseInt(Utility.readWord(dis));                }                // Ignore all other content in header                token = Utility.readWord(dis);            }            times = new float[numFrames];            frames = new float[numFrames][numChannels];            // read data section            if (isBinary) {                loadBinaryData(dis, isBigEndian);            } else {                loadTextData(dis);            }        }        catch (IOException ioe) {            throw new Error("IO error while parsing lpc" + ioe.getMessage());        }    }    /**     * load the data section of the lpc file as ascii text     *     * @param dis DataInputStream to read from     *     * @throws IOException on ill-formatted input     */    private void loadTextData(DataInputStream dis) throws IOException {        for (int f=0; f < numFrames; f++) {            times[f] = Float.parseFloat(Utility.readWord(dis));            Utility.readWord(dis);  // can be only 1            for (int c=0; c < numChannels; c++) {                    frames[f][c] = Float.parseFloat(Utility.readWord(dis));            }        }    }    /**     * load the data section of the lpc file as ascii text     *     * @param dis DataInputStream to read from     * @param isBigEndian whether or not the data in the file is in     *          big endian byte order     *     * @throws IOException on ill-formatted input     */    private void loadBinaryData(DataInputStream dis, boolean isBigEndian)            throws IOException {        for (int f=0; f < numFrames; f++) {            times[f] = Utility.readFloat(dis, isBigEndian);            // Ignore the 'breaks' field            Utility.readFloat(dis, isBigEndian);            for (int c=0; c < numChannels; c++) {                frames[f][c] = Utility.readFloat(dis, isBigEndian);            }        }    }    /**     * Get the number of frames in this lpc     *     * @return number of frames in this lpc     */    public int getNumFrames() {        return numFrames;    }    /**     * Get the number of channels in this lpc     *     * @return number of channels in this lpc     */    public int getNumChannels() {        return numChannels;    }    /**     * Get the times associated with this lpc     *     * @return an array of times associated with this lpc     */    public float[] getTimes() {        return times;    }    /**     * Get an individual time associated with this lpc     *     * @param index index of time to get     *     * @return time value at given index     */    public float getTime(int index) {        return times[index];    }    /**     * Get an individual frame     *     * @param i index of frame     *     * @return the frame     */    public float[] getFrame(int i) {        return frames[i];    }    /**     * Get an individual frame entry     *     * @param i index of frame     * @param j index into frame     *     * @return the frame entry in frame <code>i</code> at index     *          <code>j</code>     */    public float getFrameEntry(int i, int j) {        return frames[i][j];    }}/** * The wave (riff) data */class Wave {    private int numSamples;    private int sampleRate;    private short[] samples;    // Only really used in loading of data.    private int headerSize;    private int numBytes;    private int numChannels = 1;  // Only support mono    static final short RIFF_FORMAT_PCM = 0x0001;    /**     * Read in a wave from a riff format     *     * @param dis DataInputStream to read data from     */    public Wave (DataInputStream dis) {        try {            loadHeader(dis);            if (dis.skipBytes(headerSize - 16) != (headerSize - 16)) {                throw new Error("Unexpected error parsing wave file.");            }            // Bunch of potential random headers            while (true) {                String s = new String(Utility.readChars(dis, 4));                if (s.equals("data")) {                    numSamples = Utility.readInt(dis, false) / 2;                    break;                } else if (s.equals("fact")) {                    int i = Utility.readInt(dis, false);                    if (dis.skipBytes(i) != i) {                        throw new Error("Unexpected error parsing wave file.");                    }                } else {                    throw new Error("Unsupported wave header chunk type " + s);                }            }            int dataLength = numSamples * numChannels;            samples = new short[numSamples];            for (int i = 0; i < dataLength; i++) {                samples[i] = Utility.readShort(dis, false);            }        } catch (IOException ioe) {            throw new Error("IO error while parsing wave" + ioe.getMessage());        }    }    /**     * load a RIFF header     *     * @param dis DataInputStream to read from     *     * @throws IOException on ill-formatted input     */    private void loadHeader(DataInputStream dis) throws IOException {        if (!checkChars(dis, "RIFF")) {            throw new Error("Invalid wave file format.");        }        numBytes = Utility.readInt(dis,false);        if (!checkChars(dis, "WAVEfmt ")) {            throw new Error("Invalid wave file format.");        }        headerSize = Utility.readInt(dis, false);        if (Utility.readShort(dis, false) != RIFF_FORMAT_PCM) {            throw new Error("Invalid wave file format.");        }        if (Utility.readShort(dis, false) != 1) {            throw new Error("Only mono wave files supported.");        }                sampleRate = Utility.readInt(dis, false);        Utility.readInt(dis, false);        Utility.readShort(dis, false);        Utility.readShort(dis, false);    }    /**

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕色av一区二区三区| 另类的小说在线视频另类成人小视频在线 | 国产精品三级av| 日韩三级视频在线观看| 91精品国产综合久久久久久久| 欧美三区在线观看| 欧美日韩一区二区电影| 欧美挠脚心视频网站| 在线播放国产精品二区一二区四区 | 日本福利一区二区| 在线观看成人免费视频| 在线精品视频免费观看| 欧美午夜精品免费| 欧美日韩国产高清一区二区| 欧美精品久久99久久在免费线| 欧美日韩美女一区二区| 8x福利精品第一导航| 日韩丝袜美女视频| 久久久久久久av麻豆果冻| 久久久精品人体av艺术| 中文字幕久久午夜不卡| 国产精品久久国产精麻豆99网站| 国产精品欧美一区二区三区| 国产精品久久久久久亚洲毛片| 亚洲欧美日韩国产综合在线| 一区二区三区免费看视频| 五月天中文字幕一区二区| 麻豆成人免费电影| 国产精品一区二区不卡| av日韩在线网站| 欧美色偷偷大香| 精品免费国产一区二区三区四区| 久久久精品欧美丰满| 亚洲欧美韩国综合色| 午夜视频在线观看一区二区| 久久se这里有精品| 大桥未久av一区二区三区中文| 色婷婷久久久综合中文字幕| 在线成人免费视频| 久久久影视传媒| 亚洲夂夂婷婷色拍ww47| 麻豆久久久久久| 成人性视频免费网站| 欧美亚洲高清一区二区三区不卡| 欧美一级xxx| 国产精品国产三级国产aⅴ原创| 亚洲最新在线观看| 久久se精品一区精品二区| 99久久久久久99| 在线91免费看| 国产精品精品国产色婷婷| 亚洲一区二区三区四区五区中文 | 在线成人午夜影院| 国产女同性恋一区二区| 五月婷婷久久丁香| 高清在线成人网| 欧美日韩久久不卡| 国产日韩欧美综合一区| 亚洲福利一区二区| 国产99精品在线观看| 91.麻豆视频| 中文字幕在线不卡| 久久成人免费网| 欧美最猛性xxxxx直播| 久久精品亚洲乱码伦伦中文| 亚洲一区二区不卡免费| 国产成人av一区二区三区在线| 欧美网站一区二区| 欧美激情一区二区在线| 免费精品视频在线| 在线精品亚洲一区二区不卡| 国产欧美日韩一区二区三区在线观看| 午夜视频在线观看一区二区| 91在线一区二区三区| 2023国产精品自拍| 日韩av电影免费观看高清完整版 | 卡一卡二国产精品| 欧美日韩国产首页| 亚洲啪啪综合av一区二区三区| 国内精品伊人久久久久av一坑 | 欧美一区三区二区| 一区二区三区自拍| 国产69精品一区二区亚洲孕妇| 欧美精品 日韩| 亚洲靠逼com| 国产91精品一区二区麻豆网站| 欧美肥大bbwbbw高潮| 亚洲伊人伊色伊影伊综合网| 波多野结衣在线一区| 久久久综合九色合综国产精品| 免费在线观看一区二区三区| 欧美在线不卡视频| 亚洲乱码中文字幕| 成人激情视频网站| 国产三级精品视频| 国产精品一区专区| 久久久久久免费网| 国产精品乡下勾搭老头1| 日韩欧美黄色影院| 久久精品噜噜噜成人av农村| 91精品国产一区二区三区蜜臀 | 日韩毛片一二三区| 成年人午夜久久久| 日本一区二区三区久久久久久久久不| 狠狠狠色丁香婷婷综合激情| 欧美大片日本大片免费观看| 免费日本视频一区| 日韩欧美久久久| 极品少妇一区二区| 久久免费视频色| 国产激情91久久精品导航| 精品国产亚洲一区二区三区在线观看| 美腿丝袜一区二区三区| 欧美一区二区三区性视频| 日本欧美一区二区三区乱码| 日韩一区二区中文字幕| 免费久久99精品国产| 日韩精品影音先锋| 国内精品久久久久影院色| 久久综合狠狠综合久久激情 | 欧美视频在线观看一区| 日韩电影在线一区| 欧美大片一区二区三区| 国产一区二区久久| 国产精品无遮挡| 日本韩国一区二区三区视频| 亚洲大片一区二区三区| 91麻豆精品国产91久久久更新时间| 五月激情综合网| 精品国精品国产| 国产成人av电影在线| 中文字幕佐山爱一区二区免费| 色吊一区二区三区| 蜜芽一区二区三区| 国产无人区一区二区三区| av在线一区二区三区| 亚洲国产精品久久人人爱| 7777精品伊人久久久大香线蕉经典版下载| 青青草伊人久久| 久久美女艺术照精彩视频福利播放| 成人av午夜影院| 亚洲成av人综合在线观看| 日韩亚洲欧美在线观看| 成人午夜电影网站| 亚洲一区在线视频| 久久综合狠狠综合久久综合88 | 欧美一卡二卡三卡四卡| 国产一区在线精品| 亚洲精品视频在线看| 日韩三级中文字幕| 97久久精品人人做人人爽| 三级影片在线观看欧美日韩一区二区| 精品国产免费久久| 色综合久久久久综合体桃花网| 日本不卡一区二区| 中文字幕成人网| 欧美日韩国产乱码电影| 国产传媒日韩欧美成人| 天堂影院一区二区| 久久久久久99久久久精品网站| 91成人看片片| 国产精选一区二区三区| 亚洲一二三四久久| 国产欧美日韩在线| 欧美一区二区久久| 91免费国产在线| 麻豆国产精品官网| 亚洲一区中文日韩| 国产精品每日更新在线播放网址| 欧美精品视频www在线观看| 国产99久久久精品| 青青草伊人久久| 一区二区三区在线视频免费| 国产亚洲欧美中文| 欧美精品视频www在线观看| 不卡一区在线观看| 精品在线亚洲视频| 亚洲成人自拍偷拍| 国产精品素人视频| 26uuu色噜噜精品一区二区| 欧美四级电影网| 成人黄色电影在线 | 岛国精品在线播放| 久久国产欧美日韩精品| 午夜精品免费在线观看| 一区二区中文字幕在线| 久久先锋影音av| 欧美一级日韩免费不卡| 欧美性大战xxxxx久久久| 成人av免费网站| 国产成人av在线影院| 黄色精品一二区| 美女一区二区三区| 性欧美疯狂xxxxbbbb| 一区二区三区欧美在线观看| 国产精品二区一区二区aⅴ污介绍| 久久综合色鬼综合色| 精品电影一区二区| 欧美一区在线视频| 欧美一区二区福利在线|