EzDevInfo.com

mixer

Mixer -- Is a fixtures replacement. Supported Django, Flask, SqlAlchemy and custom python objects.

Working with audio in Java

I went over Java's tutorial on sounds but somehow it is way too complex for a beginner.
It is here
My aim is this:

  • Detect all the audio input and output devices
  • let the user select a audio input device
  • capture what the user says
  • output it to the default audio output device
  • Now how do I go about doing that?
    Is there a better tutorial available?
    What I have tried:

    import javax.sound.sampled.*;
    public class SoundTrial {
        public static void main(String[] args) {
            Mixer.Info[] info = AudioSystem.getMixerInfo();
            int i =0;
            for(Mixer.Info print : info){
    
                System.out.println("Name: "+ i + " " + print.getName());
                i++;
            }
        }
    }  
    

    output:

    Name: 0 Primary Sound Driver
    Name: 1 Speakers and Headphones (IDT High Definition Audio CODEC)
    Name: 2 Independent Headphones (IDT High Definition Audio CODEC
    Name: 3 SPDIF (Digital Out via HP Dock) (IDT High Definition Audio CODEC)
    Name: 4 Primary Sound Capture Driver
    Name: 5 Integrated Microphone Array (ID
    Name: 6 Microphone (IDT High Definition
    Name: 7 Stereo Mix (IDT High Definition
    Name: 8 Port Speakers and Headphones (IDT Hi
    Name: 9 Port SPDIF (Digital Out via HP Dock)
    Name: 10 Port Integrated Microphone Array (ID
    Name: 11 Port Microphone (IDT High Definition
    Name: 12 Port Stereo Mix (IDT High Definition
    Name: 13 Port Independent Headphones (IDT Hi
    

    Source: (StackOverflow)

    How do I speed up the loading of Audio files so the user is not waiting.

    I am building a game that lets users remix songs. I have built a mixer (based upon the apple sample code MixerHost (creating an audioGraph with a mixer audioUnit), but expanded to load 12 tracks. everything is working fine, however it takes a really long time for the songs to load when the gamer selects the songs they want to remix. This is because the program has to load 12 separate mp4 files into memory before I can start playing the music.

    I think what I need is to create a AUFilePlayer audioUnit that is in charge of loading the file into the mixer. If the AUFilePlayer can handle loading the file on the fly then the user will not have to wait for the files to load 100% into memory. My two questions are, 1. can an AUFilePlayer be used this way? 2. The documentation on AUFilePlayer is very very very thin. Where can I find some example code demonstrated how to implement a AUFilePlayer properly in IOS (not in MacOS)?

    Thanks


    Source: (StackOverflow)

    Advertisements

    Audio Mixing with Java (without Mixer API)

    I am attempting to mix several different audio streams and trying to get them to play at the same time instead of one-at-a-time.

    The code below plays them one-at-a-time and I cannot figure out a solution that does not use the Java Mixer API. Unfortunately, my audio card does not support synchronization using the Mixer API and I am forced to figure out a way to do it through code.

    Please advise.

    /////CODE IS BELOW////

    class MixerProgram {
    public static AudioFormat monoFormat;
    private JFileChooser fileChooser = new JFileChooser(); 
    private static File[] files;
    private int trackCount;   
    private FileInputStream[] fileStreams = new FileInputStream[trackCount];
    public static AudioInputStream[] audioInputStream;
    private Thread trackThread[] = new Thread[trackCount];
    private static DataLine.Info sourceDataLineInfo = null; 
    private static SourceDataLine[] sourceLine;  
    
    public MixerProgram(String[] s)
    {
      trackCount = s.length;
      sourceLine = new SourceDataLine[trackCount];
      audioInputStream = new AudioInputStream[trackCount]; 
      files = new File[s.length];
    }
    
    public static void getFiles(String[] s)
    {
      files = new File[s.length];
      for(int i=0; i<s.length;i++)
      {
        File f = new File(s[i]);
        if (!f.exists()) 
        System.err.println("Wave file not found: " + filename);
        files[i] = f;
      }
    }
    
    
    public static void loadAudioFiles(String[] s) 
    {
      AudioInputStream in = null;
      audioInputStream = new AudioInputStream[s.length];
      sourceLine = new SourceDataLine[s.length];
      for(int i=0;i<s.length;i++){
        try 
        {
          in = AudioSystem.getAudioInputStream(files[i]); 
        } 
        catch(Exception e) 
        {
          System.err.println("Failed to assign audioInputStream");
        }
        monoFormat = in.getFormat();
        AudioFormat decodedFormat = new AudioFormat(
                                                  AudioFormat.Encoding.PCM_SIGNED,
                                                  monoFormat.getSampleRate(), 16, monoFormat.getChannels(),
                                                  monoFormat.getChannels() * 2, monoFormat.getSampleRate(),
                                                  false);
      monoFormat = decodedFormat; //give back name
      audioInputStream[i] = AudioSystem.getAudioInputStream(decodedFormat, in);
      sourceDataLineInfo = new DataLine.Info(SourceDataLine.class, monoFormat);
      try 
      {
        sourceLine[i] = (SourceDataLine) AudioSystem.getLine(sourceDataLineInfo); 
        sourceLine[i].open(monoFormat);
      } 
      catch(LineUnavailableException e) 
      {
        System.err.println("Failed to get SourceDataLine" + e);
      }
    }               
    }
    
    public static void playAudioMix(String[] s)
    {
      final int tracks = s.length;
      System.out.println(tracks);
      Runnable playAudioMixRunner = new Runnable()
      {
        int bufferSize = (int) monoFormat.getSampleRate() * monoFormat.getFrameSize();
        byte[] buffer = new byte[bufferSize]; 
        public void run()
        {
          if(tracks==0)
            return;
          for(int i = 0; i < tracks; i++)
          {
            sourceLine[i].start();
          }        
          int bytesRead = 0;
          while(bytesRead != -1)
          {
            for(int i = 0; i < tracks; i++)
            {
              try 
              {
                bytesRead = audioInputStream[i].read(buffer, 0, buffer.length);
              } 
              catch (IOException e) {
              // TODO Auto-generated catch block
                e.printStackTrace();
              }            
              if(bytesRead >= 0)
              {
                int bytesWritten = sourceLine[i].write(buffer, 0, bytesRead);
                System.out.println(bytesWritten);
              }
            }
          }
        }
      };
      Thread playThread = new Thread(playAudioMixRunner);
      playThread.start();
    }
    }
    

    Source: (StackOverflow)

    How to emulate/replace/re-enable classical Sound Mixer controls (or commands) in Windows Vista?

    I have a problem (and have been having it for some time now) -- the new sound mixer stack in Vista features new cool things, but also re-invents the wheel. Many applications that used to use Volume Mixer on a Windows system to mix different voiced outputs into one input (for example Wave-out + Line-in --> Stereo Mix) have since stopped working. The prime example of this behavior is the Shoutcast DSP plugin (could be useful for solution testing).

    How Can I re-enable XP-mixer controls, or maybe emulate this behavior somehow, so that the program (SC DSP) can properly manage Microphone/Line-In playback volume along with Wave-out playback volume?

    My thinking would be to emulate a program hooked-in into the Vista Mixer for Wave-Out and Line-out (or Mic speaker volume -- all playback, shown as separate adjustable "programs" so that the Vista Mixer could refer to it) and 'hook' it into the system under some emulation representing itself as the old volume mixer control interface for the program, but I frankly have no idea how to do that.

    To clarify: this is not my PC (it is a HP Pavilion laptop). The problem seems to exist mostly due to the fact that Vista mixer controls separate programs, not separate inputs/outputs. The hardware is fully capable of doing what is needed when using Windows XP. I am well aware of the fact that this is a driver issue, but the driver is simply prepared for what Vista presents to the programmer through interfaces. The mixer device - as seen in the operating system, however it might look in software - is based on the mixer APIs for Windows Audio control.

    Search using Google on Vista and line-in playback volume control for more info on the problem (and the sheer amount of users affected by it). Of course, a re-write of the Shoutcast Source DSP plug-in for WinAMP would do the trick, but that is not likely to happen...


    Source: (StackOverflow)

    iPhone SDK Audio Mixer

    What I need to do is be able to mix 4 channels of audio (not from a live source, just prerecorded audio files in the app bundle), and change their volumes individually, in real time, preferably with MP3s. What's the best/correct road for me to take, regarding all the various sound APIs for the iPhone?

    Thanks!


    Source: (StackOverflow)

    how to mix two audio channels?

    I have two mono audio channels (pcm format) of audio call, incoming and outgoing. how to mix them? how to position them in space? (e.g. incoming channel sounds slightly on the left and outgoing on the right)


    Source: (StackOverflow)

    Why doesn't my PyGame mixer play sounds,?

    My PyGame mixer in 2.7 won't work with the sound option. I can make it work with mixer.music but not with mixer.sound, with mixer.sound it makes a small ticking noise and then stops. Code:

    import pygame
    pygame.mixer.init(frequency=22050, size=-16, channels=2, buffer=4096)
    song = pygame.mixer.Sound("song.mp3")
    pygame.mixer.Sound.play(song)
    

    No error, it just won't play and gives a small ticking noise. On windows 7-x64 btw.


    Source: (StackOverflow)

    YouTube Autosuggest API - where to find samples or documentation?

    I want to create a YouTube video search box with the same autocomplete feature. Any idea where can I find samples or and documentation?

    Thanks


    Source: (StackOverflow)

    Simple code for playing music in pygame doesn't work

    So I've looked a lot how to play a sound in pygame. The code underneath is how far I got. But when I run it there is no error code but also , nothing actually happens. Can somebody please tell me what to change or what code actually works? I've researched a lot but nothing helped.

    import pygame
    
    pygame.init()
    pygame.mixer.music.load('file')
    pygame.mixer.music.play()
    pygame.quit()
    

    Source: (StackOverflow)

    iOS 3D mixer works in iOS 5+ but not in iOS 4.3

    I've set up a kAudioUnitSubType_AU3DMixerEmbedded as part of a functional AUGraph. I've set the output ASBD of the mixer to the following:

    Sample Rate:              44100
    Format ID:                 lpcm
    Format Flags:                 C // (kAudioFormatFlagIsSignedInteger | kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked)
    Frames per Packet:            1
    Channels per Frame:           2
    Bits per Channel:            16
    Bytes per Packet:             4
    Bytes per Frame:              4
    

    This audio graph works great when running on iOS 5+, but on iOS 4.3, it outputs really weird distorted sounds that sound nothing like the inputs. To better understand this, I only used one mixer input and compared the input bytes versus the output bytes. On iOS 5+, the input and output bytes were identical, as you would expect. However, on iOS 4.3, the output bytes are different. Even when I'm inputting in all 0s to the mixer (0x0000, 0x0000, ...) , the output bytes are printing out as a stream of 0x8000 0x8000.

    Does anyone have any idea why the 3D mixer behaves strangely on iOS 4.3?


    Source: (StackOverflow)

    mixing two audio file using mixer

    how can i mix two audio files into one file so that the resultant file can play two files simultaneously? please help.. here what i am doing is that i am taking two files and concat them into another file.. but i want the file to be played simultaneously..

        private void saveAudio1() {
        try {                                      
    
            AudioInputStream clip1 = AudioSystem.getAudioInputStream(file1);
            AudioInputStream clip2 = AudioSystem.getAudioInputStream(file2);
            Collection list=new ArrayList();
    
            AudioInputStream appendedFiles =
                    new AudioInputStream(
                    new SequenceInputStream(clip1, clip2),
                    clip1.getFormat(),
                    clip1.getFrameLength() + clip2.getFrameLength());
            if (dlgOpenFile == null) {
                dlgOpenFile = new FileDialog(this, "Save As...", FileDialog.SAVE);
            }
            if (cfgJMApps != null) {
                nameFile = cfgJMApps.getLastOpenFile();
            }
            if (nameFile != null) {
                dlgOpenFile.setFile(nameFile);
            }
    
            dlgOpenFile.show();
            nameFile = dlgOpenFile.getFile();
            if (nameFile == null) {
                return;
            }
    
            nameFile = dlgOpenFile.getDirectory() + nameFile;
            if (cfgJMApps != null) {
                cfgJMApps.setLastOpenFile(nameFile);
            }
    
    
            AudioSystem.write(appendedFiles,
                    AudioFileFormat.Type.WAVE,
                    new File(nameFile));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    

    Source: (StackOverflow)

    Android: How to configure "tinymix" to record system audio with "tinycap"

    in Android it's currently impossible to record system-audio with the Android-SDK.

    Therefore I played around a bit with TinyALSA (since Android 4) and hope I can reroute the audio-out so I can record it.

    When I call "tinymix" on my device I get following configuration:

    ctl     type    num     name                                     value
    0       ENUM    1       DL1 Equalizer                            Flat response
    1       ENUM    1       DL2 Left Equalizer                       450Hz High-pass
    2       ENUM    1       DL2 Right Equalizer                      450Hz High-pass
    3       ENUM    1       Sidetone Equalizer                       Flat response
    4       ENUM    1       AMIC Equalizer                           High-pass 0dB
    5       ENUM    1       DMIC Equalizer                           High-pass 0dB
    6       INT     1       DL1 Media Playback Volume                120
    7       INT     1       DL1 Tones Playback Volume                0
    8       INT     1       DL1 Voice Playback Volume                120
    9       INT     1       DL1 Capture Playback Volume              0
    10      INT     1       DL2 Media Playback Volume                120
    11      INT     1       DL2 Tones Playback Volume                0
    12      INT     1       DL2 Voice Playback Volume                120
    13      INT     1       DL2 Capture Playback Volume              0
    14      INT     1       VXREC Media Volume                       0
    15      INT     1       VXREC Tones Volume                       0
    16      INT     1       VXREC Voice DL Volume                    0
    17      INT     1       VXREC Voice UL Volume                    0
    18      INT     1       AUDUL Media Volume                       0
    19      INT     1       AUDUL Tones Volume                       0
    20      INT     1       AUDUL Voice UL Volume                    120
    21      INT     1       AUDUL Voice DL Volume                    0
    22      INT     1       SDT UL Volume                            103
    23      INT     1       SDT DL Volume                            120
    24      INT     2       DMIC1 UL Volume                          120 120
    25      INT     2       DMIC2 UL Volume                          120 120
    26      INT     2       DMIC3 UL Volume                          120 120
    27      INT     2       AMIC UL Volume                           120 120
    28      INT     2       BT UL Volume                             120 120
    29      BOOL    1       DL1 Mono Mixer                           Off
    30      BOOL    1       DL2 Mono Mixer                           On
    31      BOOL    1       AUDUL Mono Mixer                         Off
    32      BOOL    1       DL1 MM_EXT Switch                        Off
    33      BOOL    1       DL1 BT_VX Switch                         Off
    34      BOOL    1       DL1 PDM Switch                           Off
    35      BOOL    1       Sidetone Mixer Capture                   Off
    36      BOOL    1       Sidetone Mixer Playback                  On
    37      BOOL    1       Capture Mixer Tones                      Off
    38      BOOL    1       Capture Mixer Voice Playback             Off
    39      BOOL    1       Capture Mixer Voice Capture              Off
    40      BOOL    1       Capture Mixer Media Playback             Off
    41      BOOL    1       Voice Capture Mixer Tones Playback       Off
    42      BOOL    1       Voice Capture Mixer Media Playback       Off
    43      BOOL    1       Voice Capture Mixer Capture              Off
    44      BOOL    1       DL2 Mixer Tones                          Off
    45      BOOL    1       DL2 Mixer Voice                          Off
    46      BOOL    1       DL2 Mixer Capture                        Off
    47      BOOL    1       DL2 Mixer Multimedia                     On
    48      BOOL    1       DL1 Mixer Tones                          Off
    49      BOOL    1       DL1 Mixer Voice                          Off
    50      BOOL    1       DL1 Mixer Capture                        Off
    51      BOOL    1       DL1 Mixer Multimedia                     Off
    52      ENUM    1       MUX_VX1                                  None
    53      ENUM    1       MUX_VX0                                  None
    54      ENUM    1       MUX_UL11                                 None
    55      ENUM    1       MUX_UL10                                 None
    56      ENUM    1       MUX_UL07                                 None
    57      ENUM    1       MUX_UL06                                 None
    58      ENUM    1       MUX_UL05                                 None
    59      ENUM    1       MUX_UL04                                 None
    60      ENUM    1       MUX_UL03                                 None
    61      ENUM    1       MUX_UL02                                 None
    62      ENUM    1       MUX_UL01                                 None
    63      ENUM    1       MUX_UL00                                 None
    64      INT     2       Capture Preamplifier Volume              1 1
    65      INT     2       Capture Volume                           4 4
    66      INT     2       Aux FM Volume                            3 3
    67      INT     2       Headset Playback Volume                  9 9
    68      INT     2       Handsfree Playback Volume                27 27
    69      INT     1       Earphone Playback Volume                 11
    70      ENUM    1       Headset Power Mode                       High-Performance
    71      BOOL    1       Earphone Enable Switch                   Off
    72      ENUM    1       HS Right Playback                        Off
    73      ENUM    1       HS Left Playback                         Off
    74      ENUM    1       HF Right Playback                        Off
    75      ENUM    1       HF Left Playback                         Off
    76      ENUM    1       Analog Right Capture Route               Off
    77      ENUM    1       Analog Left Capture Route                Off
    78      ENUM    1       TWL6040 Power Mode                       Low-Power
    

    Does someone know which parameters I have to set so I can capture the playback (e.g. "multimedia") with "tinycap"?

    Sadly there's no documentation available.

    Kind regards, Martin M.


    Source: (StackOverflow)

    Can't set multiple musical instruments in iOS using MusicPlayer and AUGraph

    I have a MusicPlayer that holds a MusicSequence containing 3 MusicTracks. I have set up an AUGraph with 3 AUSampler Nodes plugged into a multichannel mixer, which in turn is connected to an output node.

    I am using a SoundFont, and would like my 3 different MusicTracks to play on 3 different musical instruments, as is described here. However, the code I've got doesn't work - instead, it plays only one of the parts.

    I create the AUGraph as follows:

    NewAUGraph (&_processingGraph);
    AUNode samplerNode, samplerNodeTwo, samplerNodeThree, ioNode, mixerNode;
    
    AudioComponentDescription cd = {};
    cd.componentManufacturer     = kAudioUnitManufacturer_Apple;
    
    //----------------------------------------
    // Add 3 Sampler unit nodes to the graph
    //----------------------------------------
    cd.componentType = kAudioUnitType_MusicDevice;
    cd.componentSubType = kAudioUnitSubType_Sampler;
    
    AUGraphAddNode (self.processingGraph, &cd, &samplerNode);
    AUGraphAddNode (self.processingGraph, &cd, &samplerNodeTwo);
    AUGraphAddNode (self.processingGraph, &cd, &samplerNodeThree);
    
    //-----------------------------------
    // 2. Add a Mixer unit node to the graph
    //-----------------------------------
    cd.componentType          = kAudioUnitType_Mixer;
    cd.componentSubType       = kAudioUnitSubType_MultiChannelMixer;
    
    AUGraphAddNode (self.processingGraph, &cd, &mixerNode);
    
    //--------------------------------------
    // 3. Add the Output unit node to the graph
    //--------------------------------------
    cd.componentType = kAudioUnitType_Output;
    cd.componentSubType = kAudioUnitSubType_RemoteIO;  // Output to speakers
    
    AUGraphAddNode (self.processingGraph, &cd, &ioNode);
    
    //---------------
    // Open the graph
    //---------------
    AUGraphOpen (self.processingGraph);
    
    //-----------------------------------------------------------
    // Obtain the mixer unit instance from its corresponding node
    //-----------------------------------------------------------
    AUGraphNodeInfo (
                                 self.processingGraph,
                                 mixerNode,
                                 NULL,
                                 &mixerUnit
                                 );
    
    //--------------------------------
    // Set the bus count for the mixer
    //--------------------------------
    UInt32 numBuses = 3;
    AudioUnitSetProperty(mixerUnit,
                                  kAudioUnitProperty_ElementCount,
                                  kAudioUnitScope_Input,
                                  0,
                                  &numBuses,
                                  sizeof(numBuses));
    
    
    
    //------------------
    // Connect the nodes
    //------------------
    
    AUGraphConnectNodeInput (self.processingGraph, samplerNode, 0, mixerNode, 0);
    AUGraphConnectNodeInput (self.processingGraph, samplerNodeTwo, 0, mixerNode, 1);
    AUGraphConnectNodeInput (self.processingGraph, samplerNodeThree, 0, mixerNode, 2);
    
    // Connect the mixer unit to the output unit
    AUGraphConnectNodeInput (self.processingGraph, mixerNode, 0, ioNode, 0);
    
    // Obtain references to all of the audio units from their nodes
    AUGraphNodeInfo (self.processingGraph, samplerNode, 0, &_samplerUnit);
    AUGraphNodeInfo (self.processingGraph, samplerNodeTwo, 0, &_samplerUnitTwo);
    AUGraphNodeInfo (self.processingGraph, samplerNodeThree, 0, &_samplerUnitThree);
    AUGraphNodeInfo (self.processingGraph, ioNode, 0, &_ioUnit);
    

    I then load the 3 instruments from the SoundFont (IDs 0, 1 and 2 in the SoundFont) as follows, passing in the 'bankURL' of the SoundFont:

    // Load the first instrument
    AUSamplerBankPresetData bpdata;
    bpdata.bankURL  = (__bridge CFURLRef) bankURL;
    bpdata.bankMSB  = kAUSampler_DefaultMelodicBankMSB;
    bpdata.bankLSB  = kAUSampler_DefaultBankLSB;
    bpdata.presetID = (UInt8) 0;
    
    AudioUnitSetProperty(self.samplerUnit,
                                  kAUSamplerProperty_LoadPresetFromBank,
                                  kAudioUnitScope_Global,
                                  0,
                                  &bpdata,
                                  sizeof(bpdata));
    
    // Load the second instrument
    AUSamplerBankPresetData bpdataTwo;
    bpdataTwo.bankURL  = (__bridge CFURLRef) bankURL;
    bpdataTwo.bankMSB  = kAUSampler_DefaultMelodicBankMSB;
    bpdataTwo.bankLSB  = kAUSampler_DefaultBankLSB;
    bpdataTwo.presetID = (UInt8) 1;
    
    AudioUnitSetProperty(self.samplerUnitTwo,
                                  kAUSamplerProperty_LoadPresetFromBank,
                                  kAudioUnitScope_Global,
                                  0,
                                  &bpdataTwo,
                                  sizeof(bpdataTwo));
    
    // Load the third instrument
    AUSamplerBankPresetData bpdataThree;
    bpdataThree.bankURL  = (__bridge CFURLRef) bankURL;
    bpdataThree.bankMSB  = kAUSampler_DefaultMelodicBankMSB;
    bpdataThree.bankLSB  = kAUSampler_DefaultBankLSB;
    bpdataThree.presetID = (UInt8) 2;
    
    AudioUnitSetProperty(self.samplerUnitThree,
                                  kAUSamplerProperty_LoadPresetFromBank,
                                  kAudioUnitScope_Global,
                                  0,
                                  &bpdataThree,
                                  sizeof(bpdataThree));
    

    Finally, I set the AUSampler nodes to be used by each MusicTrack as follows:

    //-------------------------------------------------
    // Set the AUSampler nodes to be used by each track
    //-------------------------------------------------
    MusicTrack track, trackTwo, trackThree;
    MusicSequenceGetIndTrack(testSequence, 0, &track);
    MusicSequenceGetIndTrack(testSequence, 1, &trackTwo);
    MusicSequenceGetIndTrack(testSequence, 2, &trackThree);
    
    AUNode samplerNode, samplerNodeTwo, samplerNodeThree;
    AUGraphGetIndNode (self.processingGraph, 0, &samplerNode);
    AUGraphGetIndNode (self.processingGraph, 1, &samplerNodeTwo);
    AUGraphGetIndNode (self.processingGraph, 2, &samplerNodeThree);
    
    MusicTrackSetDestNode(track, samplerNode);
    MusicTrackSetDestNode(trackTwo, samplerNodeTwo);
    MusicTrackSetDestNode(trackThree, samplerNodeThree);
    

    However, when I then play the MusicPlayer, I only hear a single part playing. The problem is arising in trying to use different instruments - when I use a single instrument with the standard MusicPlayer setup (instead of editing the AUGraph as I do above), it works fine.

    Does anyone have any idea what I'm doing wrong?


    Source: (StackOverflow)

    How to change volumes of individual programs?

    I want to be able to change the volume of a single program just like I do with the Mixer that is embedded to Vista and Win7(I don't know about Win8). I couldn't find any sample code or reference that will get me going. I prefer to use .NET platform but C and C++ is also OK...


    Source: (StackOverflow)

    Getting individual windows application current volume output level as visualized in audio Mixer

    I am trying to write a C# code that outputs the current audio output level from each of the windows application accessing the sound output (as shown with constantly changing green bars of the Volume mixer).

    The program will check every 10 ms, and outputs sth like this: Windows Media Player: 30, Mozilla Firefox: 0, Adobe Flash Player: 35 (as per the figure)

    I am using Windows 7, and trying it in C# (as Java cannot achieve this).

    I have found ways to get and set the Master Volume (the handle bar which shows 65% for Windows Media Player) for a running application, is there a way to get the green fluctuating level data?

    Thank you!

    Audio Mixer


    Source: (StackOverflow)