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

New Post: Convert wav to ulaw wav??

$
0
0
I agree, but I'm not going to 8 bit, that is the format of the files that do not play correctly.
They already exist in the playback folder but when the IVR software attempts to play
them back it doesn't work.

One of our server admin pulled down a 16 bit file and it did play. Still trying to figure
that one out, and figure how exactly what format will work with the IVR engine.

I have received very little training to support this, so I am learning as I go. I do know if
I take the exist files and compress them in SoundForge they play correctly, and the template
I use is CCITT mulaw. Manual conversion works, but the script does not. I'm studying the
code in the pluralsight courses to try to figure this out, as well as this discussion.

New Post: Convert wav to ulaw wav??

$
0
0
Oh, btw, for some reason unknown to me, the company changed their
recording software from NICE to Qfiniti, some time before I arrived on
the scene. Not sure if that has an impact either.

Created Unassigned: Play 4 different wav files over ASIO on 4 stereo channels [16502]

$
0
0
Hi Mark

Thanks for providing the library! First I thought, that my problem was simple: I have 4 different Audio Files, that I want to play on a multichannel soundcard. Each file has to go to a separate Audio out. I manage to do this one time, the playback stopped event handler doesn't work, the disposing doesn't work, destroying all the objects and building them up again doesn't work. I don't know what to do...

I need to playback all the files every hour or so... Is there a simple way to do this?

Thank you very much in advance.

Br
Romy

New Post: Convert wav to ulaw wav??

$
0
0
markheath wrote:
mu-law is 8 bit. If the original recording was 8 bit linear PCM, then going to mu-law doesn't really make much sense.
The original recording is GSM 6.10, 8Khz, 16 bit, (bit rate 13Kbps), Mono

From what I'm reading of what you posted on Code Project and above, I need to convert this twice?

First from GSM to PCM, then to mulaw?

Thanks,

Randy

New Post: Convert wav to ulaw wav??

$
0
0
yes. Step 1 is GSM -> PCM. Step 2 is PCM -> mulaw

New Post: Convert wav to ulaw wav??

$
0
0
Here is my solution:
WaveFormat newFormat = WaveFormat.CreateMuLawFormat(8000, 1);
                using (var reader = new WaveFileReader(fileStart))
                using (var converter = WaveFormatConversionStream.CreatePcmStream(reader))
                {
                    using(var encoder = new WaveFormatConversionStream(newFormat, converter))
                    {
                        WaveFileWriter.CreateWaveFile(fileEnd, encoder);
                    }
                }

New Post: Convert wav to ulaw wav??

$
0
0
yes, looks like that should work just fine.

New Post: Convert wav to ulaw wav??

$
0
0
Thank you, Mark, appreciate the feedback.

New Post: Stopped playing event

$
0
0

Thanks Mark, I am focused on a different part of my project right now but I have pulled the updates and will take a look ASAP.

Thanks again,

Sid

Sid Price

Desktop Application and Embedded System Design

New Post: Convert wav to ulaw wav??

$
0
0
I must have miscalculated something. This code does indeed create the PcmStream and it does create the new .wav
file, but I went from having a file with a size of 400kb to a size over 5mb. I must be missing a step or something. :)

New Post: Help for Exception: NAudio.MmException "UnspecifiedError calling waveOutOpen"

$
0
0
Hello,
I'm new to NAudio. I try to learn to program with NAudio. I found a demo to produce a sine wave tune at here: TEXT. I create a project in VS2015 and put the demo in and the code was working fine.

In the example, there is a method StartStopSineWave() and in it (in short)
var sineWaveProvider = new SineWaveProvider32();
sineWaveProvider.SetWaveFormat(48000, 2); // Parameters are (int SampleRate, int channels)

This is working. But !? when I give the values for CD stereo, 2 channels as
sineWaveProvider.SetWaveFormat(44100, 2);

an exception occurs later on at the Init() method:
            sineWaveProvider.Frequency = 432;
            sineWaveProvider.Amplitude = 0.25f;

            waveOut = new WaveOut();
            waveOut.Init(sineWaveProvider);    //ERROR
==>
// ERROR: 44,1 kHz, 2 channels stereo CD
// -> Exception: NAudio.MmException"UnspecifiedError calling waveOutOpen"

with sineWaveProvider.SetWaveFormat(44101, 2) and other values for the SampleRate there are no problems.

Can anyone help me what this is, and what to do to fix this?

Or how can I debug into the NAudio.dll; means how do I get the source code for NAudio.dll into the Studio so I can debug thorough it by myself?

Harald

New Post: Get audio from cypress device

$
0
0
I have mixer with 6 microphones, it is working with cypress driver Cyusb.dll and registered as usb device in device manager not as audio device, but with bass net (Bass.net.dll) i can get audio from it , bass has method that registers this device as audio device with device number. In NAudio I could not do so, when I pass WaveIn device number it says that "BadDeviceId calling waveInOpen".
How can i do this with NAudio?

New Post: Convert wav to ulaw wav??

$
0
0
The vendor of the voice engine software got back to me and said the application
messages would need to be in the Format: CCITT u-law, 8,000 kHz, 8 bit, Mono.

