none
Having a Problem Merging VB Audio Code with VB NUI Code RRS feed

  • Question

  • I need to add audio beaming code to my NUI code. I cannot seem to merge the audio code into the NUI code without generating a lot of errors. 

    Below is my (working) stand alone VB audio beaming program based on the Kinect sample code. What do I need to do to "massage" this code so that I may add it to my NUI Skeleton Viewer code? 

    Imports System.IO
    Imports System.Text
    Imports Microsoft.Research.Kinect.Audio
    
    Namespace RecordAudio
    
    	Friend Class Program
            <MTAThread()> _
            Shared Sub Main(ByVal args() As String)
                Dim buffer = New Byte(4095) {}
    
                Using source = New KinectAudioSource 'Instantiate the KinectAudioSource to do audio capture
    
                    source.SystemMode = SystemMode.OptibeamArrayOnly
                    AddHandler source.BeamChanged, AddressOf source_BeamChanged 'Register for beam tracking change notifications
    
                    Using audioStream = source.Start() 'Start capturing audio from audio buffer
                        Dim count As Integer
                        Do While count < 1
                            If source.SoundSourcePositionConfidence > 0.9 Then 'If we have high confidence, print the position
                                Console.Write("Sound source position (radians): {0}" & vbTab & vbTab & "Beam: {1}" & vbCr, source.SoundSourcePosition, source.MicArrayBeamAngle)
                            End If
                        Loop
                    End Using 'audioStream
    
                End Using 'source
    
            End Sub
    
            Private Shared Sub source_BeamChanged(ByVal sender As Object, ByVal e As BeamChangedEventArgs)
                Console.WriteLine(vbLf & "Beam direction changed (radians): {0}", e.Angle)
            End Sub
    
        End Class
    
    End Namespace
    
    



    Thomas M. Robots-and-Androids
    Monday, September 5, 2011 11:35 PM

All replies

  • Could you let us know what kinds of errors did you get so we can help you better?

    Thanks!

    Eddy


    I'm here to help
    Wednesday, September 7, 2011 2:03 AM