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

New Post: Using lame.exe on WaveIn

$
0
0
I can't figure out why this wont work. I get an mp3 that is static. What am I missing? Thanks.
    public partial class MainWindow : Window
    {
        private WaveIn waveIn;
        Process p = new Process();

        public MainWindow()
        {
            InitializeComponent();
            waveIn = new WaveIn();
            waveIn.WaveFormat = new WaveFormat();
            waveIn.DataAvailable += waveIn_DataAvailable;
        }

        void waveIn_DataAvailable(object sender, WaveInEventArgs e)
        {
            p.StandardInput.BaseStream.Write(e.Buffer, 0, e.BytesRecorded); 
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            waveIn.StartRecording();
            p.StartInfo.FileName = @"c:\lame.exe";
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardInput = true;
            p.StartInfo.Arguments = "-r - testing2.mp3";
            p.StartInfo.CreateNoWindow = true;
            p.Start();
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            waveIn.StopRecording();
            p.StandardInput.Close();
        }
    }

New Post: Click Winforms controlbox pauses sound out

$
0
0
I don´t think they would share them, but it´s not forbidden to learn from their source.

How you implement it in Detail, is another question ;) So far I couldn´t figure out, what enhances their code. But I assume it´s a threading issue.

New Post: Using lame.exe on WaveIn

$
0
0
By static I mean the whole mp3 sounds kind of like white noise. Just thought I would clear that up. Any help would be appreciated.

New Post: WasapiCapture reset

$
0
0
Hello,

I'm using WasapiCapture and have the following issue: during recording, it happens sometimes that my application freezes up for a few seconds. So the audio data that I receive in the DataAvailable gets stored up, and after the freeze I receive old data from the microphone. Is it possible that in case of a freeze I reset the wasapiCapture's buffer, or to drop those data packets that are far behind in time?

Thanks,
Istvan

New Post: MixingSampleProvider goes silent

$
0
0
Actually the MixingSampleProvider doesn't stop reading, it is just that the buffer is full of 0s.

New Post: MixingSampleProvider goes silent

$
0
0
Yes, but is that because it thinks all its inputs have finished, or is one of its inputs returning 0's? Easiest thing is for you to copy the MixingSampleProvider code into your own project and debug step through the Read method to work out what is happening differently.

New Post: Using lame.exe on WaveIn

$
0
0
make sure you are passing the right command line arguments for the WaveFormat you are passing in.
I'd also perhaps write to a WAV file at the same time to check the audio you are receiving is correct.

New Post: WasapiCapture reset

$
0
0
hi, not sure that will be very easy to do. It depends on what is causing the freezing.
You'd need to make your own copy of the WasapiCapture code and write some custom logic to handle the case when you detect a freeze.

New Post: Using lame.exe on WaveIn

$
0
0
Thanks for your reply Mark. I set up a wave file writer and the wav file sounds perfect. It sounds like the stdin might be clipping. I have an open mic and the room sound in the mp3 sounds fine but as soon as I say something it sounds like distortion/static. I copied the below from my output window. It is the waveformat being sent and the output from lame.exe. It all seems to be in order. Is it possible for a default wavein to be too hot for stdin?

2
44100
16
Pcm
Assuming raw pcm input file
LAME version 3.96.1 (http://lame.sourceforge.net/)
CPU features: MMX (ASM used), SSE, SSE2
Using polyphase lowpass filter, transition band: 17249 Hz - 17782 Hz
Encoding <stdin> to testing2.mp3
Encoding as 44.1 kHz 128 kbps j-stereo MPEG-1 Layer III (11x) qval=3

New Post: MixingSampleProvider goes silent

$
0
0
The input is not returning 0s (I have debuged that), the MixingSampleProvider makes all 0s out of it, that's why is all silent.

New Post: Play WAV file that is still being written to

$
0
0
Hi, do you want to record from web stream and play the stream at the same time? Or do you only want to write "what you listen" when playing back a file?

Your approach isn´t clear to me. So I will show you both:

For case 1#: Look at the NAudio radio streaming demo
For case 2#: Use SavingWaveProvider

New Post: Can NAudio do Time Alignment?

New Post: Seting WaveOut buffersize directly to a number of samples

$
0
0
Hi, I want to use a pitch shifting algotihm that transposes Samples in high quality. I created a SampleProvider and pass the buffer to the FFT function then, but have the problem, that the FFT function desires a size of 1024, 2048, 4096 etc. that doesn´t match the count of the read method, which is 4410 (NumBuffers=3, Latency=150ms). So if i take a FFT Size of 4096 i still miss some frames (314), which lowers quality very much.

Is there any workaround to read in FFTSize blocks and still ensure a gapless and smooth playback? I mean instead of setting it up through the waveout device, which actually isn´t supported.

Many thanks, Freefall.

New Post: Play WAV file that is still being written to

$
0
0
Thank you for your reply but it is neither of those options.
Let me be a bit more specific.

Some process is writing a WAV file somewhere on a network drive. I do not have any control over that process, so I must take this for a fact.
But I need to be able to play this file already, while it is being written to.
I have managed to do this, but I can only play the portion that was available when I opened the file. But since the recording is still in progress, the actual length of the file is larger. When I then re-open the file again, I can play a larger portion, but again, up 'till the moment I re-opened the file. However, that is of course no option, for it would create a hickup in the sound being played.

So my question again: Can I dynamically change the 'end point' of the WaveFileReader object? Or is there some other mechanism I should use?

The code I'm using at this moment is this:
Stream stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
          m_waveReader = new WaveFileReader(stream);
Or should I use some other stream somehow?

New Post: Play WAV file that is still being written to

$
0
0
Okay, looks like a general filestream problem. You could perhaps use this approaches:

http://stackoverflow.com/questions/3817477/simultaneous-read-write-a-file-in-c-sharp
http://stackoverflow.com/questions/11627276/c-sharp-read-and-write-to-file-at-the-same-time

Another option could be to handle that the file got enlarged (event or sth) and then just re-create the filestream. Ofc, that would restart playback and some delay; you would have to jump to the last known position then.

Anyway this is not a NAudio issue and therefore you would have to find a solution yourself. Just copy the WaveFileReader class and modify it.

New Post: record at end

$
0
0
Guys, nobody will do all work for you. Just look at WaveFileWriter.cs at source code section.

Basically, your approach should be open the filestream in append mode, write the data and finally update wave header (length information).

Time to get your lazy bones up ;)

New Post: Play WAV file that is still being written to

$
0
0
You're right (of course).

Thanks for pointing me the direction!

New Post: Can NAudio do Time Alignment?

$
0
0
You could quite easily create a delay ISampleProvider that could delay a stream with sample accuracy. However, it is not easy to play synchronized audio out of two separate sound devices. It would be best to use a multi-channel soundcard, with an ASIO driver, and then you would be in complete control.

New Post: Seting WaveOut buffersize directly to a number of samples

$
0
0
You don't always get the chance to specify the exact size of sound-card buffers. My solution to this which you can see in the WPF demo I think was the SampleAggregator, which buffered up audio and when it got say 4096 samples, it calculated the FFT and raised an event. This makes it irrelevant what size the buffers are.

New Post: Using lame.exe on WaveIn

$
0
0
try recording to WAV and then passing that into LAME, see if that gives the same results.
Viewing all 5831 articles
Browse latest View live


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