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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. to find starting point of a waveform

to find starting point of a waveform

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
16 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mrby123
    wrote on last edited by
    #1

    How to find the coordinates of the starting point of a waveform (stored in two columns of data: first column-time; second column-g)? The technique needs to be able to discard the noise sometime which may be before the real start point. Thank you for your start ideal and coding techniques!

    E C R A 4 Replies Last reply
    0
    • M mrby123

      How to find the coordinates of the starting point of a waveform (stored in two columns of data: first column-time; second column-g)? The technique needs to be able to discard the noise sometime which may be before the real start point. Thank you for your start ideal and coding techniques!

      E Offline
      E Offline
      Emilio Garavaglia
      wrote on last edited by
      #2

      If you mean a file made up by lines (separated by a '\n') each containing two numbers separated by a delimiter, with some spurious character at beginning, you typically need to read the file line by line, then parse each line to identify the presence of certain structural elements (digits, signs, separators etc.) Once you decide that the line looks OK, you can start to convert the (sub)strings into numbers. Another technique can make use of a circular buffer. You read the file to fill in the buffer, check the buffer contents if matching some "prerequisite" (as above), do the required conversion then discard the already read characters, and refill the buffer.

      2 bugs found. > recompile ... 65534 bugs found. :doh:

      M 1 Reply Last reply
      0
      • M mrby123

        How to find the coordinates of the starting point of a waveform (stored in two columns of data: first column-time; second column-g)? The technique needs to be able to discard the noise sometime which may be before the real start point. Thank you for your start ideal and coding techniques!

        C Offline
        C Offline
        chandu004
        wrote on last edited by
        #3

        Can you please elaborate your question? if i understood it correctly,(since you said you want to discard noise) you must be trying to strip the silence in the .Wav file and create a new .wav file. please be clear.

        -------------------------------------------- Suggestion to the members: Please prefix your main thread subject with [SOLVED] if it is solved. thanks. chandu.

        M 1 Reply Last reply
        0
        • E Emilio Garavaglia

          If you mean a file made up by lines (separated by a '\n') each containing two numbers separated by a delimiter, with some spurious character at beginning, you typically need to read the file line by line, then parse each line to identify the presence of certain structural elements (digits, signs, separators etc.) Once you decide that the line looks OK, you can start to convert the (sub)strings into numbers. Another technique can make use of a circular buffer. You read the file to fill in the buffer, check the buffer contents if matching some "prerequisite" (as above), do the required conversion then discard the already read characters, and refill the buffer.

          2 bugs found. > recompile ... 65534 bugs found. :doh:

          M Offline
          M Offline
          mrby123
          wrote on last edited by
          #4

          Thanks. This is about data processing of a seismic wave stored in a file containing two columns of data: the fist column is the time: 0, 0.0001, 0.0002, 0.0003, ...; the second column is the wave amplitude: 0.00, 0.0001, 0.00015, ...; the zero's or noise in the beginning for some time, then real wave onset come and the wave started. I need to detect the wave onset. Too bad I can not draw a picture for you here. For example, a paper here provide a way to find this onset, but too complex. Here is the link for the paper: http://www-geo.phys.ualberta.ca/~doug/papers/First-break_timing.pdf[^] I am looking a simple, better method. Thanks

          D 1 Reply Last reply
          0
          • C chandu004

            Can you please elaborate your question? if i understood it correctly,(since you said you want to discard noise) you must be trying to strip the silence in the .Wav file and create a new .wav file. please be clear.

            -------------------------------------------- Suggestion to the members: Please prefix your main thread subject with [SOLVED] if it is solved. thanks. chandu.

            M Offline
            M Offline
            mrby123
            wrote on last edited by
            #5

            I am trying to find a simple, better way than in this paper: http://www-geo.phys.ualberta.ca/~doug/papers/First-break_timing.pdf[^] This is about a method of data processing of waveform data, such as seismic or magnetic wave data.You may have a better wave to find the onset of wave. Thanks

            1 Reply Last reply
            0
            • M mrby123

              How to find the coordinates of the starting point of a waveform (stored in two columns of data: first column-time; second column-g)? The technique needs to be able to discard the noise sometime which may be before the real start point. Thank you for your start ideal and coding techniques!

              R Offline
              R Offline
              r ps
              wrote on last edited by
              #6

              My two cents. To determine starting point you need to state what charateristic of the waveform changes at the start point - frequency or amplitude of signal. For e.g. for seismic waveforms, i assume that there will be a rapid increase of amplitude of the signal at the start of the event. In this case you can determine rate of change of amplitude of a window of data. The window must be moved over the complete set. The first window in which the rate of change is above a certain threshold would contain the starting point of the waveform. [Edit] assuming you are not looking for actual code, you may have better luck posting this question in 'Algorithms' section.

              1 Reply Last reply
              0
              • M mrby123

                How to find the coordinates of the starting point of a waveform (stored in two columns of data: first column-time; second column-g)? The technique needs to be able to discard the noise sometime which may be before the real start point. Thank you for your start ideal and coding techniques!

                A Offline
                A Offline
                Alan Balkany
                wrote on last edited by
                #7

                Using regression you can find the curve that best fits the data, averaging out the noise. Then the equation of the curve will give you the starting point. See http://en.wikipedia.org/wiki/Polynomial_regression[^]

                1 Reply Last reply
                0
                • M mrby123

                  Thanks. This is about data processing of a seismic wave stored in a file containing two columns of data: the fist column is the time: 0, 0.0001, 0.0002, 0.0003, ...; the second column is the wave amplitude: 0.00, 0.0001, 0.00015, ...; the zero's or noise in the beginning for some time, then real wave onset come and the wave started. I need to detect the wave onset. Too bad I can not draw a picture for you here. For example, a paper here provide a way to find this onset, but too complex. Here is the link for the paper: http://www-geo.phys.ualberta.ca/~doug/papers/First-break_timing.pdf[^] I am looking a simple, better method. Thanks

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #8

                  mrby123 wrote:

                  Too bad I can not draw a picture for you here.

                  But you can show the relevant parts of the file, yes?

                  "One man's wage rise is another man's price increase." - Harold Wilson

                  "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                  "Man who follows car will be exhausted." - Confucius

                  M 1 Reply Last reply
                  0
                  • D David Crow

                    mrby123 wrote:

                    Too bad I can not draw a picture for you here.

                    But you can show the relevant parts of the file, yes?

                    "One man's wage rise is another man's price increase." - Harold Wilson

                    "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                    "Man who follows car will be exhausted." - Confucius

                    M Offline
                    M Offline
                    mrby123
                    wrote on last edited by
                    #9

                    This paper was trying to solve the same problem. However, the method is too complex. I need something more simple, quicker, and better than this: http://www-geo.phys.ualberta.ca/~doug/papers/First-break_timing.pdf[^] Thanks

                    D 1 Reply Last reply
                    0
                    • M mrby123

                      This paper was trying to solve the same problem. However, the method is too complex. I need something more simple, quicker, and better than this: http://www-geo.phys.ualberta.ca/~doug/papers/First-break_timing.pdf[^] Thanks

                      D Offline
                      D Offline
                      David Crow
                      wrote on last edited by
                      #10

                      Your problem is about parsing a data file that represents a waveform, correct?

                      "One man's wage rise is another man's price increase." - Harold Wilson

                      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                      "Man who follows car will be exhausted." - Confucius

                      M 1 Reply Last reply
                      0
                      • D David Crow

                        Your problem is about parsing a data file that represents a waveform, correct?

                        "One man's wage rise is another man's price increase." - Harold Wilson

                        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                        "Man who follows car will be exhausted." - Confucius

                        M Offline
                        M Offline
                        mrby123
                        wrote on last edited by
                        #11

                        Not exactly, it is about to find the onset of the waveform like that in the paper in the link.

                        D 1 Reply Last reply
                        0
                        • M mrby123

                          Not exactly, it is about to find the onset of the waveform like that in the paper in the link.

                          D Offline
                          D Offline
                          David Crow
                          wrote on last edited by
                          #12

                          mrby123 wrote:

                          ...it is about to find the onset of the waveform...

                          But you are using a data file as input for this, correct?

                          "One man's wage rise is another man's price increase." - Harold Wilson

                          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                          "Man who follows car will be exhausted." - Confucius

                          M 1 Reply Last reply
                          0
                          • D David Crow

                            mrby123 wrote:

                            ...it is about to find the onset of the waveform...

                            But you are using a data file as input for this, correct?

                            "One man's wage rise is another man's price increase." - Harold Wilson

                            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                            "Man who follows car will be exhausted." - Confucius

                            M Offline
                            M Offline
                            mrby123
                            wrote on last edited by
                            #13

                            yes. Thanks

                            D 1 Reply Last reply
                            0
                            • M mrby123

                              yes. Thanks

                              D Offline
                              D Offline
                              David Crow
                              wrote on last edited by
                              #14

                              Ok, so the problem boils down to something like:

                              FILE *pFile = fopen(...);
                              double dTime, dAmp;
                              while (fscanf("%f %f\n", &dTime, &dAmp) != EOF)
                              {
                              // analyze dTime and dAmp to know when waveform starts
                              }

                              "One man's wage rise is another man's price increase." - Harold Wilson

                              "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                              "Man who follows car will be exhausted." - Confucius

                              M 1 Reply Last reply
                              0
                              • D David Crow

                                Ok, so the problem boils down to something like:

                                FILE *pFile = fopen(...);
                                double dTime, dAmp;
                                while (fscanf("%f %f\n", &dTime, &dAmp) != EOF)
                                {
                                // analyze dTime and dAmp to know when waveform starts
                                }

                                "One man's wage rise is another man's price increase." - Harold Wilson

                                "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                                "Man who follows car will be exhausted." - Confucius

                                M Offline
                                M Offline
                                mrby123
                                wrote on last edited by
                                #15

                                Thanks. You are right on the issue. Now the key I am looking for is the technique to detect the onset. What is the robust criterion to determine the onset of the wave, while the noise in the data will not confuse the determination? Thanks for smart thought.

                                D 1 Reply Last reply
                                0
                                • M mrby123

                                  Thanks. You are right on the issue. Now the key I am looking for is the technique to detect the onset. What is the robust criterion to determine the onset of the wave, while the noise in the data will not confuse the determination? Thanks for smart thought.

                                  D Offline
                                  D Offline
                                  David Crow
                                  wrote on last edited by
                                  #16

                                  mrby123 wrote:

                                  Thanks. You are right on the issue.

                                  Which is what I was trying to get at three posts ago.

                                  mrby123 wrote:

                                  Now the key I am looking for is the technique to detect the onset. What is the robust criterion to determine the onset of the wave, while the noise in the data will not confuse the determination?

                                  Only you can determine what is noise and what is not. When you are dealing with floating-point numbers, you can't check a number being exactly equal to 0. You'll have to compare against something like epsilon.

                                  "One man's wage rise is another man's price increase." - Harold Wilson

                                  "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                                  "Man who follows car will be exhausted." - Confucius

                                  1 Reply Last reply
                                  0
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  • Login

                                  • Don't have an account? Register

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