Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
B

Brandon X

@Brandon X
About
Posts
9
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Projects/Libraries On Tuning?
    B Brandon X

    Goodness. The more I dig into this project, the more I realize I don't know what I'm doing. Sorry for the delay in responding, been busy at work. I have today off from work for New Year's. For the record, I am recording my samples using the regular Windows XP sound recorder (sndrec32.exe -- you can bring it up if you click Start -> Run, and type 'sndrec32') and have set the select under File -> Properties -> "Convert Now" -> to Format as "PCM" and the attributes to "44100khz at 16 bit Mono". Since I'm recording in Mono, I didn't bother splitting the channels out as the original author did like so in his Process():

    // Split out channels from sample
    int h = 0;
    for (int i = 0; i < wave.Length; i += 4)
    {
    _waveLeft[h] = (double)BitConverter.ToInt16(wave, i);
    _waveRight[h] = (double)BitConverter.ToInt16(wave, i + 2);
    h++;
    }

    Thanks for clarifying that I didn't need to split the arrays back together (d'oh!). I'm a bit confused on how that is supposed to work though? If I am passing to my Process() function an array of bytes[16384] from the WAV File - isn't this data from the first few seconds of the WAV file? (Remember, I am jumping 44 bytes into the WAV file, reading from that position to the end of the file, and then splitting that array into byte[16384] each into a List<byte[]> ) The reason I ask is because as soon as I hit "Record" I don't immediately play my guitar string. Thus, wouldn't the first second or so of the WAV file be silence - so thus the first 16384 bytes be unusable to me? :doh: If this is incorrect, forgive me - but only reason I ask is because although I've adjusted my code now to only bother with a 16kb sample, I am still getting different maximum magnitudes when I iterate over my array for each WAV file (although they are the same note & string) played on my guitar.) Also, I am still a bit lost on your frequency formula's you had earlier. You said in your original post:

    Now, if fe. your fi = 50, sample_rate = 44100 (which is standard value),
    and you will catch 4096 samples (which means, your T tables has length od 4096, and that means, your F table has length of 4096),
    the most significant frequency in your sound probe is:
    Freq = 50 * (44100 / 4096)

    which I simply translated to be in code:

    double freq = _MaxFoundValue * (SampleRate / _outputSample.Length);

    but

    C# csharp com question

  • Saving file using WebBrowser control
    B Brandon X

    I believe the WebBrowser class also has properties .Document and .DocumentText see this: http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.document(VS.85).aspx[^] as well as: http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.documenttext(VS.85).aspx[^] in the past for simple stuff I've just saved off the .DocumentText stuff to a file since I was just populating simple html to the control; but whatevers clever for you.

    C# help question

  • capture screenshot without current window
    B Brandon X

    Yeah, I've done the same before. When the user clicks the button to take the screen shot, I fire a timer that sets the forms.visible property to false, then take the screen shot, and then form.visible becomes true when finished executing. wrap it around a try catch finally to make sure the form always comes back into view, i suppose; for saftey's sake.

    C#

  • Projects/Libraries On Tuning?
    B Brandon X

    Ugh. Back from work late and I must be doing something wrong. (Warning, big post ahead). I wanted to see how the code would work on recorded samples, so I recorded 3 WAV files, each one for my low string E on my guitar. Thus, the three WAV files should produce the same data, correct? By this I mean the magnitude I would assume would be roughly the same for all three files; since they are the same note & same string on the guitar. (I basically plucked the string and recorded, and repeated that 3 times). But that is not the case. Here is how I went about it: In code, I jump to 44 bytes into the WAV file (which is where the WAV data actually starts) and read that whole thing into a big byte array (so, byte[] arrDataToProcess). Now, from the previous mentioned project above, I see where his FFT library processes the data in 16 bit samples (16384) - so I split arrDataToProcess into a List<byte[]> lstArraysToProcess of 16384 each; then feed each one into a method that converts the bytes to doubles, and then call the FFT on that:

    public static double[] Process(ref byte[] wave)
    {
    double[] _fftDataToReturn;
    double[] _waveDataToProcess = new double[wave.Length / 4];

            int h = 0;
            for (int i = 0; i < wave.Length; i+=4)
            {
                \_waveDataToProcess\[h\] = (double)BitConverter.ToInt16(wave, i);
                h++;
            }
            \_fftDataToReturn = SoundCatcher.FourierTransform.FFT(ref \_waveDataToProcess);
            return \_fftDataToReturn;
        }
    

    the SoundCatcher.FourierTransform.FFT(ref _waveDataToProcess) method as seen above looks like so (warning, large code block ahead):

    static public double[] FFT(ref double[] x)
    {
    // Assume n is a power of 2
    n = x.Length;
    nu = (int)(Math.Log(n) / Math.Log(2));
    int n2 = n / 2;
    int nu1 = nu - 1;
    double[] xre = new double[n];
    double[] xim = new double[n];
    double[] magnitude = new double[n2];
    double[] decibel = new double[n2];
    double tr, ti, p, arg, c, s;
    for (int i = 0; i < n; i++)
    {
    xre[i] = x[i];
    xim[i] = 0.0f;
    }
    int k = 0;
    for (int l = 1; l <= nu; l++)
    {
    while ((k < n))
    {
    for (int i = 1; i <= n2; i++)

    C# csharp com question

  • Projects/Libraries On Tuning?
    B Brandon X

    My god man. I think this is quite possibly the most helpful reply I've gotten on the internet ***ever***. :) Thank you for your time. I think with this information I should be able to cook up some code now. Many thanks, Brandon.

    C# csharp com question

  • Projects/Libraries On Tuning?
    B Brandon X

    Thanks for the reply. Using the above project I mentioned, I have an example to follow for capturing live mic input; however I'm lost on the FFT. In the above mentioned project, he has a FFT class (which I would happily copy and paste, except that it would make this post hard to read) that takes an array of doubles and that will spit back out an array of doubles, but I'm not sure exactly what to do with them? Plot them? I guess where I'm currently stuck is that I don't understand at all the FFT - other than it is a method for computing a wave?? I think I may go to the local community college library and check out a few books to bring myself up to speed. Do you have a writeup, kind sir, of your project? If not, may I ask which library you used for your FFT? Or - if you know of any excellent articles that you could refer me to in getting started (because I don't fully understand either the sampling rate, etc) would be of most help. Thank you for your time, Brandon.

    C# csharp com question

  • Projects/Libraries On Tuning?
    B Brandon X

    I've been kicking around the idea now of writing a guitar tuner in C#; but I've no idea on where to begin. Specifically I've seen excellent articles such as: http://www.codeproject.com/KB/audio-video/SoundCatcher.aspx[^] which will let me plot a wav file in real time; but I need to be able to calculate (I suppose, anyway) the pitch of a sample, correct? In other words: 1. Suppose I have a WAV file looping that is playing a guitar string, say E, that is in tune. 2. I want to take the project mentioned above, and put a mic on my guitar and play my E string over and over... 3. I'd like to be able to tell if my E string that I am playing is in tune with the recorded WAV file... For that, I'd need to be able to calculate pitch, correct? Is there a library to be able to do this? If not, could anyone kindly give me pointers on where to begin? Many thanks, Brandon.

    C# csharp com question

  • Audio/Acoustic Fingerprinting
    B Brandon X

    Hey everyone, Question... is anyone aware of an SDK or a library that will do audio/acoustic fingerprinting? If not; is anyone willing to help write one? *grin* In case you're not aware of what I'm talking about - it's the same technology that you see nowadays in the iPhone or what have you ... you hold your phone up to the TV or radio while you listen to a tune that you like; but you're not sure who the song is by... give your phone about 30 seconds, and it returns back to you the name of the song and the artist. Is there any open source library or SDK that anyone is aware of that could get us coders started on some projects? I'm not interested in creating another "what song was that?" recognition application; but rather something different. Anyways, having such a library would be awesome. Or, if anyone is willing; could someone give me a few pointers on what it would take to write such a library? I'd imagine there is some sort of hard math involved to figure out patters and peaks; etc to a song. Does anyone know of the research that it would take to make it happen? Thanks for reading - Brandon.

    .NET (Core and Framework) question ios help

  • VNC Implementation in VB.NET
    B Brandon X

    To All, This is something totally out of my league; but I wanted to know; so I was wondering if someone might point me in the right direction to get started... What would I have to do to try and write my own VNC like control for a server/viewer much like this one? (http://cdot.senecac.on.ca/projects/vncsharp/quickstart.html) I used that control in my project only to discover that (had I been paying attention) it was only a viewer control. I wanted to build an app that emulated VNC with file transfer capabilities; etc. So.. where would I start? I don't want to try and re-invent the wheel; but I don't want to distribute two apps (a server like app that would allow me to get the remote computer's drive information and then spit that to my viewer control -- that in addition to having to send over a distro of VNC like Ultra or Tight VNC). I'm at a loss guys; what would I have to learn? Thanks all, -Randy

    Visual Basic csharp html sysadmin question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups