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

New Post: Ima Adpcm Error during Compression

$
0
0

yes, but where are you writing data to the writer? And where are you closing it?


New Post: Ima Adpcm Error during Compression

$
0
0

In  this method i am writing to the writer,

 Private Sub waveIn_DataAvailable(ByVal sender As Object, ByVal e As WaveInEventArgs)

        Try
            If (Me.InvokeRequired) Then     

           Me.BeginInvoke(New waveIn_DataAvailable(AddressOf waveIn_DataAvailable), sender, e)           

                 Else
                If writer IsNot Nothing Then   

                writer.Write(e.Buffer, 0, e.BytesRecorded)   

                secondsRecorded = (writer.Length / writer.WaveFormat.AverageBytesPerSecond)
                    If (secondsRecorded >= 60) Then                       

                     StopRecording(sender)                   

                 End If
                End If

            End If
        Catch ex As Exception   

        MsgBox(ex.Message)     

  End Try
    End Sub

 

here, i am closing

Private Sub waveIn_RecordingStopped(ByVal sender As Object, ByVal e As EventArgs)
        Try
            If (Me.InvokeRequired) Then   

            Me.BeginInvoke(New waveIn_RecordingStopped(AddressOf waveIn_RecordingStopped), sender, e)     

      Else             

  waveIn.Dispose()       

        waveIn = Nothing     

          writer.Close()   

            writer = Nothing


            End If
        Catch ex As Exception     

      MsgBox(ex.Message)   

    End Try   

End Sub

New Post: Ima Adpcm Error during Compression

$
0
0

 

 waveIn = New WaveIn()

waveIn.WaveFormat = New WaveFormat(8000, 16, 1)

 writer = New WaveFileWriter(CurrentFile, waveIn.WaveFormat)

where currentfile contains newly cretaed file path.

Also Event Handler i added followed by above lines.

 AddHandler waveIn.DataAvailable, AddressOf waveIn_DataAvailable   

 AddHandler waveIn.RecordingStopped, AddressOf waveIn_RecordingStopped

New Post: Ima Adpcm Error during Compression

$
0
0

and you are absolutely sure you are calling writer.Close / dispose?

New Post: Ima Adpcm Error during Compression

$
0
0

ya ya writer.close() and writer.dispose() both statements are excuting once after Stop Recording Button pressed.

New Post: Ima Adpcm Error during Compression

$
0
0

Recorded Audio File is working fine,, once after encoding to Ima Adpcm Format ,audio file is not working.But if i encode the recorded audio file to other formats,and then if i try to play that encoded file,its working fine.

New Post: Ima Adpcm Error during Compression

$
0
0

OK, so show me the code that converts your recorded Audio file into IMA ADPCM

Also, try converting the file using the NAudio demo application

New Post: Ima Adpcm Error during Compression

$
0
0

 

                TargetFormat = ImaAdpcmWaveFormat.MyImaAdpcmWaveFormat(8000, 1, 4, 505)   

                 convertedStream = New WaveFormatConversionStream(TargetFormat, Reader)

                  WaveFileWriter.CreateWaveFile(CurrentFile, convertedStream)

 

MyImaAdpcmWaveFormat class:

 public static ImaAdpcmWaveFormat MyImaAdpcmWaveFormat(int sampleRate, int channels, int bitsPerSample, float samplesperblock)   

    {   

        ImaAdpcmWaveFormat ImaAdpcmWformat = new ImaAdpcmWaveFormat();
        ImaAdpcmWformat.waveFormatTag = WaveFormatEncoding.ImaAdpcm; //

        ImaAdpcmWformat.sampleRate = sampleRate;   

        ImaAdpcmWformat.channels = (short)channels; 

         ImaAdpcmWformat.bitsPerSample = (short)bitsPerSample; // TODO: can be 3 or 4     

         ImaAdpcmWformat.extraSize = 2;//      

         ImaAdpcmWformat.blockAlign = 256; //TODO       

        ImaAdpcmWformat.averageBytesPerSecond = 4055; //TODO       

        ImaAdpcmWformat.samplesPerBlock = (short)samplesperblock; // TODO         

  return ImaAdpcmWformat;   

    }


New Post: Ima Adpcm Error during Compression

$
0
0

Nudio Demo Application is working fine.but i dont want to launch the dialog box crates by AcmFormatChoose Function.

New Post: Ima Adpcm Error during Compression

$
0
0

well I can't see anything wrong with your code. If your WaveFormat is the same as the one that NAudioDemo uses, then it should work. Possibly there is an issue with CreateWaveFile. Try this code and step through it in the debugger and see what you are managing to read. It might be that the buffer size might need to be set to an exact multiple of blockAlign. (e.g. 1024 bytes)

        public static void CreateWaveFile(string filename, IWaveProvider sourceProvider)
        {
            using (WaveFileWriter writer = new WaveFileWriter(filename, sourceProvider.WaveFormat))
            {

                byte[] buffer = new byte[sourceProvider.WaveFormat.AverageBytesPerSecond * 4];
                while (true)
                {
                    int bytesRead = sourceProvider.Read(buffer, 0, buffer.Length);
                    if (bytesRead == 0)
                        break;
                    writer.Write(buffer, 0, bytesRead);
                }
            }
        }

 

New Post: Ima Adpcm Error during Compression

$
0
0

For Above Wave Format only,Simply i replaced the 

  byte[] buffer = new byte[sourceProvider.WaveFormat.AverageBytesPerSecond * 4]  by 

 byte[] buffer = new byte[sourceProvider.WaveFormat.BlockAlign* 4]

 i traced NaudioDemo code,in same way my code is going. i guess everything is going in write way.But not getting why Encoded File is not able to play.

 

New Post: set Volume for mp3 playback

$
0
0

class AudioFileReader has Volume property, but class Mp3FileReader doesn't have such property. (I use Mp3FileReader for playback from Stream).

Another property IWavePlayer.Volume is obsolete, so how can I change Volume (and toggle mute on/off) for mp3 playing?

New Post: Ima Adpcm Error during Compression

$
0
0

CreateWaveFile() method you posted is same as which i am already using.

Can you please try once by your self considering above WaveFormat Structure 

New Post: set Volume for mp3 playback

$
0
0

AudioFileReader just chains together a bunch of IWaveProviders and ISampleProviders and uses Mp3FileReader under the covers.

In the very latest NAudio code I added a WaveVolumeProvider16 for cases when you want to change the volume without going to floating point.

Also, although IWavePlayer.Volume is obsolete (since not all output models will support it), if you are using WaveOut then you can set the Volume property on that.

New Post: MIDIout.Finalize() MIDIin.Finalize() problem

$
0
0


Hello Mark!
Im working with midi in and midi out.
I see if for error, you use same port like in and out, error MIDout.Finalize() or  MIDIin.Finalize() happen.
I asume this is caused by midi loop or something like that or some loop?
Some times is midiin ereor other times midiout, always if select the same port as midi in and midi out.

The problem is Naudio show exeption window, and no matter how many time i click on abort or ignore, all is freezed and i have to kill the aplication using task manager, but some tiems cant kill and need a hard reboot, other times need wait lot of time.
How can prevent this happen?
I can add logic on the software for prevent select the same port, but i use my software for send midi to other appz, and if that appz, have midi in and midi out in same port (i use midi yoke virtual midi wire) the same happen.

Also due is handled by naudio i can see in what portion of code this happen for try add and cathc this exeption at my way.

How can make my software catch that exeption, instead leave naudio doit?

This some kind of loop, and if this happen i need stop this happen and show some message then close the software probably, but prevent the complete freeze.

This is a problem cna be fixed from your side?
I itest with midi monitor software and not see midi signal loop feedback, so is something wrong inside the library probably.

Hoppe can helpme, is really ugly error and big problem.
Best regards!


New Post: Ima Adpcm Error during Compression

$
0
0

 

Can you please try once by your self considering above WaveFormat Structure .

New Post: MIDIout.Finalize() MIDIin.Finalize() problem

$
0
0

you need to make sure you call Dispose() on your MidiIn and MidiOut to avoid that assertion. It is just a Debug.Assert, warning you that you didn't call Dispose

New Post: MIDIout.Finalize() MIDIin.Finalize() problem

$
0
0

Mark run dispose when and where?

I have this error inmediatly after loas appz, without send or recive midi.

MIDIin.Finalize() happen when my appz use same port in in and out

 MIDout.Finalize()  when midi in and out is the same on appz, where i send midi form my appz trough midiyoke virtual midi wire.


I repeat i nto send midi so where call dispose?

I think you need take a look on this please.

The only place where i call dispose is when i close my appz, and run midiin dispose and midi out dispose.
This error happen inmediatly after load appz without send or use midi.

New Post: MIDIout.Finalize() MIDIin.Finalize() problem

$
0
0

how many times do you call new MidiIn or new MidiOut?

New Post: MIDIout.Finalize() MIDIin.Finalize() problem

$
0
0

 

 

One time onload:


Gmidi.midiOut = new MidiOut(Gmidi.VMidiDevice);
this.Closed += (o, s) => Gmidi.midiOut.Dispose();
Gmidi.midiIn = new MidiIn(Gmidi.IMidiDevice);
this.Closed += (o, s) => Gmidi.midiIn.Dispose();
Gmidi.midiIn.Start();



Then the error happen, and i nto otuch nothng or send midi.
Also, using midi monitor, no any signal midi is sended.
I suspect this is sme kind of bug or problem requeire some workaround on the library.
Like always, thankyou so much for send a fatser repply : )

Viewing all 5831 articles
Browse latest View live


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