 |
|
 |
i got the same problem running it on Windows 7 Home Premium 64-bit...
how do i solve this? please help... thanks... :3
|
|
|
|
 |
|
 |
I have spectrum signal and i want to play it's sound,
how can i do it????
modified on Monday, August 3, 2009 3:33 AM
|
|
|
|
 |
|
 |
This is really greate code you did.
It seems however the program cannot find playback devices. Is it on purpose or is it my hardware/drivers?
I need to detect certain characteristics of sound made by another program. It would be great if I could capture straight from playback.
Thank you
|
|
|
|
 |
|
 |
I never added this functionality since I was primarily interested in microphone input.
Adding this to the existing code should be straightforward.
|
|
|
|
 |
|
 |
Hi, i've been testing your project and i've to say that is very nice, i've been looking for something like this sometimes.
I've been testing different "SamplesPerSecond" values, but when using values under 11025 ( minimum is 8000) it throws an exception.
The first thing i've seen is that the buffer size for AudioFrame.Process() methodmust be dividable by 4 (len % 4 = 0).
The second is that the FourierTransform.FFT() method throws an "Index out of range exception". I've been debubbing it and i found that in line 69
tr = xre[k + n2] * c + xim[k + n2] * s;
"k + n2" is absolutely out of range, about 100 positions over the limit.
Is there any bug or is not posible to plot frequencies under 11025Hz?
Note: i am plotting using:
public void init()
{
oAudioFrame = new AudioFrame(false);
oAudioFrame.IsDetectingEvents = true;
oAudioFrame.AmplitudeThreshold = 16384;
}
public void Plot()
{
oAudioFrame.Process(ref sound_data);
oAudioFrame.RenderTimeDomainRight(ref pb1);
}
|
|
|
|
 |
|
 |
