Quantcast
Channel: NAudio
Viewing all 5831 articles
Browse latest View live

Created Unassigned: WaveInEvent [16489]

$
0
0
I use NAudio WaveInEvent in a telecommunications software VB.net very simple.
Sometimes, the class does not generate sound!
Would anyone have a solution?
here is my code:

Imports NAudio.Wave
Friend Class NaudioMicro
'Nombre paquets audio reçus par PTT
Private NbPaquetsAudioParPTT As Integer = 0
'Microphone Availability (if NbPaquetsAudioParPTT > 0)
Private _MicrophoneAvailability As Boolean = True
'Indique que le recorder est en mode capture
Private _IsCapturing As Boolean = False
'Indicator for Display
Private DisplaySignal As Boolean = False
'Recorder Naudio
Private WithEvents _WaveInDevice As NAudio.Wave.WaveInEvent

Friend Event OnDisplayMessage(ByVal Message As String)
Friend Event OnCaptured(ByVal AudioStream() As Byte, ByVal NumSamples As Integer)
Friend Event OnError(ByVal Source As String, ByVal Méthode As String, ByVal Message As String, ByVal Stack As String)

Friend Sub StartCapture()
Try
If _IsCapturing = False Then
_IsCapturing = True
_WaveInDevice = New WaveInEvent()
_WaveInDevice.DeviceNumber = 0
_WaveInDevice.WaveFormat = New WaveFormat(8000, 16, 1)
_WaveInDevice.NumberOfBuffers = 2
_WaveInDevice.BufferMilliseconds = 60
_WaveInDevice.StartRecording()
NbPaquetsAudioParPTT = 0
RaiseEvent OnDisplayMessage("Microphone opening...")
End If
Catch Ex As Exception
RaiseEvent OnError("NaudioMicro", "StartCapture", Ex.Message, Ex.StackTrace)
End Try
End Sub

Friend Sub StopCapture()
Try
If _IsCapturing Then
If _WaveInDevice IsNot Nothing Then
_WaveInDevice.StopRecording()
_WaveInDevice.Dispose()
_WaveInDevice = Nothing
_MicrophoneAvailability = CBool(IIf(NbPaquetsAudioParPTT > 0, True, False))
End If
_IsCapturing = False
RaiseEvent OnDisplayMessage("Closing microphone: " & NbPaquetsAudioParPTT.ToString & " packets of 960 bytes generated!")
End If
Catch Ex As Exception
RaiseEvent OnError("NaudioMicro", "StopCapture", Ex.Message, Ex.StackTrace)
End Try
End Sub

Private Sub _WaveInDevice_DataAvailable(ByVal sender As Object, ByVal e As NAudio.Wave.WaveInEventArgs) Handles _WaveInDevice.DataAvailable
NbPaquetsAudioParPTT += 1
RaiseEvent OnCaptured(e.Buffer, NbPaquetsAudioParPTT)
End Sub

Friend ReadOnly Property IsCapturing() As Boolean
Get
IsCapturing = _IsCapturing
End Get
End Property

Friend ReadOnly Property MicrophoneAvailability() As Boolean
Get
MicrophoneAvailability = _MicrophoneAvailability
End Get
End Property
End Class

New Post: Music pitch detection

$
0
0
Ok I'll go down that path, thanks Mark.

New Post: I'm lost, help appreciate

$
0
0
I m trying using MixingSampleProvider and BufferedWaveProvider but i need to play (listen) when I add to MixingSampleProvider

Do you have something like a BufferedMixingSampleProvider ?

New Post: I'm lost, help appreciate

$
0
0
Is it possible to combine 4 BufferedWaveProvider into a mixingsampleprovider ? or something like this ?

New Post: Calling WmaWriter.Write in data available event causes recording from microphone to stop

$
0
0
Hi Mark, what I am trying to do is write to a WMA file, encoding buffer by buffer in the DataAvailable event handler of a WasapiCapture and WasapbLoopbackCapture objects. I did not see any API to do that in NAudio. I do see the MediaFoundationEncoder can convert an entire .wav file into .wma using a signal chain, but there seems to be no function to directly encode to a file buffer by buffer from a DataAvailable event. Encoding an entire file will take too long in my application. So I tried to use WmaWriter.Write to encode wma block by block. I am using Windows 8.1. Do I have to install the Windows Media Format 11 SDK first for the IWMWriter COM object to be installed? This SDK will only install on Windows XP. I would rather use the Media Foundation classes, but there is no way to encode WMA buffer by buffer as audio comes in from the microphone and speakers.

