javasound

how do i change volume of Clip that is playing in loop?

大城市里の小女人 提交于 2020-06-08 06:18:48
问题 I am wrecking my brain on how to change the volume of a Clip that is already playing in loop mode. The code I currently have is: Clip c = currentSound.getClip(); FloatControl gainControl = (FloatControl) c.getControl(FloatControl.Type.MASTER_GAIN); gainControl.setValue(-10.0f); currentSound.loop(loopCount); Is my assumption that once the loop starts, the volume cannot be changed, true? 回答1: Is my assumption that once the loop starts, the volume cannot be changed, true? No. A Clip volume can

JavaSound: Detect device change

不羁的心 提交于 2020-01-24 19:20:29
问题 Folks, I am working on an applet that captures audio from the local computer and streams it up to the server. I am using a Java applet that currently hooks onto the default device and performs the upstream. Things are running well. I now want to extend the functionality to allow users to choose the audio input device and to also show a sound level indicator of the chosen device in the web page. I wrote a multithreaded utility that would do AudioSystem.getMixerInfo(); periodically and look for

TarsosDSP Pitch Analysis for Dummies

我是研究僧i 提交于 2020-01-22 09:53:07
问题 I am woking on a progarm that analyze the pitch of a sound file. I came across a very good API called "TarsosDSP" which offers various pitch analysis. However I am experiencing a lot of trouble setting it up. Can someone show me some quick pointers on how to use this API (espically the PitchProcessor class) please? Some snippets of code would be extremely appreciated because I am really new at sound analysis. Thanks EDIT: I found some document at http://husk.eecs.berkeley.edu/courses/cs160

Java sound class not looping [closed]

冷暖自知 提交于 2020-01-17 14:04:13
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I'm trying to develop a game and I've found 2 sources for sound. I posted the whole class below, it won't seem to loop even when looped_forever or loop_times is setup to do so: package com.jayitinc.ponygame;

Java sound class not looping [closed]

痞子三分冷 提交于 2020-01-17 14:03:44
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I'm trying to develop a game and I've found 2 sources for sound. I posted the whole class below, it won't seem to loop even when looped_forever or loop_times is setup to do so: package com.jayitinc.ponygame;

How to extract audio from a video file and make it as JavaSound AudioInputStream?

浪子不回头ぞ 提交于 2020-01-17 03:23:09
问题 I know JMF needs to be used to deal with video, but the JMF api is very confusing and difficult to understand. I saw something like this but what I want to do is the opposite I think. 回答1: Problem solved. Xuggler is needed for doing the above operation. JMF is useless except for playing videos. 来源: https://stackoverflow.com/questions/2712855/how-to-extract-audio-from-a-video-file-and-make-it-as-javasound-audioinputstream

How can i send a Midi Message to a specific Midi Port

孤街浪徒 提交于 2020-01-16 18:59:48
问题 I want to send Note_On Message to a virtual Midi Interface called LoopBe (Link to Site). How do i get the Receiver object (Java)? I tried the Code below but I get a NullPointerException on rcvr.send() . public class test { public static Receiver rcvr; public static void main(String[] args) throws InvalidMidiDataException, MidiUnavailableException { String scene = "Test"; getReceiver(); ShortMessage myMsg = new ShortMessage(); // Nachricht Channel Note Lautstärke myMsg.setMessage(ShortMessage

How to calculate FrameLength without using AudioSystem?

匆匆过客 提交于 2020-01-16 18:03:30
问题 I'm porting Java project to Android. As you know, the Android does not have javax.sound package. I need to calculate frameLength. My sound file size is 283KB. And frame size is 4 and frame rate is 44100 and sample size in bits is 16. The frame length was 69632 when I used just pure Java. Do you know any equation to get this? Thank you. 回答1: For the raw PCM data, basically, you have 4 bytes per sample. ((283 KB) * (1024 bytes per KB)) / (4 bytes per frame) ==> 72448 But a wav can include a lot

Looping sound Java

末鹿安然 提交于 2020-01-16 10:54:46
问题 I am using a class that I cobbled together myself based on a sound playing method and then some custom code. The only problem is that I'm not 100% sure how the while loop that copies to the output stream in the playSoundFile() method works. I would be extremely grateful for a quick explanation of it, as well as any suggestions on how to set it up to loop (preferably without setting up a timer to repeatedly call it at the length of the sound file) 'My' Code: import java.io.File; import javax