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

New Post: Newbie Asio Playback Question

$
0
0

Thanks Mark.

I just checked the new version of NAudio from the source in which you guys were having a discussion on "Noise in playback start" It seems to be working correctly now. There's no stuttering now, and I also tested it out in the VB test project I had started, and it's working as well.

Thanks, Wyatt


New Post: Newbie Asio Playback Question

$
0
0

Edit:

I just checked again. It still stutters when I'm in visual studio, and build, and playback from there. When I close visual studio, and goto my bin debug folder, and open the app from there, it doesn't stutter.

New Post: Noise in playback start

$
0
0

that's strange. It was a very reproducable problem before my fix, and I couldn't hear it at all afterwards. I'll try with your file if I get a chance..

New Post: Newbie Asio Playback Question

$
0
0

the fix I made shouldn't affect anything to do with stopping. It was fixing a problem where you heard a bit of leftover MP3 from within the decoders buffer when you started playing again. The stutter is a strange one, and might still be related to garbage collections. The ASIO API is pretty simple - you just call driver.Stop(), so it's hard to think what else could be done to fix the problem.

New Post: Noise in playback start

$
0
0

I should also ask what soundcard and OS you are using. NAudio calls waveOutReset when you press stop which the soundcard drivers are supposed to respond to by immediately releasing all the buffers. Sometimes cheap soundcards don't behave quite how you expect though.

New Post: Noise in playback start

$
0
0

OS: Windows XP SP3

Audio chipset is on motherboard.

Motherboard: ASUS P5KPL-AM

Audio: VIA High Definition Audio

I also updated to newest drivers from ASUS web site (not so new actually) -- this didn't help. So drivers are -- version 6.0.1.7600, date 21/10/2009.

Hope this will help. 

New Post: Noise in playback start

$
0
0

OK, well to diagnose the problem further, we'll need to break it down. For example, instead of using WaveOut, try WaveOutEvent and DirectSoundOut. Also, what does your constructor for WaveOut look like?

Another test is to play WAV files instead of MP3s. Does the same issue happen?

And if you have any other soundcard, e.g. a USB headset, see if the problem occurs with that instead.

New Post: Noise in playback start

$
0
0

OK, are you 100% sure you have my latest checkin. You need to go to the "Source Code" tab above or download the change I uploaded yesterday here.


New Post: Newbie: Kinect service ==>Byte array to speaker

$
0
0

Thank you Mark for your reponse it's working with he following code:

WaveOut wo = new WaveOut();
WaveFormat wf = new WaveFormat(16000,1);
BufferedWaveProvider mybufferwp = null;


 audioClient.AudioFrameReady += audioClient_AudioFrameReady;

void audioClient_AudioFrameReady(object sender, AudioFrameReadyEventArgs e)
        {
            
            if (mybufferwp != null  )
            {
                mybufferwp.AddSamples(e.AudioFrame.AudioData, 0, e.AudioFrame.AudioData.Length);
            }
        }

 private void ecoute_Click(object sender, RoutedEventArgs e)
        {
            mybufferwp = new BufferedWaveProvider(wf);
            mybufferwp.BufferDuration = TimeSpan.FromMinutes(5);
            wo.Init(mybufferwp);
            wo.Play();
        }
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (client.isConnected) client.Disconnect(); //Disconnects if the 
            //client is connected, closing the communication thread
            if (wo.PlaybackState == PlaybackState.Playing)
            {
                wo.Stop();
                wo.Dispose();
                wo = null;
              
            }
        }

New Post: Newbie: Kinect service ==>Byte array to speaker

New Post: Noise in playback start

$
0
0

I was sure but I'have done this right now again :) - noise is still here.

Here is http://www.filedropper.com/naudiotest

I put this small test project together with test files and compiled NAudio (in Release mode) - on your computer it should work without nouse as I understand.

New Post: Noise in playback start

$
0
0

Hi Sergey, I've tried your app and I can't hear any problems. You're saying you hear some noise at the start when you press play?

Let me know how you get on with testing on other computers.

