Questions tagged [java-audio]

24 questions
8
votes
2 answers

Define GOOGLE_APPLICATION_CREDENTIALS for google-cloud-speech , Java Desktop Application

I am completely new using google-cloud-java. Trying to do some Speech Recognition using the google-cloud-speech . I have written the below code , but there is a problem , i don't know how to specify the credentials so i get the below error, no clue…
GOXR3PLUS
  • 6,877
  • 9
  • 44
  • 93
3
votes
1 answer

Exactly synchronize AudioRecord and AudioTrack in Android

I am trying to Record PCM data using AudioRecord and save them to a .wav file. (Done) Later on record another PCM file while playing the previously recorded file Save the new recording to another file Mix (overlay) the first and the new…
fameman
  • 3,451
  • 1
  • 19
  • 31
2
votes
2 answers

How to turn a PCM byte array into little-endian and mono?

I'm trying to feed audio from an online communication app into the Vosk speech recognition API. The audio comes in form of a byte array and with this audio format PCM_SIGNED 48000.0 Hz, 16 bit, stereo, 4 bytes/frame, big-endian. In order to be able…
moeux
  • 191
  • 15
2
votes
2 answers

Why is my music not stopping when I pick a new song?

I am making a program in Java where every time the user press a button on the keyboard, a song would be played. However, when I test this out, pressing the keys made the songs played on top of each other instead of stopping one before playing the…
Hang Pham
  • 23
  • 3
1
vote
1 answer

Making audio player in Codename One

I am porting a java game to mobile using Codename One, and have been trying to make an audio player with the framework using code from another thread. I'm running into lots of trouble doing so, mainly with using the MediaManager. Here is the…
1
vote
0 answers

I have an old sound class and I want to change it from using applet.AudioClip to something modern so I can alter volume. How would I do this?

I'm developing a game in java with some cutesy little 8-bit sfx and I have this incredibly old sound class from 2011 made by notch. It's a good sound class, the only problem is that I can not change the volume of the sounds in it, I have tried…
Zeeen
  • 312
  • 1
  • 2
  • 13
1
vote
0 answers

No sound using AudioClip but no error occuring

I have to get a .wav clip working for a college assignment on Java using the AudioClip and Applet. When I use the code seen below, I get no errors, even with the use of a try-catch. Not really sure where I have gone wrong, but any help would be much…
user10680092
1
vote
0 answers

JavaFX Audio File Pathing

https://i.stack.imgur.com/r7npI.jpg it will leed to my problems I just want to play some audio files, when some action in the program happens. The problem is that my team and I have different structures of folders after cloning the repo. For me I…
CptDayDreamer
  • 1,526
  • 6
  • 25
  • 61
1
vote
2 answers

Java Audio SourceDataLine does not support PCM_FLOAT

I am trying to play a buffer of audio using Java on Linux. I am getting the following exception when attempting to open the line (not when I write the audio to it)... Exception in thread "main" java.lang.IllegalArgumentException: No line matching…
Scorb
  • 1,654
  • 13
  • 70
  • 144
1
vote
0 answers

Playing multiple instruments on a soft synth simultaneoulsy in java

I've been trying to play more than 1 instrument on a soft synthesizer using the javax.sound.midi. package. Among the the 16 channels available with the synthesizer I tried using two of them in this manner. try { // Locating the default…
BitWriter
  • 35
  • 7
0
votes
1 answer

Thread not finishing - Sound Event Dispatcher Java

I am creating a game in Java and I am trying to implement music playing but I am running into issues ending the program. The primary hierarchy of my program is 3 classes I have written; InputHandler, GameState, and Map. The InputHandler contains a…
0
votes
0 answers

How to get duration in millisecond of a m4a file in java?

I want to get duration in millisecond of a m4a file in java, how to do this ? I tried code below public static long getAudioLength(File file) throws IOException, UnsupportedAudioFileException { AudioFileFormat fileFormat =…
djy
  • 737
  • 6
  • 14
0
votes
0 answers

Audio Input Stream To IVR supported WAV file [JAVA]

I want to convert audio InputStream to wav file format in java. Require format is : mu-law 8000 Hz 64 kbps Mono I am using the following method for the conversion but generated audio file is corrupted. public static void getWavFile(String filePath,…
Mr Freak
  • 216
  • 3
  • 20
0
votes
1 answer

NegativeArraySizeException when printing String

Currenty, I am working on a text-to-speech program, and I recently added threads to play the sound. I've found that when enough threads are made, the GUI console no longer prints out and a "NegativeArraySizeException" is printed out in the Eclipse…
N3ther
  • 76
  • 1
  • 10
0
votes
1 answer

Manipulate consecutive sound files in java

What i'm trying to do is making a piano song with individual sound files for the piano claps. I did a version of it in javascript, with WebAudioAPI, using an oscillator instead of audio files. Here's a part of the code out of context: var ctx = new…
1
2