wav

Detect & Record Audio in Python

无人久伴 提交于 2019-11-26 03:47:20
问题 I need to capture audio clips as WAV files that I can then pass to another bit of python for processing. The problem is that I need to determine when there is audio present and then record it, stop when it goes silent and then pass that file to the processing module. I\'m thinking it should be possible with the wave module to detect when there is pure silence and discard it then as soon as something other than silence is detected start recording, then when the line goes silent again stop the

How to encode a WAV to a mp3 on a Android device

為{幸葍}努か 提交于 2019-11-26 02:07:07
问题 I have simplified my question and offered a bounty: What options are there for compressing raw PCM audio data to a mp3 on a Android device. My original post: I\'m creating a synthesiser on my Android phone, and I\'ve been generating PCM data to send to the speakers. Now I\'m wondering if I can encode this PCM data as a mp3 to save to the sdcard. The MediaRecorder object can encode audio coming from the microphone into various formats, but doesn\'t allow the encoding from programmatically

How to play .wav files with java

血红的双手。 提交于 2019-11-25 23:40:57
问题 I am trying to play a *.wav file with Java. I want it to do the following: When a button is pressed, play a short beep sound. I have googled it, but most of the code wasn\'t working. Can someone give me a simple code snippet to play a .wav file? 回答1: Finally I managed to do the following and it works fine import java.io.File; import java.io.IOException; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax

Playing .mp3 and .wav in Java?

ⅰ亾dé卋堺 提交于 2019-11-25 22:45:37
问题 How can I play an .mp3 and a .wav file in my Java application? I am using Swing. I tried looking on the internet, for something like this example: public void playSound() { try { AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(new File(\"D:/MusicPlayer/fml.mp3\").getAbsoluteFile()); Clip clip = AudioSystem.getClip(); clip.open(audioInputStream); clip.start(); } catch(Exception ex) { System.out.println(\"Error with playing sound.\"); ex.printStackTrace(); } } But, this will