Ticket #269 (new enhancement)

Opened 12 years ago

Last modified 12 years ago

Automated Volume Adjuster

Reported by: kmaclean Owned by: kmaclean
Priority: major Milestone: SpeechSubmission 0.1.10
Component: SpeechSubmission Version: SpeechSubmission 0.1
Keywords: Cc:

Description (last modified by kmaclean) (diff)

Allow users to speak in to their microphone and the system automatically adjust their volume

Change History

comment:2 Changed 12 years ago by kmaclean

  • Description modified (diff)

The Java Sound API

The javax.sound.sampled package is fundamentally concerned with audio transport — in other words, the Java Sound API focuses on playback and capture. The central task that the Java Sound API addresses is how to move bytes of formatted audio data into and out of the system.

Processing Audio with Controls - Sun Java Tutorial

From the tutorial:

Changing a Line's Volume

Let's assume your program associates a particular graphic slider with a particular line's volume control. The value of a volume control (i.e., FloatControl.Type.VOLUME) is set using the following FloatControl method:

void setValue(float newValue)

comment:3 Changed 12 years ago by kmaclean

javax.sound.sampled

This package specifies interfaces for capture, mixing, and playback of digital (sampled) audio.

There are other Java platform APIs that also have sound-related elements:

Java Media Framework API (JMF) - is a higher-level API that is currently available as a Standard Extension to the Java platform (i.e. not included with JRE!)

comment:4 Changed 12 years ago by kmaclean

From Sun Java Tutorial The javax.sound.sampled.spi package contain APIs that let software developers create new audio resources that can be provided separately to the user and "plugged in" to an existing implementation of the Java Sound API, Examples:

  • An audio mixer
  • A file parser that can read or write a new type of audio file
  • A converter that translates between different sound data formats

comment:5 Changed 12 years ago by kmaclean

  • Milestone changed from SpeechSubmission 0.1.3 to SpeechSubmission 0.1.2

comment:7 Changed 12 years ago by kmaclean

BaseAudioStream.java has some code to set speaker volume

comment:8 Changed 12 years ago by kmaclean

Javascript Audio Jukebox with volume controls

comment:10 Changed 12 years ago by kmaclean

comment:14 Changed 12 years ago by kmaclean

From JavaTM 1.6 Sound Programmer Guide

Changing a Line's Volume

Let's assume your program associates a particular graphic slider with a particular line's volume control. The value of a volume control (i.e., FloatControl?.Type.VOLUME) is set using the following FloatControl? method:

    void setValue(float newValue)

Detecting that the user moved the slider, the program gets the slider's current value and passes it, as the parameter newValue, to the method above. This changes the volume of the signal flowing though the line that "owns" the control.

From tutorials:

SourceDataLine line;
FloatControl control = (FloatControl) line.getControl(FloatControl.Type.VOLUME);
control.setValue(...);

comment:15 Changed 12 years ago by kmaclean

e730. Setting the Volume of a Sampled Audio Player

   // Set Volume
    FloatControl gainControl = (FloatControl)clip.getControl(FloatControl.Type.MASTER_GAIN);
    double gain = .5D;    // number between 0 and 1 (loudest)
    float dB = (float)(Math.log(gain)/Math.log(10.0)*20.0);
    gainControl.setValue(dB);

comment:16 Changed 12 years ago by kmaclean

Java Sound Resources: Applications: Chat

This application allows you to do voice chat. It originates from a session at Java One 2004.

comment:17 Changed 12 years ago by kmaclean

comment:18 Changed 12 years ago by kmaclean

Minim - Minim is a Java audio library. Minim is a class in the library that contains a bunch of static methods that you can call to get audio resources from the system.

comment:19 Changed 12 years ago by kmaclean

Minim:

public class Controller extends java.lang.Object

Controller is the base class of all Minim classes that deal with audio I/O. It provides control over the underlying DataLine?, which is a low-level JavaSound class that talks directly to the audio hardware of the computer. This means that you can make changes to the audio without having to manipulate the samples directly. The downside to this is that when outputting sound to the system (such as with an AudioOutput?), these changes will not be present in the samples made available to your program.

The volume(), gain(), pan(), and balance() methods return objects of type FloatControl?, which is a class defined by the JavaSound API.

comment:20 Changed 12 years ago by kmaclean

From What are all these mixers? (jsresources.org)

There are several implementations of Mixer in Java Sound:

"Java Sound Audio Engine"

This is a software mixing engine. It provides SourceDataLine? and Clip instances. It does not provide TargetDataLine? instances. Output of this mixer goes to the audio device.

Simple Input Devices, "Microsoft Sound Mapper" (Windows), "Linux,dev/dsp,multi threaded" (Linux), "Linux,dev/audio,multi threaded" (Linux, Solaris)

In versions 1.4.2 and earlier, this mixer is used for recording. It provides TargetDataLine? instances, but nothing else. In 1.5, it is no longer available, because the direct audio devices can be used for recording on all platforms.

Direct Audio Devices, "Primary Sound Driver" (Windows), "Primary Sound Capture Driver" (Windows), "Soundcard [plughw:0,0]" (Linux)

These are mixers that can be used for playback as well as for recording. They provide SourceDataLine?, TargetDataLine? and Clip instances. In 1.4.2, they became available on Linux; in 1.5, Solaris and Windows followed. These mixers allow simultaneous playback and recording (full-duplex) if the soundcard supports it.

Port Mixers, "Port Soundcard" (Windows), "Port Soundcard [hw:0,0]" (Linux)

These mixers provide Port instances, but no other type of Line. So you can't play back or record with these mixers. They became available with 1.4.2 for Windows, and will be available for Solaris and Linux, too, in 1.5. See also Ports

comment:22 Changed 12 years ago by kmaclean

comment:23 Changed 12 years ago by kmaclean

Comparison of JSyn and JavaSonics' ListenUp

JSyn

  • Supports basic read/write streaming from audio devices or a synthesis modules.
  • Extensive library of oscillators, filters, envelopes and other music and audio unit generators.

JavaSonics:

  • ListenUp? can record your users' voice message, play back the recording,

and then upload the recording to your web server.

  • Supports read/write streaming from audio devices. Streams have individual sampleRate, pan, and volume controls.

comment:25 Changed 12 years ago by kmaclean

see SpeechLion:

v0.2.1: ... Added volume control commands.

comment:26 Changed 12 years ago by kmaclean

  • Milestone changed from SpeechSubmission 0.1.5 to SpeechSubmission 0.1.7
Note: See TracTickets for help on using tickets.