wav

Play .mp3 in Java

此生再无相见时 提交于 2019-12-13 04:24:16
问题 I know this question has already been asked on this site before, but my question deviates from it a little. I want to play a .mp3 file without using external Java libraries such as javafx . Is this possible, and if so, how do you do it? I have nothing against the library javafx , I just want to know for educational purposes. I know that with the javax libraries you can play .wav files quite easily. public void playSound() { try { AudioInputStream audioInputStream = AudioSystem

Error while playing sound in Java

萝らか妹 提交于 2019-12-13 04:04:12
问题 I'm trying to play a sound in my Java Application, but every time I call the method I get this exception: javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 48000.0 Hz, 24 bit, mono, 3 bytes/frame, little-endian not supported. Here's the code: AudioInputStream audio = AudioSystem.getAudioInputStream(new File("src/media/ding2.wav")); Clip clip = AudioSystem.getClip(); clip.open(audio); clip.start(); I tried to play a file by passing a URL and it works fine, but with my

How to load a Wav file in an Array in C++?

China☆狼群 提交于 2019-12-13 03:58:20
问题 Hey I've a dynamic array and I want to load to this array the data of my Wav file, I already wrote the beginning but I can't figure it out how to load the file in my dynamic array, can somebody help me further with this code? #include <iostream> using namespace std; template <typename T> class Array{ public: int size; T *arr; Array(int s){ size = s; arr = new T[size]; } T& operator[](int index) { if (index > size) resize(index); return arr[index]; } void resize(int newSize) { T* newArray =

Concatenate wave files at 5 second intervals

血红的双手。 提交于 2019-12-13 03:12:27
问题 I have a series of wave files with individual words, each lasting about 1 second. I want to use C# to concatenate them to one large file at exactly five second intervals. This will save me from having to put the big file through a sound editor and record the start times for each word. I know how to concatenate files using NAudio and WaveFileWriter.write. Is there a way to either insert a silence for a certain length of time, or to actually append one file at a certain point in a file? I

Could not create AudioData object?

你离开我真会死。 提交于 2019-12-13 02:31:17
问题 I have a problem with my code where each time I run the project, this is thrown. Now I have narrowed it down to that the sound does play when I call the play() method but does not when I call the playL() method. package net.chrypthic.Ball; import sun.audio.*; import java.io.*; public class SoundManager { AudioPlayer ap = AudioPlayer.player; AudioStream as; ContinuousAudioDataStream loop = null; public SoundManager(String music) { try { InputStream input = new FileInputStream("./"+music); as =

Convert Amplitude BACK to .wav file (C#)

孤者浪人 提交于 2019-12-13 01:53:59
问题 What I have done is converted a wave file to amplitude values in a short[] array as found here Mean amplitude of a .wav in C# I modified the values and now want to convert back to .wav format or a byte[] array which when can be written to a byte file. 回答1: void SetShortToBuffer(short val,byte[] outArray,int Offset) { outArray[Offset] = (byte)(val & 0x00FF); Offset++; outArray[Offset] = (byte)((val >> 8) & 0x00FF); } byte[] ConvertShortArray(short[] Data,int Offset,int Count) { byte[] helper =

error in reading a wav file with C++

混江龙づ霸主 提交于 2019-12-13 01:50:06
问题 I have a .wav file and I want to read it in C++. I have done some research on the RIFF file header and wrote a code to load it. #include <iostream> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> using namespace std; #define BUFFER_LEN 4096 int main(int argc,char * argv[]) { // Buffers etc.. char ChunkID[4], Format[4], Subchunk1ID[4],Subchunk2ID[4]; int ChunkSize,Subchunk1Size, SampleRate, ByteRate,Subchunk2Size; short AudioFormat, NumChannels, BlockAlign,

How to decode RTP packets and save it has .wav file

↘锁芯ラ 提交于 2019-12-12 21:25:25
问题 I am trying to develop an application in which a sip call is established and then i am capturing rtp audio packets. As they are encoded so i need to decode them and save it has .wav file. Tried using NAudio but didnt worked. Is there any solution using NAudio or any other source to solve this problem... the code i used is as follow. data is the byte array in which rtp packet data is. System.IO.MemoryStream stream = new System.IO.MemoryStream(data); RawSourceWaveStream rsws = new

AcmNotPossible calling acmStreamOpen, naudio

别说谁变了你拦得住时间么 提交于 2019-12-12 20:03:47
问题 I am trying to convert a PCM S16 LE (araw) Mono, Sample rate 22050, Bit pr. sample 16 to PCM mulaw (PCM MU-LAW) Mono, Sample rate 8000hz, Bit pr. sample is 8. WaveFormat.CreateMuLawFormat(8000,1) or even a more generic WaveFormat.CreateCustomFormat where I have specified the same WaveFormatEncoding as the source stream is throwing the same exception. AcmNotPossible calling acmStreamOpen Am I missing something here? Any leads will be greatly appreciated. 回答1: The ACM mu-law encoder expects its

What is a good tool for programmatically playing multiple audio files at the same time in C# [closed]

不想你离开。 提交于 2019-12-12 18:31:37
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . I need something that will allow my program to play several audio files (.wav and/or .mp3) at the same time. It would be ideal if I