Another test you can do is create a new output device every time you press play. i.e.

 

private void btPlay_Click( object sender, EventArgs e )
{
    if (_wavePlayer != null)
        _wavePlayer.Dispose();            
    _wavePlayer = new DirectSoundOut();
    _wavePlayer.Init( _reader );

    _reader.CurrentTime = new TimeSpan();
    _wavePlayer.Play();
}
This will help us narrow down whether it is the WavePlayer or the MP3 reader that is the source of your issue.

 

New Post: Noise in playback start

$
0
0

> You're saying you hear some noise at the start when you press play?

Yes, correct. And this is "left-over" sound, because I don't hear it first time and I don't hear it if I pressed Stop when there was silence in the sound, but I hear it when I pressed Stop and there was loud sound at this moment. The louder a sound was when I pressed Stop, the louder will be noise at next Play.

I tried your workaround with recreating of _wavePlayer -- this didn't help.

I tried code that recreates everething at every Play:

		private void btPlay_Click( object sender, EventArgs e )
		{
			if( _wavePlayer != null )
				_wavePlayer.Dispose();
			if( _reader != null )
				_reader.Dispose();

			_reader = new Mp3FileReader( @"C:\Temp\NAudioTest\test2.mp3" );
			_wavePlayer = new DirectSoundOut();
			_wavePlayer.Init( _reader );

			_reader.CurrentTime = new TimeSpan();
			_wavePlayer.Play();
		}

This code plays sound correctly. But I can't use this as workaround because your Mp3FileReader (as far as I understand) scans through all frame headers in MP3 file and this can take some noticeable time for really big MP3 files (by the way, it's great that you implemented Mp3FileReader this way, because this allows correct positioning inside MP3 -- something that Windows Media Player or WinAmp don't do correctly -- this fact really was big surprise for me).

I'll test on another computer tomorrow. Thanks for all your efforts to resolve this issue!

New Post: Noise in playback start

$
0
0

OK, so its definitely the MP3FileReader, and clearly the changes I made to AcmMp3FrameDecompressor aren't working for you.

I am now wondering if maybe you have a different ACM MP3 codec installed on your machine. Can you use the NAudioDemo utility to examine what codecs you have installed on your system, and see what is there. Also, are you running your executable as x86 or x64?

Created Issue: wrong speed for the different rate [16368]

$
0
0
when i records audio with the sample WaveIn class, it's get wrong speed, if i shoose rate different from 8000. Only in 8 kHz i've got correct speed - on the 16000 audio got two times longer and lower tone, at 44000 it almost nothing to hear, sound terrify. Please check, what i've done wrong.

public static void StartRecording(string path, int device)
{
waveInStream = new WaveIn();

writer = new WaveFileWriter(path, waveInStream.WaveFormat);

waveInStream.DeviceNumber = device;

waveInStream.WaveFormat = new WaveFormat(8000, 32, 1);
waveInStream.BufferMilliseconds = 200;
waveInStream.NumberOfBuffers = 4;

waveInStream.DataAvailable += waveInStream_DataAvailable;
waveInStream.StartRecording();
}

static void waveInStream_DataAvailable(object sender, WaveInEventArgs e)
{
writer.Write(e.Buffer, 0, e.BytesRecorded);
}



New Post: Noise in playback start

$
0
0

Application runs as 32 bit. Below is list from "NAudioDemo.exe \ ACM Format Conversion":

===========================

Long Name: Кодек IMA ADPCM (Microsoft)

Short Name: Microsoft IMA ADPCM

Driver ID: 1527664

---

Long Name: Кодек ADPCM (Microsoft)

Short Name: MS-ADPCM

Driver ID: 1611616

---

Long Name: Кодек CCITT G.711 A-Law и u-Law (Microsoft)

Short Name: Microsoft CCITT G.711

Driver ID: 1885552

---

Long Name: Кодек GSM 6.10 (Microsoft)

Short Name: Microsoft GSM 6.10

Driver ID: 1885960

---

Long Name: Кодек DSP Group TrueSpeech™

