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

New Post: VB.NET project and IDisposable

$
0
0
I am just starting to use NAudio for my project, I am using VS 2015. My class "AudioPlayer" plays a WAV file using NAudio, it seems to work well. However I am getting a notification from CodeRush that my AudioPlayer class needs to implement IDisposable.
My class is not using any unmanaged resources so I am a little confused as to why I need to do this.
Any input would be much appreciated.
Sid

New Post: How transfer system mic audio stream to attached external sound card mic audio stream

$
0
0
Not really easy to do in C# I'm afraid. The WasapiLoopbackCapture class can capture all sound being sent to a device, so that could be used to route it to another (with a small amount of latency)
Other solutions include purchasing a virtual audio cable piece of software

New Post: VB.NET project and IDisposable

$
0
0
if your class has any disposable members, the class itself should be disposable, so it can clean up properly. I suspect you have something like WaveOut or WaveFileReader that CodeRush is noticing is disposable

New Post: ExecutionEngineException: SIGILL when attempting to parse m4a file

$
0
0
sorry, afraid I can't help you with that. Not sure mono and NAudio are a great combination. as NAudio relies heavily on interop to operating system functions

New Post: VB.NET project and IDisposable

$
0
0
Thanks Mark, I did indeed have WaveOut and AudioFileReader in my class. I have implemented IDispose.

New Post: Application has no sound output

$
0
0
Hello,
I have an application that was working and playing a WAV file selected from a listbox. It stopped working while I was adding code for a fade-out. I removed that code and even went back to an earlier commit but there is no sound output. In the latest version of application I have a progress report and I see the progression through the file.

As I said I have reverted to an earlier commit that was producing sound, it does not anymore. I can use the demo applications and they perform as expected.

Here is a code snippet from the early commit that was working but no longer does:
        mReader = New AudioFileReader(mCue.FilenameFullPath)
        mVolumeController = New SampleProviders.VolumeSampleProvider(mReader.ToSampleProvider())
        mWaveOutputDevice = New WaveOut
        mWaveOutputDevice.Init(mVolumeController)
        AddHandler mWaveOutputDevice.PlaybackStopped, AddressOf HandlePlaybackHasStopped
        mWaveOutputDevice.Play()
It is VB.NET code.

Any ideas why this has quit working?
Sid

New Post: Application has no sound output

$
0
0
check which soundcard you are playing on, and that it is not muted
By the way, audiofilereader has a volume property so you don't need a volumesamplerpovider.

New Post: Application has no sound output

$
0
0

Hi Mark,

There is only a single sound card in the VM. What I just noticed is that my application is producing a signal when I open the Windows Volume Mixer, that fader was down for some reason. I moved the fader up but still no sound output or signal shown for the Device output in the Volume Mixer. Looks like a routing issue, just don’t know how it got routed that way or how to fix it.

Sid


New Post: Application has no sound output

$
0
0
Mark, one more piece of information; I connected a USB headset to the VM and the application plays through that, however there is still no sound through the main sound card.
Would really appreciate a little help, it seems like there is some setting for the application that is being persisted so it screws up even older, previously working, verskoins.
Tnanks,
Sid

New Post: Application has no sound output

$
0
0
Hi Sidprice,
Try building the project to Release, then start the app by clicking the exe file in the bin/Release folder.

I have a similar problem with a VS2015 project (on win10). It will not play under debug for some reason. If I find out why, I will post back here. I just converted the machine from win7 to win10, so this may be a reward for that.

New Post: Application has no sound output

$
0
0

Hi Theseus, yes the sound does get played through the speakers if I build a release build. This makes me think there is some setting that is persisted. To test this hypothesis, I created a new build configuration, it was based upon the Debug configuration. When I build and run the new debug configuration it works.

So, what settings is NAudio persisting? Where are they persisted?

Sid

New Post: Application has no sound output

$
0
0
NAudio saves no settings. I'm afraid I don't know what could be causing this behaviour. I would say though that audio support in VM / RDP situations is notoriously buggy.

New Post: Application has no sound output

$
0
0

Mark, I have been developing in VMs for a very long time, in fact the previous version of the application I am working on was developed entirely in a VM.

To me this is maybe a VS2015 issue of some kind. Anyway, I have a work-around. I removed the original “Debug” configuration and renamed my new configuration “Debug” and I am back in business.

