转换字节数组为.wav的java [英] Convert byte array to .wav java

查看:1519
本文介绍了转换字节数组为.wav的java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个返回字节数组的web服务,我的本意是说数组转换为以客户为.wav(手持如黑莓)。不过,我真的不知道如何做到这一点的想法,我只是试图作出的FileOutputStream但当然,不会玩的。所以,我再次不知道该怎么办。任何想法?

I have a web service that returns an array of bytes and my intention is to convert said array to a .wav in the client (a handheld such as Blackberry). However I really have no idea of how to do that, I tried just making an FileOutputStream but of course that wouldn't play. So I am once again without knowing what to do. Any ideas?

推荐答案

所以,也有.WAV格式的地段,这里的一些文档:

So, there are LOTS of .WAV formats, here's some documentation:

  • http://en.wikipedia.org/wiki/WAV
  • http://ccrma.stanford.edu/courses/422/projects/WaveFormat/ (note endian changes)
  • http://www.lightlink.com/tjweber/StripWav/WAVE.html

这不只是一个数据字节流,但它很接近......只是有点头的,你应该是不错的。

It's not just a stream of data bytes, but it's close... Just a bit of header and you should be good.

我想你也可以使用类似的http://java.sun.com/j2se/1.5.0/docs/api/javax/sound/sampled/spi/AudioFileWriter.html

I suppose you could also use something like http://java.sun.com/j2se/1.5.0/docs/api/javax/sound/sampled/spi/AudioFileWriter.html

这篇关于转换字节数组为.wav的java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