wav

Reading *.wav files in Python

和自甴很熟 提交于 2019-11-26 12:49:44
I need to analyze sound written in a .wav file. For that I need to transform this file into set of numbers (arrays, for example). I think I need to use the wave package. However, I do not know how exactly it works. For example I did the following: import wave w = wave.open('/usr/share/sounds/ekiga/voicemail.wav', 'r') for i in range(w.getnframes()): frame = w.readframes(i) print frame As a result of this code I expected to see sound pressure as function of time. In contrast I see a lot of strange, mysterious symbols (which are not hexadecimal numbers). Can anybody, pleas, help me with that?

Java Program to create a PNG waveform for an audio file

喜欢而已 提交于 2019-11-26 12:43:49
问题 How can you convert a Wav file into a PNG waveform image file using Java? java MyProgram.class [path to wav file] [path where to write png file] Expected results: Png saved in path specified is a waveform of the wav file passed in. 回答1: Below is a java class that will do this very thing. There are certain parameters that I'm hard coding here like width of image, height of image, background color of image, and some more stuff. If you want to pull those out, you could. import java.awt

Trouble playing wav in Java

笑着哭i 提交于 2019-11-26 12:27:22
问题 I\'m trying to play a PCM_UNSIGNED 11025.0 Hz, 8 bit, mono, 1 bytes/frame file as described here (1) and here(2). The first approach works, but I don\'t want to depend on sun.* stuff. The second results in just some leading frames being played, that sounds more like a click. Can\'t be an IO issue as I\'m playing from a ByteArrayInputStream. Plz share your ideas on why might this happen. TIA. 回答1: I'm not sure why the second approach you linked to starts another thread; I believe the audio

Reading wav file in Java

南笙酒味 提交于 2019-11-26 12:19:28
问题 I want to read wav files in Java and I am going to classify them with K-means. How can I read wav files in Java and assign them into an array or something like that(you can suggest ideas for it) to classify them? EDIT: I want to use APIs for reading wav files and for K-means. 回答1: This article by A Greensted: Reading and Writing Wav Files in java should be helpful. The WavFile class is very useful and it can be tweaked to return the entire data array instead of buffered fragments. 回答2:

Writing PCM recorded data into a .wav file (java android)

此生再无相见时 提交于 2019-11-26 12:05:40
问题 I\'m using AudioRecord to record 16 bit PCM data in android. After recording the data and saving it to a file, I read it back to save it as .wav file. The problem is that the WAV files are recognized by media players but play nothing but pure noise. My best guess at the moment is that my wav file headers are incorrect but I have been unable to see what exactly the problem is. (I think this because I can play the raw PCM data that I recorded in Audacity) Here\'s my code for reading the raw PCM

Play multiple sounds using SoundPlayer

依然范特西╮ 提交于 2019-11-26 11:31:10
问题 I\'m making a sampler program where each key from 1 to 9 will make a different sound. Everything works fine, but when I press two (or more) sounds at the same time, the second one \"kills\" the first one. I\'m playing the sounds from .WAV files, using SoundPlayer . How can I solve this? 回答1: You'll need to use DirectX (DirectSound) or some similar API that is designed to allow the playing of multiple sounds at the same time. 回答2: There is one simple way to play multiple sounds at once in C#

How to join 2 or more .WAV files together programmatically?

坚强是说给别人听的谎言 提交于 2019-11-26 10:59:11
问题 I need the ability to join 2 or more .wav files together in to one .wav file. I must do this programmatically, using C# (3rd-party products are not an option). I know of the System.Media.SoundPlayer class, but I am not looking to play the the .wav, but only to create it. 回答1: Here's a basic WAV concatenation function built using NAudio. This will ensure that only the data chunks are concatenated (unlike the code example in this CodeProject article linked in another answer). It will also

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

时光总嘲笑我的痴心妄想 提交于 2019-11-26 10:22:31
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 generated audio data. So my question is, is there a standard Android API for encoding audio? If not, what pure

How to join two wav files using python?

最后都变了- 提交于 2019-11-26 05:28:43
问题 I am using python programming language,I want to join to wav file one at the end of other wav file? I have a Question in the forum which suggest how to merge two wav file i.e add the contents of one wav file at certain offset,but i want to join two wav file at the end of each other... And also i had a prob playing the my own wav file,using winsound module..I was able to play the sound but using the time.sleep for certain time before playin any windows sound,disadvantage wit this is if i

Java - reading, manipulating and writing WAV files

牧云@^-^@ 提交于 2019-11-26 04:25:11
问题 In a Java program, what is the best way to read an audio file (WAV file) to an array of numbers ( float[] , short[] , ...), and to write a WAV file from an array of numbers? 回答1: I read WAV files via an AudioInputStream . The following snippet from the Java Sound Tutorials works well. 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