I will report back if anything reveals itself.

Thanks Theseus for suggesting trying a release build, that brought me to this work-around.

Sid

New Post: Application has no sound output

$
0
0
Sidprice,
I took your advice to reconfig my project Debug configuration. I changed it from "Any CPU" to x86. Then everything runs perfect in debug mode. My machine is x64 and I believe the VS2015 x64 Debugger is "buggy". I've had other issues with the VS2015 x64 Debugger and typically debug in x86 mode and build the release to "Any CPU" for publishing.

So hey thanks, we helped fix each others problems. Teamwork, yay! :-)

For the record, I have a straight Win10 upgrade install (no VM).

New Post: AdsrSampleProvider Not Producing Adsr Effect

$
0
0
Hi All,

_Edit: I changed the WaveOut object to NumberOfBuffers = 1 and it's now working. Now I have to figure out how to extend this class for stereo. Any advice is welcome._

I'm trying to get the AdsrSampleProvider to work. My audio plays fine through the speakers but it doesn't produce any Adsr effect to the sound. I have also tried changing the AttackSeconds and ReleaseSeconds properties with no effect. The test audio file is 16-bit mono. I've saved it to MP3 and WAV formats, but neither format produces the effect.

Here's my code. Does anyone see any obvious mistakes?
IWavePlayer waveOutDevice = null;
string fname = @"C:\TestAudio\MyAudioMono.wav";
WaveOut outputDeviceWaveOut = new WaveOut()
                {
                    DesiredLatency = 100,
                    NumberOfBuffers = 2,
                };
outputDeviceWaveOut.DeviceNumber = 0;
waveOutDevice = outputDeviceWaveOut;                
AudioFileReader arFile = new AudioFileReader(fname);  // sampler reader
AdsrSampleProvider adsrSamplr = new AdsrSampleProvider(arFile);
waveOutDevice.Init(adsrSamplr);
waveOutDevice.Play();                    
My ultimate goal is to generalize this sampler for stereo then create other samplers for effects like reverb, echo, etc. I'll be glad to share if I can get them working.

New Post: AdsrSampleProvider Not Producing Adsr Effect

$
0
0
The AdsrSampleProvider has four properties that control the effect:
        AttackSeconds
        SustainLevel
        DecayRate
        ReleaseSeconds
Is there a place where I can find valid value ranges (min and max value ) for each of these properties?

New Post: Application has no sound output

$
0
0
Hi Mark,
This problem just doesn't seem to want to go away.

Today I attached some USB headphones to my development VM to do some testing of my NAudio application, being kind to the family! It worked just fine. Later in the day I did some edits and this time I ran my application using the default sound card of the VM ... once again no sound. Closed the application, plugged the headset in and it worked! Ran the Release build and it played. I further found that if I use the VS2015 "Run without debugging" the sound plays.

I find this very strange and I am struggling to understand what is different.

If I look at the number of devices reported by WaveOut I see just 1.

One last observation; if I use "run without debugging" and then attach the debugger, the sounds works.

So the trigger for no sound seems to be using "Start Debugging".

BTW: I signed up for PluralSight and loved the NAudio course, well done!

Any input would be much appreciated,
Sid

New Post: AdsrSampleProvider Not Producing Adsr Effect

$
0
0
Hi again Theseus,
I don't know why the ADSR didn't work with more than a single buffer, however I just tried to use it myself and ran into the "mono only" issue. All my media are likely to be stereo so it would be good to get this working. Are you working on it?
Sid

New Post: AdsrSampleProvider Not Producing Adsr Effect

$
0
0
Hi sidprice,
Yes, I'm still working with the ADSR code. I'm a novice with DSP and don't yet understand how the buffers get written with the sampler so this may take a while to get it working with stereo.

New Post: FadeInOutSampleProvider

$
0
0
Hi, I am using a FadeInOutSampleProvider for my application fade in and fade out. I am looking for a way to have the file stop playing when the fade out is completed. Is there a way to do this without modifying the sample provider?

What I had in mind was to have a option "StopOnFadeOutAtSilence" if there is no other way to do this? If this option is true the provider will return zero count at silence.
Sid
Viewing all 5831 articles
Browse latest View live


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