I receive this in the status window when running the source code in Vista 64-bit:
4/22/2009 4:44:10 PM : Audio input device detected
4/22/2009 4:44:10 PM : Audio input device polling stopped
When I run the executable, I get an unhandled exception and it does the same as the source if I continue:
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at SoundCatcher.FormMain.Start()
at SoundCatcher.FormMain.FormMain_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3074 (QFE.050727-3000)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
----------------------------------------
SoundCatcher
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Users/David/Documents/SoundCatcher/SoundCatcher.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3074 (QFE.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Any ideas?
|
|
|
|
 |
|
 |
This is a known issue with the wave library. Compile it using the x86 instruction set and it should work fine.
|
|
|
|
 |
|
 |
I'm not sure about this but I suspect there's a problem with your frequency spectrum. I've set your 'test' flag to true so that it works on a simple sine wave and the spectrum shows a dominant frequency with side content indicating the presence of other frequencies which simply aren't there. You should see a _single_ spike in the spectrum corresponding to the frequency of the sine wave being transformed. Otherwise, great job
|
|
|
|
 |
|
 |
What frequency? I think I may have corrected this in a later revision that I didn't post. It was a rounding error in drawing the wave if I remember correctly. I'll try to find the correction and post it here. Thanks for the constructive critcism.
|
|
|
|
 |
|
 |
I did have another thought I'll need to check...to get the single spike in the freq domain you'll need an integral number of sine wave cycles in your sample window otherwise you will see some other spurious frequency content (not sure if that is what we are seeing).
|
|
|
|
 |
|
 |
Hi, Mr. Morton!
My groupmates and I have a project in which we aim to get the the person's voice frequency so that we could tell his/her vocal range (i.e. Soprano, Alto, Bass, Tenor). We are very interested in your project here, and we would like to utilize some of your techniques. We were just wondering how we could get the frequencies. Instead of displaying it on the screen, how could we get the frequencies of the voice each second and could we possibly put the values in an array or arraylist? If so, could you help us locate the specific part of your code that could help us accomplish this?
Thank you for your time, and I hope for your reply
|
|
|
|
 |
|
 |
hi,
We have the same project, getting the persons voice frequency and analyzing their vocal range.
I would like to ask on what algorithm you are using for the project?. How would you get the voice ranges?
Thanks.
Hazel
|
|
|
|
 |
|
 |
Sounds great.
I was considering messing around with voice detection as well, although there is no serious analysis occuring in this project since I'm just triggering an event based on an amplitude threshold and not actually detecting voice.
All of the basics are covered in this project though. You would just need to elborate on what's here already.
If you succeed please upload your project so others can learn from it. I know I would be interested in seeing the results myself.
|
|
|
|
 |
|
 |
Jeff, can you help us!
How can we get the frequency each time fft is calculated?
aF was here -.-
|
|
|
|
 |
|
 |
I allready know :P
The fundamental frequency at a moment it's the maximum frequency that we get from fft
aF was here -.-
|
|
|
|
 |
|
 |
Then it would be nice if you share it with us.
|
|
|
|
 |
|
 |
Hi all,
this is a question similar to the previous:
anybody knows how can we change the audioin device from microphone to an existing wav file so we can plot the spectrogram of this file and ignore any input from the microphone?
I've played around with the FormMain.cs line
"_recorder = new WaveInRecorder(Properties.Settings.Default.SettingAudioInputDevice, _waveFormat, Properties.Settings.Default.SettingBytesPerFrame * Properties.Settings.Default.SettingChannels, 3, new BufferDoneEventHandler(DataArrived));"
and tried to change the "Properties.Settings.Default.SettingAudioInputDevice" to an integer but didn't work. I guess is not that simple.
Thanks for a great code
plouvou
|
|
|
|
 |
|
 |
I am interested in processing wave file for spectrogram too. But I don't think it would be simple task to change input to wave file by changing a couple of code lines because (1) wave file can be different in sample rate, mono or stereo, and so on and (2) microphone input signal would be relatively very short but wave file can be huge. Nevertheless, I think it is still great reference for spectrogram in c#. Thanks the author for that.
I think it would be as simple as following.
1. read wave file - read header of the file in riff format and get info about samples. I believe there are several good articles showing a way to handle wave file.
2. pass samples from #1 into Process method in AudioFrame. I think it will additionally require more code changes according to the wave file header info, e.g., mono or stereo, sample rate, etc. Also you might have to change drawing routine as program might need to draw huge data.
|
|
|
|
 |
|
 |
I suggest checking here for posts - as there are few articles covering how does the wav file look like, from that you can easily build the thing you need
|
|
|
|
 |
|
 |
I am getting the spectrogram of wav files using the same classes. Only thing is that I am playing the wav file using DirectSound or SoundPlayer and then collect the audio from lineout using wavout class. It works, but there is a great amount of noise and the frequency domain display stops after about five minutes.
|
|
|
|
 |
|
 |
Hi,
I am doing project in C# . in which I have to draw waveform for existing .wav file and also explain if wave file have 2 channels
and also I have to edit that generated wave
how can i do this anybody can help plz
Thanks,
gauri
|
|
|
|
 |
|
 |
Jeff
Very great application. And thanks for sharing the code.
Here's my one point:
Try right click or left click on the window when it's running, you'll observe drawing delay.
That's because the events raised by the timers are in the same thread of UI.
You can use System.Timers.Timer to eliminate this delay, but graphic object need to be locked to avoid multithread issues.
|
|
|
|
 |
|
 |
Hi!
Lines 67 and 71 in the file AudioFrame.cs are both like this:
if (_waveLeft[h] > AmplitudeThreshold || _waveLeft[h] < -AmplitudeThreshold)
I assume that the line 71 should actually be like this:
if (_waveRight[h] > AmplitudeThreshold || _waveRight[h] < -AmplitudeThreshold)
Anyway, thanks for the useful article!
Atis
P.S. Below is the relevant fragment of the original code:
for (int i = 0; i < wave.Length; i += 4)
{
_waveLeft[h] = (double)BitConverter.ToInt16(wave, i);
if (IsDetectingEvents == true)
if (_waveLeft[h] > AmplitudeThreshold || _waveLeft[h] < -AmplitudeThreshold)
IsEventActive = true;
_waveRight[h] = (double)BitConverter.ToInt16(wave, i + 2);
if (IsDetectingEvents == true)
if (_waveLeft[h] > AmplitudeThreshold || _waveLeft[h] < -AmplitudeThreshold)
IsEventActive = true;
h++;
}
|
|
|
|
 |
|
|
 |
|
|
 |