Short Name: TrueSpeech(TM)

Driver ID: 1886368

---

Long Name: Microsoft G.723.1 CODEC

Short Name: Microsoft G.723.1

Driver ID: 1886776

---

Long Name: Windows Media Audio

Short Name: WM-AUDIO

Driver ID: 1887184

---

Long Name: Sipro Lab Telecom ACELP.net audio codec

Short Name: ACELP.net

Driver ID: 1887592

---

Long Name: Indeo® audio software

Short Name: Indeo® audio software

Driver ID: 1888000

---

Long Name: Fraunhofer IIS MPEG Layer-3 Codec (advanced)

Short Name: MPEG Layer-3 Codec 

Driver ID: 1888408

---

Long Name: Конвертор PCM Microsoft

Short Name: MS-PCM

Driver ID: 1857096

=========================

Do you need details from bottom text box of "NAudioDemo.exe \ ACM Format Conversion"?

Commented Issue: wrong speed for the different rate [16368]

$
0
0
when i records audio with the sample WaveIn class, it's get wrong speed, if i shoose rate different from 8000. Only in 8 kHz i've got correct speed - on the 16000 audio got two times longer and lower tone, at 44000 it almost nothing to hear, sound terrify. Please check, what i've done wrong.

public static void StartRecording(string path, int device)
{
waveInStream = new WaveIn();

writer = new WaveFileWriter(path, waveInStream.WaveFormat);

waveInStream.DeviceNumber = device;

waveInStream.WaveFormat = new WaveFormat(8000, 32, 1);
waveInStream.BufferMilliseconds = 200;
waveInStream.NumberOfBuffers = 4;

waveInStream.DataAvailable += waveInStream_DataAvailable;
waveInStream.StartRecording();
}

static void waveInStream_DataAvailable(object sender, WaveInEventArgs e)
{
writer.Write(e.Buffer, 0, e.BytesRecorded);
}


Comments: set the waveInStream format before creating the WaveFileWriter waveInStream.WaveFormat = new WaveFormat(8000, 32, 1); writer = new WaveFileWriter(path, waveInStream.WaveFormat);

New Post: Noise in playback start

$
0
0

OK, one more thing to try. The constructor for Mp3FileReader lets you pass in a factory object that creates a frame decompressor. Create a class like this:

class CustomMp3FrameDecompressor : IMp3FrameDecompressor
{
    private AcmMp3FrameDecompressor decompressor;
    private WaveFormat waveFormat;

    public CustomMp3FrameDecompressor(WaveFormat waveFormat)
    {
        decompressor = new AcmMp3FrameDecompressor(waveFormat);
        this.waveFormat = waveFormat;
    }

    public int DecompressFrame(Mp3Frame frame, byte[] dest, int destOffset)
    {  
        return decompressor.DecompressFrame(frame,dest,destOffset);
    }

    public void Reset()
    {
        decompressor.Dispose();
        decompressor = new AcmMp3FrameDecompressor(waveFormat);
    }

    public void Dispose()
    {
        decompressor.Dispose();
    }

    public WaveFormat OutputFormat 
    {
        get { return decompressor.OutputFormat; }
    }                     
}

And then when you create a new Mp3FileReader, pass it in

new Mp3FileReader(fileName, (wf) => new CustomMp3FrameDecompressor(wf));

New Post: Moving source code on GitHub

$
0
0

First, congratulations for the work you've done. It's really awesome.
Secondly, for comming back to the point, I wanted to know if it's possible for you to use Git as distributed version control system for your source code repositories. Git makes extending and contributing to the projects much easier than with Subversion and CVS - no more any need to 'join the team' or to 'ask for write access', just fork and code. Whenever we have something ready simply ping you so you can pull from our fork and integrate it back into mainline.Git
Valeriu

New Post: Moving source code on GitHub

$
0
0

I use Mercurial for NAudio, so you can fork and issue pull requests. Just click Source Code above and then Fork.

Mark

Viewing all 5831 articles
Browse latest View live


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