The code above converts the PCM to 16 bit, so it looks like I need an additonal
step to downsample(?) the PCM to 8 bit before the final conversion to muLaw.

Does that sound right?

Thanks,

Randy

New Post: Convert wav to ulaw wav??

$
0
0
yes, that's exactly right. By the way the file sizes you mentioned are exactly right for going from GSM (13kbps) to linear 16 bit pcm (128kbps) - there is a fivefold increase in size. The file will halve when you go to mu-law (64kbps)

New Post: Help for Exception: NAudio.MmException "UnspecifiedError calling waveOutOpen"

$
0
0
It's quite unusual to find a soundcard that doesn't let you play 44.1kHz but this error is coming from your soundcard driver. Have you tried with different soundcards?

You can debug into NAudio DLL by getting the latest code from GitHub, building locally and referencing that dll.

Commented Unassigned: Play 4 different wav files over ASIO on 4 stereo channels [16502]

$
0
0
Hi Mark

Thanks for providing the library! First I thought, that my problem was simple: I have 4 different Audio Files, that I want to play on a multichannel soundcard. Each file has to go to a separate Audio out. I manage to do this one time, the playback stopped event handler doesn't work, the disposing doesn't work, destroying all the objects and building them up again doesn't work. I don't know what to do...

I need to playback all the files every hour or so... Is there a simple way to do this?

Thank you very much in advance.

Br
Romy
Comments: With ASIO, you open all the outputs at once. So all 8 channels. And then you provide 8 channel audio as the input. And NAudio has two helper classes for this purpose - `MultiplexingWaveProvider` and `MultiplexingSampleProvider` that glue together stereo files and send them to the appropriate output. Check out [my blog post](http://markheath.net/post/handling-multi-channel-audio-in-naudio) on how to use them.

New Post: naudio Sound record from Multiple inputs and Multiple outputs.

$
0
0
You can record from soundcard inputs with WaveIn or WasapiIn To record soundcard outputs you must use WasapiOut. So you'd need to open one for each soundcard you need to record from.

New Post: Playing dynamically generated floats.

$
0
0
Yes, you can do this in NAudio quite easily. There are two ways. First, create an ISampleProvider implementation and in the Read method provide the number of samples asked for. This is the easiest option and is how the SignalGenerator class works if you want an example.

Alternatively, some applications may be better suited to a separate thread generating audio and putting the raw samples into a BufferedWaveProvider which is supplying the playback device. In this case you need to make sure you are producing audio in real-time so there aren't gaps in the audio, and you don't overfill the buffer.

New Post: Playing dynamically generated floats.

$
0
0
Hmm. I can't seem to make heads or tails of the SignalGenerator class or the demo that uses it. I mean I can see it's generating sound data but not where it's feeding it to so that it ultimately makes it to the sound card and speakers.


So I tried using the BufferedWaveProvider but nothing happens. No sound comes out. Is there something I missed? My class looks like this.
public class Speaker_Naudio : Speaker
    {
        BufferedWaveProvider bwp;
        public Speaker_Naudio(short BitsPerSample, short Channels, int SamplesPerSecond)
        {
            bitspersample = BitsPerSample;
            bwp = new BufferedWaveProvider(WaveFormat.CreateALawFormat(SamplesPerSecond, Channels));
        }
        public override bool BufferSoundData(double[] data)
        {
            if (bwp.BufferedBytes < data.Length)
            {
                byte[] bytebuff = FloatsToBytes(data);
                bwp.AddSamples(bytebuff, 0, bytebuff.Length);
                return true;
            }
            return false;
        }
}
Previously I was using XNA but they are dropping support for it so I'm switching away.

This class makes sound.
public class Speaker_XNA : Speaker
    {
        DynamicSoundEffectInstance DynSoundInst;
        public Speaker_XNA(short BitsPerSample, short Channels, int SamplesPerSecond)
        {
            DynSoundInst = new DynamicSoundEffectInstance(SamplesPerSecond, (AudioChannels)Channels);
            FrameworkDispatcher.Update();
            bitspersample = BitsPerSample;
            FrameworkDispatcher.Update();
        }
        override public bool BufferSoundData(double[] data)
        {
            if (DynSoundInst.PendingBufferCount <= 1)
            {
                DynSoundInst.SubmitBuffer(FloatsToBytes(data));
                DynSoundInst.Play();
                return true;
            }
            else
                return false;
        }
    }

Commented Unassigned: AsioOut dispose() - keep signal [16500]

$
0
0
Hello,
I'm reading some wave files using AsioOut and a WaveMixerStream32. Everything works great but I noticed that sometimes (1 time on 5) when I close and start again my program, I have a loud signal playing in the output of my audiocard and I have to restart the app to delete the signal and come back to normal.

I'm thinking it's the asioOut which stays open or something like that.
When i close the app, I'm doing the following :
1. I remove all the input stream in my audio mixer and I stop the asioOut
_asioOut.Stop();

2. After 0.5s, I dispose all the mixer, the channels and asioOut and set them to null.

Am I doing something wrong here?
How can I get rid of the loud signal ?

(My audio card is a Komplete Audio 6 and it's compatible asio driver)

Thanks for your help !
Comments: It happens at higher and lower latencies.
Viewing all 5831 articles
Browse latest View live


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