New Post: wave graph flicking

$
0
0
i want to use waveFormpainter.
read data form wav file(audio file) and plot that file into graph form

Created Unassigned: StartRecording NAudio [16490]

$
0
0
I have problems with StartRecording(), error: BadDeviceId calling waveInOpen. My project is in .net and I am using NAudio dll. Can someone help me?

Commented Unassigned: StartRecording NAudio [16490]

$
0
0
I have problems with StartRecording(), error: BadDeviceId calling waveInOpen. My project is in .net and I am using NAudio dll. Can someone help me?
Comments: it means you've either specified an invalid sound card id (0 for the default device) or maybe you don't have any sound cards at all

Commented Unassigned: StartRecording NAudio [16490]

$
0
0
I have problems with StartRecording(), error: BadDeviceId calling waveInOpen. My project is in .net and I am using NAudio dll. Can someone help me?
Comments: I'm using 0 for the default device, but the problem continues. Or does problem it's with the server because my project it's client-server?

Commented Unassigned: StartRecording NAudio [16490]

$
0
0
I have problems with StartRecording(), error: BadDeviceId calling waveInOpen. My project is in .net and I am using NAudio dll. Can someone help me?
Comments: Obs: the project in Localhost it works but when I publish in ISS8 give me the error " BadDeviceId calling waveInOpen", I don't understand what is happening...

Commented Unassigned: StartRecording NAudio [16490]

$
0
0
I have problems with StartRecording(), error: BadDeviceId calling waveInOpen. My project is in .net and I am using NAudio dll. Can someone help me?
Comments: there is no soundcard on your webserver. NAudio runs on the webserver, not on the person's computer who is viewing a webpage. You can't use it to record their audio/

New Post: Redundant old versions source

$
0
0
Here have a file is redundant or old version that make current version can not compile it:
NAudio/MixerSource.cs

Although it has been removed from project, this file still in the project directory, and can not compile when you embed the NAudio source to your own project, it can makes many define not found errors.

New Post: Output Wav(*.wav) file to microphone input

$
0
0
I want to output Wav file to microphone input.


Thanks for your help

New Post: Receiving SysEx Messages

$
0
0
Hi mark, I need to receive SysEx message but I don t found how to do this using MidiIn Events.

Have you any idea ?

New Post: Real Time Spectrum

$
0
0
I am creating a DMX control system for stage lighting, and I plan to use NAudio to allow for sound activation of patterns and pre-programmed shows. Ideally, the user would be able to see the levels of different frequencies in the spectrum and select functions when the frequency gets to a certain level. I have looked around and tried to find a tutorial on getting an audio spectrum, and all I could find was how to display the waveform of a file. Any help that you could provide would be greatly appreciated.

Thanks,
RobbieC97

New Post: Change Playback Device Of An Existing AudioSession

$
0
0
Hello.
I am trying to change the playback device of the existing audio sessions on my devices.

I know that this is possible.

Do you guys have any idea on how to do that?

New Post: Change Playback Device Of An Existing AudioSession

$
0
0
I'm afraid it's not something I've done myself. NAudio has wrappers for a lot of WASAPI, so if you can find out on MSDN how to do it WASAPI, then it should be possible to implement it in NAudio

New Post: The best way to to split audio chain?

New Post: Change Playback Device Of An Existing AudioSession

New Post: DataChunk header in wrong position

$
0
0
markheath wrote:
this will most likely by that NAudio writes a WAVEFORMATEX structure rather than a WAVEFORMAT structure. It has two more bytes. This really shouldn't be a problem with other software.
FYI there are a few apps/libs that rely on WAVEFORMAT and error out on WAVEFORMATEX.
Personally I think it may be a good idea to add WAVEFORMAT support.

I realise the issue with Serialize() but perhaps there is a way to specify the preferred format before or during the call to Serialize?

The Aubio.org library is one example, I had to create my own Wav writer instead of simply using nAudio. Aubio would error out saying "Not a PCM format" since the 18 byte WAVEFORMATEX header was on the TODO list.
Took me hours to code it due to lack of consistent documentation, but at least I know the WAV format back to front now lol
Viewing all 5831 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>