wav

Java - Trouble combining more than 2 .wav files

两盒软妹~` 提交于 2019-12-06 08:59:12
for a project I'm working on, I want to be able to concatenate multiple .wav files. Through my research I was able to come up with this code: File sample1 = new File("F:\\Programming\\Resources\\Java_Sound\\trumpet1.wav"); File sample2 = new File("F:\\Programming\\Resources\\Java_Sound\\trumpet2.wav"); File fileOut = new File("F:\\Programming\\Resources\\Java_Sound\\Test.wav"); AudioInputStream audio1 = AudioSystem.getAudioInputStream(sample1); AudioInputStream audio2 = AudioSystem.getAudioInputStream(sample2); AudioInputStream audioBuild = new AudioInputStream(new SequenceInputStream(audio1,

Audio speed changes on converting WAV to MP3

萝らか妹 提交于 2019-12-06 08:08:06
问题 I create a WAV ( PCM ) to MP3 converter. But the output is too fast. This is the code, that converts the encoding. FILE *pcm = fopen(in_path, "rb"); FILE *mp3 = fopen(out_path, "wb"); int read, write; const int PCM_SIZE = 8192; const int MP3_SIZE = 8192; short int pcm_buffer[PCM_SIZE*2]; unsigned char mp3_buffer[MP3_SIZE]; lame_t lame = lame_init(); lame_set_in_samplerate(lame, sampleRate); lame_set_brate(lame, byteRate); lame_set_num_channels(lame, channels); lame_set_mode(lame, MONO); lame

What trick will give most reliable/compatible sound alarm in a browser window for most browsers

核能气质少年 提交于 2019-12-06 06:32:43
I want to be able to play an alarm sound using Javascript in a browser window, preferably with the requirement for any browser plugins (Quicktime/Flash). I have been experimenting with the tag and the new Audio object in Javascript, but results are mixed: As you can see, there is no variant that works on all browsers. Do I miss a trick that is more cross-browser compatible? This is my code: // mp3 with Audio object var snd = new Audio("/sounds/beep.mp3");snd.play(); // wav with Audio object var snd = new Audio("/sounds/beep.wav");snd.play(); // mp3 with EMBED tag $("#alarmsound").empty()

Java AudioSystem: Reading 32 Bit Wav Files

好久不见. 提交于 2019-12-06 06:03:55
I'm reading in audio files in 16 and 24 bit sampling bit depths and parsing them to determine their lengths without difficulty. However when reading a 32 bit file, I get javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input file at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1170) ... The 32 bit test file is manually encoded in the same manner as the others (linear PCM). I'm wondering if AudioSystem doesn't support 32 bit Wavs, or if there might be a workaround. For reference, here's my class: import java.io.*; import javax

How to divide a wav file into 1 second pieces with Java?

我只是一个虾纸丫 提交于 2019-12-06 05:54:45
问题 I had a question previously: Reading wav file in Java Firstly, I want to read a wav file with Java and get its bytes to process into an array. Secondly, I will remove the silences of it(this is another question's topic). After that I will divide that wav file into 1 second pieces(I should handle header problem for that small wav files, this is one of the major problems) I tried to read wav file with Java with that API, the answer of my previous question. However with that API should I do

Clip plays WAV file with bad lag in Java

自作多情 提交于 2019-12-06 05:00:47
问题 I've written a code that read a WAV file (size is about 80 mb) and plays that. The problem is that sound plays badly (extreme lags). Can you please tell me what's the problem? Here's my code: (I call the doPlay function inside a Jframe constructor) private void doPlay(final String path) { try { stopPlay(); InputStream is = new FileInputStream(path); InputStream bufferedIn = new BufferedInputStream(is); AudioInputStream ais = AudioSystem.getAudioInputStream(bufferedIn); AudioFormat format =

Noise reduction and compression in streaming audio

不羁的心 提交于 2019-12-06 04:14:54
问题 hope you can help. I am recording audio from a microphone and streaming it live across a network. The quality of the samples is 11025hz, 8 bit, mono. Although there is a small delay (1 second), it works great. What I need help with is I am trying to now implement noise reduction and compression, to make the audio quieter and use less bandwidth. The audio samples are stored in a C# array of bytes[], which I am sending/receiving using Socket. Could anyone suggest how, in C#, to implement

AS3 microphone recording/saving works, in-flash PCM playback double speed

此生再无相见时 提交于 2019-12-06 04:12:03
问题 I have a working mic recording script in AS3 which I have been able to successfully use to save .wav files to a server through AMF. These files playback fine in any audio player with no weird effects. For reference, here is what I am doing to capture the mic's ByteArray: (within a class called AudioRecorder) public function startRecording():void { _rawData = new ByteArray(); _microphone .addEventListener(SampleDataEvent.SAMPLE_DATA,_samplesCaptured, false, 0, true); } private function

Embedd .wav files in HTML page in all browsers (no controls)

怎甘沉沦 提交于 2019-12-06 03:49:55
问题 I need to play few wav files on button click. I found solution working in IE but it requires QickTime plugin for Firefox. Is there any other way? <html> <head> <script> function DHTMLSound(surl) { document.getElementById("dummyspan").innerHTML= "<embed src='"+surl+"' hidden=true autostart=true loop=false>"; } </script> </head> <body> <h1>test</h1> <span id=dummyspan></span> <input type="button" value="Play" onmouseover="DHTMLSound('1.wav')"> </body> </html> 回答1: Use one of these. I have only

Wav comparison, same file

流过昼夜 提交于 2019-12-06 03:29:46
问题 I'm currently stumped . I've been looking around and experimenting with audio comparison. I've found quite a bit of material, and a ton of references to different libraries and methods to do it. As of now I've taken Audacity and exported a 3min wav file called "long.wav" and then split the first 30seconds of that into a file called "short.wav". I figured somewhere along the line I could visually log (log.txt) the data through java for each and should be able to see at least some visual