⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sinusoid.java

📁 It is the Speech recognition software. It is platform independent. To execute the source code,
💻 JAVA
字号:
/* * Copyright 1999-2004 Carnegie Mellon University.   * Portions Copyright 2002-2004 Sun Microsystems, Inc.   * Portions Copyright 2002-2004 Mitsubishi Electric Research Laboratories. * 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. * */package edu.cmu.sphinx.tools.audio;/** * A 16bit, linear SIGNED_PCM, big endian, sinusoid with a * sample rate of 16kHz. */public class Sinusoid extends AudioData {    /**     * Creates a 16bit, linear SIGNED_PCM, big endian, sinusoid with a     * sample rate of 16kHz.     *     * @param frequency cycles per second     * @param phase phase offset in radians     * @param amplitude amplitude     * @param duration duration in seconds     */    public Sinusoid(double frequency,                    double phase,                    double amplitude,                    double duration) {        this.shorts = new short [(int) (16000 * duration)];	double radiansPerSample = (frequency * 2.0 * Math.PI) / 16000.0;	for (int i = 0; i < shorts.length; i++) {	    shorts[i] = (short) (	        amplitude * Math.cos((radiansPerSample * (double) i) + phase));	}    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -