this means you have no ACM codecs installed on the computer that can decode that particular codec.
↧
New Post: Error in playing compressed wave file using waveoutevent player.
↧
New Post: Clipping wrap-around
what bit depth are you saving your WAV files in? If its floating point, no clipping is necessary at all. If its 16 bit, then your audio has to get coerced into the range supported by an Int16
↧
↧
New Post: Stereo Pairs
yes, that will work, but remember that many ASIO drivers will not let you open multiple instances of the same sound card.
↧
New Post: Stereo Pairs
Yes. Because disposing of these objects is still confusing to me (the how and when) and also because my app will only ever play one file at a time anyway, I moved the instancing to the form level to only ever user the one instance of those things across the board, and dispose of them all on form close. I just need to do it all without ever calling anything else as "New" that needs additional disposal.
Public Player = New WaveOutEvent()
Public wave As NAudio.Wave.WaveFileReader
Public output As NAudio.Wave.AsioOut
↧
New Post: Clipping wrap-around
My app saves them back into the same format it loaded them in. In these recent cases, this has been 24bit files. How do I save to floating point? I didn't even know there was such a thing as a floating point WAV file.
↧
↧
New Post: The requested address is not valid in its context
Before to try develop a voice chat with your sample (Network Chat), I decided to test it before.
On IPAdress, if I put 127.0.0.1 or my own IP, it works fine. But if I put a IP from any computer. It sends me back: "The requested address is not valid in its context".
Now the question: The sample code is ready for connect with another computer? Or only the Server IP?
On IPAdress, if I put 127.0.0.1 or my own IP, it works fine. But if I put a IP from any computer. It sends me back: "The requested address is not valid in its context".
Now the question: The sample code is ready for connect with another computer? Or only the Server IP?
↧
New Post: Error in playing compressed wave file using waveoutevent player.
Or in other words: you´d have to decode the file yourself or by an extra library.
↧
New Post: An Event to Fire to Dispose?
I´d suggest you subscribe to the PlaybackStopped Event and dispose there.
↧
New Post: An Event to Fire to Dispose?
Thanks. I think I have it sorted. If you don't mind, look over this code and tell me if you think there are any memory leaks or potential issues there.
I playback the audio with this class code below. Because my app is triggering really short files it uses shared public vars for the object references to track and dispose of them on every trigger cycle and to also allow the main form to dispose of any leftover objects on quit, like if a user hit the quit the application while audio was playing. Not sure if the PlaybackStopped event would trigger in that case.
Also, looking at volume, it appears to be obsolete, I need another way.
I playback the audio with this class code below. Because my app is triggering really short files it uses shared public vars for the object references to track and dispose of them on every trigger cycle and to also allow the main form to dispose of any leftover objects on quit, like if a user hit the quit the application while audio was playing. Not sure if the PlaybackStopped event would trigger in that case.
Also, looking at volume, it appears to be obsolete, I need another way.
' Keep class level references to the current objects for disposal
' Public so that the main form can dispose of any objects on shut down
Public Shared CurrentWave As NAudio.Wave.WaveOutEvent
Public Shared CurrentStream As WaveFileReader
Public Sub Play_Sound(Filename As String, ByVal Audio_Device_Output As Integer,
Optional ByVal Volume As Single = Nothing)
' Always stop and dispose on new playback trigger
' only ever allow playing one sound at a time
If CurrentWave IsNot Nothing Then
If CurrentWave.PlaybackState = PlaybackState.Playing Then
' this triggers disposal of current objects
CurrentWave.Stop()
End If
End If
' create a new stream object
Dim Stream = New WaveFileReader(Filename)
' reference the stream object so we can easily dispose of it later
CurrentStream = Stream
' load the audio file
Dim Reader = New WaveFileReader(Filename)
Dim Wave = New NAudio.Wave.WaveOutEvent
CurrentWave = Wave
AddHandler Wave.PlaybackStopped, AddressOf PlaybackStopping
' set the correct output device index
CurrentWave.DeviceNumber = Audio_Device_Output
' **** this is obsolete, find another way
If Not Volume = Nothing Then CurrentWave.Volume = Volume
Try
CurrentWave.Init(Reader)
CurrentWave.Play()
Catch ex As Exception
MsgBox("The selected audio device may already be in use by another application." & vbNewLine & vbNewLine & "Error: " & ex.Message, vbOKOnly + vbInformation, "Play File")
End Try
'================================================================
End Sub
On stop, the following code triggers which disposes of the objects via their references. The sender object is the correct reference there for the WaveOut object. If I use the var reference CurWave there it disposed the wrong object... so this seems to work.Private Sub PlaybackStopping(sender As Object, e As NAudio.Wave.StoppedEventArgs)
' if current WaveEvent object is instanced
If sender IsNot Nothing Then
' if currrent WaveEvent is playing
If sender.playbackstate = sender.PlaybackState.Playing Then
' stop the wave out device
sender.stop()
' stop / null the UI meters when stopping playback
' volume meters are run from a timer in the main form
Main.VolumeMeter1.Amplitude = 0
Main.VolumeMeter2.Amplitude = 0
End If
' dispose objects on every stop or re-trigger cycle
CurrentStream.Dispose()
' sender should always be CurrentWave so
' this reference should always dispose of it
sender.Dispose()
End If
↧
↧
New Post: The requested address is not valid in its context
Ah yes, if you look in the
NetworkChatPanel
at the Connect
method, you'll see the following line:udpListener.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
This allows us to connect to 127.0.0.1 for test purposes, but possibly also stops us connecting to another one. Try commenting it out and seeing what happens.↧
New Post: Clipping wrap-around
You can save a WAV file in any WaveFormat. What's converting back to 24 bit then?
↧
New Post: Clipping wrap-around
I just use the same WaveFormat object that I loaded the WAV file from. I'm just doing a few basic effects so the total samples doesn't change or anything. I looked up floating point and it seems I found my answer: 32bit is floating point.
↧
New Post: Get Jack Information of Audio Device
NAudio has wrappers for many parts of the WASAPI Core audio interfaces. The best place to learn about them is actually MSDN.
e.g here: https://msdn.microsoft.com/en-us/library/windows/desktop/dd756607%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
e.g here: https://msdn.microsoft.com/en-us/library/windows/desktop/dd756607%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
↧
↧
New Post: Network chat between regular C# and Raspberry Pi 2 using NAudio
first, you're likely capturing stereo audio, so the volume of data sent will be very high. I'd also try to find ways to reduce the volume of audio being sent. IEEE float at 44.1kHz is not very efficient.
Why not start by capturing the audio to a WAV file, and saving a few seconds. This might highlight any mismatches of WaveFormat.
Why not start by capturing the audio to a WAV file, and saving a few seconds. This might highlight any mismatches of WaveFormat.
↧
New Post: Problem using NAudio with WaveEngine(2d&3d graphic engine)
First of all. I want to say thanks for this great library and....
I have been trying to use NAudio with WaveEngine because it seems it's supported but i cannot make it work. Any help would be appreciated.
I get this error,
I have been trying to use NAudio with WaveEngine because it seems it's supported but i cannot make it work. Any help would be appreciated.
I get this error,
n unhandled exception of type 'System.IO.FileLoadException' occurred in WaveEngine.Adapter.dll
Additional information: No se puede cargar el archivo o ensamblado 'NAudio, Version=1.7.0.11, Culture=neutral, PublicKeyToken=6e72eaf7d6c3c55b' ni una de sus dependencias. La definición del manifiesto del ensamblado no coincide con la referencia al ensamblado. (Excepción de HRESULT: 0x80131040)
More information on http://forum.waveengine.net/forum/general/9953-naudio-library-compile-error↧
New Post: Problem using NAudio with WaveEngine(2d&3d graphic engine)
Issue was solved. I had to use the naudio version that comes with the engine.
↧
New Post: The requested address is not valid in its context
I commented this line and the same happens.
↧
↧
New Post: AAC encode to stream
I'm wondering whether anyone has an example of using a Media Foundation Transform to encode AAC to a stream as opposed to a file?
I found this thread from a couple of years back which seems to suggest that it's possible but, looking at the creation of a custom MFTransform was enough to give me a headache and looks like it'd involve quite an indepth knowledge of Media Foundation which I don't reallly have!
Any help would be gratefully recieved.
Thanks,
Kenny
I found this thread from a couple of years back which seems to suggest that it's possible but, looking at the creation of a custom MFTransform was enough to give me a headache and looks like it'd involve quite an indepth knowledge of Media Foundation which I don't reallly have!
Any help would be gratefully recieved.
Thanks,
Kenny
↧
New Post: AAC encode to stream
I did try to get this working ages ago, but it turned out to be a real pain. It is possible in theory but I'm afraid I haven't got an easy answer for you at the moment.
↧
New Post: Xamarin + Naudio compile Error.
I'm gettin this error no matter what i try.
Error 2 Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Perhaps it doesn't exist in the Mono for Android profile?
Nombre de archivo: 'System.Windows.Forms.dll'
en Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
en Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
en Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
en Xamarin.Android.Tasks.ResolveAssemblies.Execute() Launcher
Help would eb appreciated.↧