Created Issue: Whole MF Encoder does not work [16382]
Commented Issue: Playing Short Audio Files [16377]
I ran into the following issue: NAudio will not play short audio files. I've used WaveChannel32.Length to get the following numbers.
Files with length 755712 or less will not play.
Files with length 5935104 do play.
I'm not sure where the exact limit is. There are no exceptions thrown. I was hoping to use NAudio to play files of about 1 second long. Is anyone else having this issue? Is there a fix? Do I need to find a different library?
Comments: I've created a SilenceProvider that implements ISampleProvider. Like you said, it's pretty easy. But for potential future visitors: public class SilenceProvider : ISampleProvider { private readonly WaveFormat format; public SilenceProvider(WaveFormat format) { this.format = format; } public int Read(float[] buffer, int offset, int count) { for (int i = 0; i < count; i++) { buffer[offset + i] = 0; } return count; } public WaveFormat WaveFormat { get { return format; } } } I just pass it the WaveFormat of an actual sample so that I am certain that the formats match. NAudio now works exactly as I want it within my application. Thank you very much, markheath, for you time and support. I'd like to add your name and "NAudio" to the the credits list of my free game. (It will one day be finished, I think.) And sorry for messing up this thread... I took it quite off-topic there. But! I've gained a good insight into the workings of NAudio.
New Post: AcmNotPossible calling acmStreamOpen
That's not the case, no. Sorry. It looks like it's failing in the try function.
Commented Issue: Playing Short Audio Files [16377]
I ran into the following issue: NAudio will not play short audio files. I've used WaveChannel32.Length to get the following numbers.
Files with length 755712 or less will not play.
Files with length 5935104 do play.
I'm not sure where the exact limit is. There are no exceptions thrown. I was hoping to use NAudio to play files of about 1 second long. Is anyone else having this issue? Is there a fix? Do I need to find a different library?
Comments: great, glad you got it working in the end. I've improved MixingSampleProvider, to hopefully make things easier for people trying to do the same thing in the future.
New Post: AcmNotPossible calling acmStreamOpen
Well that is very strange - you are saying that NAudioDemo works, but your app with the exact same code doesn't? Are they both using the same version of NAudio?
New Post: Network chat with audio from multiple users simultaneously.
I've only just added that new feature literally in the last few days. You'd need to get the latest code, or alternatively, make a silence producing SampleProvider to constantly feed the mixer and ensure it never ends. You can see an example in the comments on this thread.
As for the distortion, it may be clipping. You could reduce the volume of the inputs to your mixer and see if that improves things (e.g. multiply every sample value by 0.5).
Mark
Commented Issue: Whole MF Encoder does not work [16382]
Comments: That's odd, because I developed it in Win8 x64. Can you give an example of a format you tried to encode to? What was the input file? And what is the exception you get in BeginWriting?
New Post: Need a function urgently
the example I showed above passes a delegate which has a closure around the two readers, allowing it to set their Position property to 0. That's how I would do it, but there are other ways to give your Looper access to the mixer inputs so it can reset their positions.
New Post: Create MP3 stream
Naudio includes a demo of MP3 stream player, but is there a demo for creating the MP3 stream?
I'm hoping to take the line-in from computer A, send it over the local network, and play it on the headphones on computer B.
Perhaps I could use the Network chat demo as is; but I coudn't figure out which IP address to use in the panel; i.e. do I type in the IP address of the remote computer I want to chat with?
Thanks,
Jake
New Post: Play mp3 from stream in real-time
I used the code that you advised me. But i have problems again. This track "http://cs5047.userapi.com/u4714757/audios/c95bbdffbee6.mp3" is cbr.
But all frames always different.
frame = Mp3Frame.LoadFromStream(readFullyStream);
New Post: Create MP3 stream
If I understand you correctly, with my bad english, you want to transfer the sound from "line-in" to another computer?
New Post: MP3 Stream From Hard Drive
Hi,
First of all, thank you for creating such a great library and releasing it for free! Something I'm struggling to understand though, does the MP3 reader tutorial (http://naudio.codeplex.com/wikipage?title=MP3) load the whole file before playing?
I'd prefer to stream the mp3 than load it in full so that the application is faster. To do this, should I use the MP3 streaming tutorial but provide it a local URL, or is there any easier way?
Thanks in advance,
Steve
New Post: Create MP3 stream
If you want to encode MP3, then you'd need an MP3 encoder, which is not part of NAudio. Read my article on converting audio formats if you want to get a good understanding of how to convert between audio formats uning NAudio
New Post: Create MP3 stream
@kripto289: yes - that is what I want. Also, thanks for the code snippets.
@markheath: great article. Since it is just over the house LAN, I will probably start with an un-encoded stream.
New Post: Convert 32 wav to 16 wav
It was because I was playing it as a mono sound even if the signal was stereo. After I set my player to play it as a stereo sound everything was perfect! Thanks!
New Post: Capturing and mixing multiple audio streams into wave file
I was wondering if it is possible to open different audio input streams, mix them in real-time and output a wave file of the mix.
Any help would be appreciated.
New Post: Audio Recording
markheath wrote:the ACM codec that does the format conversion doesn't like extensible, so the reader format passed in should be a regular WaveFormat(44100,16,2). You could create a very simple IWaveProvider implementor that replaces the WaveFormat with one of your choosing and passes on Read to the underlying source
Mark
Can you please elaborate a bit more. I am sorry I am new to this. thank you.
New Post: Network chat with audio from multiple users simultaneously.
Hrm ... I don't have the latest code, but I haven't had any problems with the playback stopping, even if the streams start and stop. Strange ...
Regarding the distortion, I'm thinking it's probably not clipping since I can hear the "stuttering" sound even when the microphones are muted ... I hear just a faint hum that sounds choppy. The choppiness goes away when there is only one source stream. It's only when there are two (or presumably more than two) streams feeding the mixer, and only when I use a codec.
Anyway, the distortion thing isn't much of a problem because it only occurs when I use a codec, and for my purposes, I can just stream the raw audio and not worry about compression. If I use an 8k sample rate, each datagram that I send over the wire is only 800 bytes, so that ought to work out fine.
New Post: Play mp3 from stream in real-time
Please i need help. Why this code returns a random sample rate and channel? 8kHz stereo,48kHz mono,16kHz mono, 44,1kHz stereo,... ? But sound always has permanent sample rate and channel.
track has a cover, this can affect?
frame = Mp3Frame.LoadFromStream(readFullyStream);
New Post: Create MP3 stream
Update - I have it working un-encoded. Turned out to be straight forward once I had the above examples sorted out.
Jake