当前位置: 首页 > news >正文

网站标识描述可以填关键词吗温州哪里做网站设计

网站标识描述可以填关键词吗,温州哪里做网站设计,wordpress建站多个域名,自己怎样建设网站首页Java Sound API是javaSE平台提供底层的(low-level)处理声音接口。例外#xff0c;java也提供了简单的实用的高层媒体接口(higher-level) #xff0d; JMF(Java Media Framework)。Java Sound API 将需要处理的数字音频分为#xff1a;simpled-audio和midi,分别提供Package来…Java Sound API是javaSE平台提供底层的(low-level)处理声音接口。例外java也提供了简单的实用的高层媒体接口(higher-level) JMF(Java Media Framework)。Java Sound API 将需要处理的数字音频分为simpled-audio和midi,分别提供Package来处理它们javax.sound.simpledjavax.sound.midi同时SOUND API还提供了第三方的扩展接口:javax.sound.simpled.spijavax.sound.midi.spi*注spi : service provider interfaceSampled Audio采样音频(simpled-audio)不仅包含从模拟信号采样来的数字音频还包括电脑合成的。称作digital-audio更为合适。为了能够让设备播放采样声音程序需要处理 audio input, output device, audio data buffers。还有混音处理(mix multiple streams of audio into one stream)。SOUND API 可以使用3种方式传输声音数据stream, buffered fashion, in-memory unbuffered fashion。第三种方式适合数据量不大能够一次载入的所有数据的情形。这样声音的响应较快循环和随机定位也会很简单。使用SOUND API播放声音至少需要3样东西lformatted audio data,la mixer,la line.Mixer调音台technically the Mixer itself is also a kind of LineLine音频数据管道。Clip extends Line将需要播放的音频数据装载进来。preloads audio data from a sound file into clipsA Clip is a data line into which audio data can be loaded prior to playback. Because the data ispre-loaded rather than streamed, the clip‘s duration is known before playback, and you can choose anystarting position in the media. Clips can be looped, meaning that upon playback, all the data between twospecified loop points will repeat a specified number of times, or indefinitely.SourceDataLine extends Lineaccept real-time stream of audio datafeed audio to the MixerA SourceDataLine receives audio data for playback. It provides methods for writing data to thesource data line‘s buffer for playback, and for determining how much data the line is prepared to receivewithout blocking.TargetDataLineA TargetDataLine receives audio data from a mixer. Commonly, the mixer has captured audio datafrom a port such as a microphone; it might process or mix this captured audio before placing the data inthe target data line‘s buffer. The TargetDataLine interface provides methods for reading the datafrom the target data line‘s buffer and for determining how much data is currently available for reading.Port extends Linesimple LineLine接口的继承关系图AudioSystemAudioSystem提供音频资源的访问服务。通过AudioSystem可以知道什么样的资源可以被识别。可从AudioSystem获得的资源lMixers, AudioSystem类可以提供一张已经安装的Mixer列表lLineslFormat conversionslFiles and streamsMixer的获得Mixer.InfoAudioSystem.getMixerInfo():Mixer.Info可以获得一张Mixer信息列表。每个Mixer.Info包含如下关键信息lNamelVersionlVendorlDescription我机器上的Mixer列表,WinXP,JDK_1.4.2[INFO 0]INFO.NAME:Java Sound Audio EngineINFO.VERSION:1.0INFO.VERDOR:Sun MicrosystemsINFO.DESCRIPTION:Software mixer and synthesizer[INFO 1]INFO.NAME:Microsoft ?ù??????÷INFO.VERSION:Unknown VersionINFO.VERDOR:Unknown VendorINFO.DESCRIPTION:No details available[INFO 2]INFO.NAME:Realtek AC97 AudioINFO.VERSION:Unknown VersionINFO.VERDOR:Unknown VendorINFO.DESCRIPTION:No details available[INFO 3]INFO.NAME:Realtek AC97 AudioINFO.VERSION:5.10INFO.VERDOR:Unknown VendorINFO.DESCRIPTION:Unknown Description获取MixerAudioSystem.getMixer( MixerInfo ):Mixer如果只从Mixer.Info提供的信息无法确定需要的Mixer,不妨创建出所有的Mixer使用时检查它们的能力使用合适那个。例如你可能需要一个Mixer能够将混音好的数据同时写入一定数目的目标数据管道(TargetDataLine).使用Mixer.getMaxLines(Line.Info info):int来了解Mixer的输出能力。info就是指定的TargetDataLine获得指定类型Line2种方法获得Linel直接由AudioSystem获得,AudioSystem.getLine( Line.Info ):Linel由Mixer获得从AudioSystem直接获得Linestatic Line AudioSystem.getLine( Line.Info )不同于Mixer.InfoLine.Info不是文本信息而是Line的类信息。Line.Info是抽象类所以使用它的子类DataLine.Info,Port.Info。下面是通过Line.Info获得Line的示例TargetDataLine line;DataLine.Info info new DataLine.Info(TargetDataLine.class,format); // format is an AudioFormat objectif (!AudioSystem.isLineSupported(info)) {// Handle the error.}// Obtain and open the line.try {line (TargetDataLine) AudioSystem.getLine(info);line.open(format);} catch (LineUnavailableException ex) {// Handle the error.//...}Port.Info定义一系列静态的Port.Info对象,MICROPHONE,SPEAKER,etc.从Mixer获得LinegetSourceDataLine()getTargetDataLine()getLine()AudioSystem对象模型AudioPermission音频资源访问许可。利用JAVA-SOUND-API播放声音可以使用2种Line来播放声音,Clip,SourceDataLine。Clip一次载入需要播放的声音资源而SourceDataLine以流的方式传输声音数据。使用Clip当使用getLine()获得Clip后还要保证其他的程序在你播放前不能获取它调用open()方法独占它void open( AudioInputStream stream );void open( AudioFormat, byte[] data, int offset, int bufferSize );Clip默认从音频的开头开始播放除非使用setFramePosition(),setMicroSecondPosition()设定其他位置。Clip.start()播放Clip.stop()暂停。getLevel(),获得声音高度。isActive(),Clip是否正在播放。使用SourceDataLineopen(AudioFormat),打开source dataLine,但不指定数据使用默认的buffer size。open(AudioFormat, bufferSize),指定buffer size.合理设置buffer size,保证开始载入的延时能够被接受又尽量减少IO访问。open()之后,调用start()容许SourceDataLine一有数据就开始播放,使用write()不停的输入数据。void write( byte[] b, int offset, int length );SourceDataLine开始播放后向Mixer传输数据当Mixer开始向target传输数据时SourceDataLine产生一个START事件。这是SourceDataLine被认为是活动的(active)。isRunning()表明Line是否start()了。isActive()表明Line是否开始播放。write()方法向buffer size中写入数据如果buffer已满还剩下一些数据该方法会阻塞否则是不阻塞的。可以使用DataLine.available()知道buffer size还能写入多少数据。事实上可以另开线程去使用write()而不用考虑阻塞的问题。drain()方法在所有数据播放完后返回。所有在写完数据后调用drain()到它返回时再是否Line。line.write(b, offset, numBytesToWrite);//this is the final invocation of writeline.drain();line.stop();line.close();line null;flush()清空buffer中的剩余数据Line在stop时才能调用。有如下情形,Line会产生STOP事件l调用drain()l调用stop()l调用flush()l输出完旧的数据而新的数据未到时。STOP事件意味着isActive()返回false.start()调用之后isRunning()都会返回true,知道stop()被调用。它不是依据STOP事件产生返回值的。而isActive()是依据START和STOP事件的。监视Line的状态使用LineListener响应Line的事件。void Line.addLineListener( LineListener );当调用open(),close(),start(),stop()会产生OPEN,CLOSE,START,STOP事件。多个Line同步播放有些Mixer提供方便的同步功能对一组Lines使用open(),close(),start(),stop()保证它们的同步。可以使用如下方法检查Mixer是否支持同步功能boolean isSynchronizationSupported( Line[] lines, boolean maintainSync )第二个参数表明同步精度是采样同步还是只是start(),stop()保持同步并不维护播放过程同步。AudioFormat音频采样的格式不是音频文件的格式。l编码技术一般都是PCM( pulse code modulation )l声道数目(1单声道2双声道等等)l采样频率sample ratel样本的位数number of bits per samplel帧速率Frame ratelFrame Size in byteslByte Order( big-endian or little-endian )AudioFileFormat:音频文件格式。The file type( WAV,AIFF,etc )The file length in bytesThe length, in frames, of the audio data contained in the fileAn AudioFormat that specifies data format of the audio data in the fileAudioInputStream extends InputStream无须考虑文件的格式就能操作Samples。读取音频文件AudioSystem提供2中方法读取音频文件l根据音频文件中音频数据的格式信息l使用一个指定了音频数据格式的流使用如下方法获得音频文件中音频数据的格式信息static AudioFileFormat getAudioFileFormat(File);static AudioFileFormat getAudioFileFormat(InputStream);static AudioFileFormat getAudioFileFormat(URL);利用如下方法获得第二种方法提到的音频数据流static AudioInputStream getAudioInputStream(File)static AudioInputStream getAudioInputStream(InputStream)static AudioInputStream getAudioInputStream(URL)读取音频文件数据的步骤1)获得AudioInputStream对象2)创建一个字节数组存放一次读入的数据块3)不断地从audio流中读入数据播放或处理数据。示例代码如下int totalFramesRead 0;File fileIn new File(somePathName);// somePathName is a pre-existing string whose value was// based on a user selection.try {AudioInputStream audioInputStream AudioSystem.getAudioInputStream(fileIn);int bytesPerFrame audioInputStream.getFormat().getFrameSize();// Set an arbitrary buffer size of 1024 frames.int numBytes 1024 * bytesPerFrame;byte[] audioBytes new byte[numBytes];try {int numBytesRead 0;int numFramesRead 0;// Try to read numBytes bytes from the file.while ((numBytesRead audioInputStream.read(audioBytes)) ! -1) {// Calculate the number of frames actually read.numFramesRead numBytesRead / bytesPerFrame;totalFramesRead numFramesRead;// Here, do something useful// with the audio data that‘s// now in the audioBytes array...}} catch (Exception ex) {// Handle the error...}} catch (Exception e) {// Handle the error...}写音频文件通过下列方法知道AudioSystem支持哪些音频文件格式写入static boolean isFileTypeSupported( AudioFileFormat.Type,AudioInputStream );static AudioFileFormat.Type[] getAudioFileTypes();static AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream);利用AudioSystem.write()方法向文件写入指定格式的音频数据static int write( AudioInputStream, AudioFileFormat.Type, File );文件或数据格式转换“Java Sound Programmer Guide” – chapter 7Audio File Format ConvertionAudio Data Format ConvertionPCMPCM脉冲编码调制是Pulse Code Modulation的缩写。PCM通过抽样、量化、编码三个步骤将连续变化的模拟信号转换为数字编码。PCM是数字音频中最佳的保真水准近似看成“无损”编码。PCM编码的优点是音质好缺点是数据量大。JAVA SOUND API对于其它编码格式在播放前都会转换成PCM格式。DAC:digital-to-analog converter,数模转换器Decibel:分贝。pl.decibelsPAN:声象该通道信号在左右音箱之间的立体声位置。GAIN:增益REVERB:数字混响。Acoustics:声学资源《Java Sound programmer guide》
http://www.huolong8.cn/news/82572/

相关文章:

  • 梓潼移动网站建设百度云 做网站
  • 网站建设用到什么软件深圳市中心是哪个区
  • 工信部 网站开发设计师简单的美食网站模板免费下载
  • 懒人免费建站模板做网站首页ps分辨率多少
  • 网站的主题有哪些贴心网络推广方法
  • 网站制作公做网站如何购买服务器
  • 承德网站建设电话如何做能放照片的网站
  • 网站开发业务需求分析硅云wordpress多站点
  • 网站对公司的作用是什么意思做网站没有做退钱
  • 张家港网站建设微信公众号怎么创建一个公众号
  • 减肥单页网站小程序有什么用
  • 外贸类网站模板桂林 网站 建设
  • 梦幻西游网页版官方网站wap浏览器是什么意思
  • 深圳做网站找哪家好容桂网站制作代理商
  • 怎样做农产品交易平台网站wordpress登陆界面
  • 邯郸做网站建设网站后申请什么类型专利
  • 响应式视频网站模板新闻热点事件及评论
  • flash+xml地图网站幼儿做爰网站
  • 建设工程信息服务平台新网站浦元品牌网站建设
  • 网站首页优化的目的广告创意设计论文
  • 做网站怎么赚钱做网站的网页
  • 怎么在网站做直播间微网站建设加盟
  • 网站建设顾问天津响应式网站设计
  • dede网站模板怎么改找工作的平台
  • 常用的网站建设技术包括重庆微信网站制作公司
  • 建设专业网站平台电子设计全国网站建设
  • 天津大良网站建设高端品牌女装连衣裙
  • 设计开发建设网站企业邮箱怎么开通注册
  • 免费.网站最新域名vs网站开发平台
  • 乐山旅游英文网站建设网站建设博敏