Soundcard programming (freq meter)

Could somebody help me to make code which counts how many rising edges comes during 20ms ? I feed square wave to MIC plug. 20ms should be variable, so I could change it afterwards.

I am just trying to count frequency of pulses.

Square wave comes from pulse sensor or tooth gear with proximity sensor or hall-effect sensor.

All kind of help is very welcome.

Comments

  • : Could somebody help me to make code which counts how many rising edges comes during 20ms ? I feed square wave to MIC plug. 20ms should be variable, so I could change it afterwards.
    :
    : I am just trying to count frequency of pulses.
    :
    : Square wave comes from pulse sensor or tooth gear with proximity sensor or hall-effect sensor.
    :
    : All kind of help is very welcome.
    :
    :


    hi!
    well i will try to make my best!

    first problem
    first the mic in, is a condecer microphone whice means that
    it work on capacitance, so it means you cant realy plug a voltage
    to the mic connector it wont work! so if you could point me
    how you gonna plug it in. i really want to know.
    if you solve that problem and you simply want to sample the sound
    you should try this site it have source code in c.

    http://www.cae.wisc.edu/~brodskye/other/code.html#SB16SND

    second problem
    if you need to know the time that past since the last clock
    then you need to work with the 8254 timer. you can mesure time
    in microsecond in c. it is easy. read port 64 and you need to
    know that each clock is aproximatly 1 us, i will keep it up to you to figure out the exect time

    third problem
    if you use xp you need a low level function to use the port
    here is a site that as free function

    http://www.lvr.com/parport.htm

    so what language are you writing in?
    thats it i hope.
    good luck!

  • : hi!
    : well i will try to make my best!
    :
    : first problem
    : first the mic in, is a condecer microphone whice means that
    : it work on capacitance, so it means you cant realy plug a voltage
    : to the mic connector it wont work! so if you could point me
    : how you gonna plug it in. i really want to know.
    : if you solve that problem and you simply want to sample the sound
    : you should try this site it have source code in c.
    :
    : http://www.cae.wisc.edu/~brodskye/other/code.html#SB16SND
    :
    : second problem
    : if you need to know the time that past since the last clock
    : then you need to work with the 8254 timer. you can mesure time
    : in microsecond in c. it is easy. read port 64 and you need to
    : know that each clock is aproximatly 1 us, i will keep it up to you to figure out the exect time
    :
    : third problem
    : if you use xp you need a low level function to use the port
    : here is a site that as free function
    :
    : http://www.lvr.com/parport.htm
    :
    : so what language are you writing in?
    : thats it i hope.
    : good luck!
    :
    :
    I have connected my frequency generator to mic plug and also pulse sensors output. Am I doing something wrong ?

    Anyway, when recording wav I got square wave when plotting wav.

    I have almost ready code for recording and signal dispaying on the screen.

    But I can't figure out how to calculate freq of pulses ???

    Do you know how sensor out should be connected to mic plug ?


  • : : hi!
    : : well i will try to make my best!
    : :
    : : first problem
    : : first the mic in, is a condecer microphone whice means that
    : : it work on capacitance, so it means you cant realy plug a voltage
    : : to the mic connector it wont work! so if you could point me
    : : how you gonna plug it in. i really want to know.
    : : if you solve that problem and you simply want to sample the sound
    : : you should try this site it have source code in c.
    : :
    : : http://www.cae.wisc.edu/~brodskye/other/code.html#SB16SND
    : :
    : : second problem
    : : if you need to know the time that past since the last clock
    : : then you need to work with the 8254 timer. you can mesure time
    : : in microsecond in c. it is easy. read port 64 and you need to
    : : know that each clock is aproximatly 1 us, i will keep it up to you to figure out the exect time
    : :
    : : third problem
    : : if you use xp you need a low level function to use the port
    : : here is a site that as free function
    : :
    : : http://www.lvr.com/parport.htm
    : :
    : : so what language are you writing in?
    : : thats it i hope.
    : : good luck!
    : :
    : :
    : I have connected my frequency generator to mic plug and also pulse sensors output. Am I doing something wrong ?
    :
    : Anyway, when recording wav I got square wave when plotting wav.
    :
    : I have almost ready code for recording and signal dispaying on the screen.
    :
    : But I can't figure out how to calculate freq of pulses ???
    :
    : Do you know how sensor out should be connected to mic plug ?
    :
    :
    :
    for your question
    Do you know how sensor out should be connected to mic plug ?
    i have no idea! i know that i try to connect voltage to mic plug
    and i failed recording.

    about calculate freqency i dont understand the problem. if you are recording sound using waverecorder you should know the frequency sample.
    you know how much time is an interval between each sample data of the buffer. and i must mention you have easy life cause you need to know the frequency of squere wave.
    so the formula is this -->

    freq = 1 / (number_of_sample_since the last_pulse_on * sample_period_of one_data_at_array).

    i see one problem and that is your duty cycle change but the formula
    is witout change.

    if you are using to sample sound direct from microphone you dont have sample rate. and you need to make your clock. in order to know how much time is on interval in your buffer. "in wav read the interval is fix"
    so you must use the timer.






  • : : : hi!
    : : : well i will try to make my best!
    : : :
    : : : first problem
    : : : first the mic in, is a condecer microphone whice means that
    : : : it work on capacitance, so it means you cant realy plug a voltage
    : : : to the mic connector it wont work! so if you could point me
    : : : how you gonna plug it in. i really want to know.
    : : : if you solve that problem and you simply want to sample the sound
    : : : you should try this site it have source code in c.
    : : :
    : : : http://www.cae.wisc.edu/~brodskye/other/code.html#SB16SND
    : : :
    : : : second problem
    : : : if you need to know the time that past since the last clock
    : : : then you need to work with the 8254 timer. you can mesure time
    : : : in microsecond in c. it is easy. read port 64 and you need to
    : : : know that each clock is aproximatly 1 us, i will keep it up to you to figure out the exect time
    : : :
    : : : third problem
    : : : if you use xp you need a low level function to use the port
    : : : here is a site that as free function
    : : :
    : : : http://www.lvr.com/parport.htm
    : : :
    : : : so what language are you writing in?
    : : : thats it i hope.
    : : : good luck!
    : : :
    : : :
    : : I have connected my frequency generator to mic plug and also pulse sensors output. Am I doing something wrong ?
    : :
    : : Anyway, when recording wav I got square wave when plotting wav.
    : :
    : : I have almost ready code for recording and signal dispaying on the screen.
    : :
    : : But I can't figure out how to calculate freq of pulses ???
    : :
    : : Do you know how sensor out should be connected to mic plug ?
    : :
    : :
    : :
    : for your question
    : Do you know how sensor out should be connected to mic plug ?
    : i have no idea! i know that i try to connect voltage to mic plug
    : and i failed recording.
    :
    : about calculate freqency i dont understand the problem. if you are recording sound using waverecorder you should know the frequency sample.
    : you know how much time is an interval between each sample data of the buffer. and i must mention you have easy life cause you need to know the frequency of squere wave.
    : so the formula is this -->
    :
    : freq = 1 / (number_of_sample_since the last_pulse_on * sample_period_of one_data_at_array).
    :
    : i see one problem and that is your duty cycle change but the formula
    : is witout change.
    :
    : if you are using to sample sound direct from microphone you dont have sample rate. and you need to make your clock. in order to know how much time is on interval in your buffer. "in wav read the interval is fix"
    : so you must use the timer.
    :
    :
    :
    :
    :
    :
    :
    Thanks ! Do you think it is possible to acquire freq let's say with 20ms interrupts ? and same time show freq at screen.

    Realtime DAQ ?


  • jasonjason United Kingdom
    > first problem
    > first the mic in, is a condecer microphone whice means that
    > it work on capacitance, so it means you cant realy plug a voltage
    > to the mic connector it wont work! so if you could point me
    > how you gonna plug it in. i really want to know.
    > if you solve that problem and you simply want to sample the sound
    > you should try this site it have source code in c.

    This is wrong. You're not plugging a microphone in so the type is irrelevent. You can insert a voltage into the microphone port, however you need to limit the voltage to avoid overloading the circuitry.

    Regards, Jason
  • : > first problem
    : > first the mic in, is a condecer microphone whice means that
    : > it work on capacitance, so it means you cant realy plug a voltage
    : > to the mic connector it wont work! so if you could point me
    : > how you gonna plug it in. i really want to know.
    : > if you solve that problem and you simply want to sample the sound
    : > you should try this site it have source code in c.
    :
    : This is wrong. You're not plugging a microphone in so the type is irrelevent. You can insert a voltage into the microphone port, however you need to limit the voltage to avoid overloading the circuitry.
    :
    : Regards, Jason
    :


    That is what I think also. Joystick port works on capacitance.

    Rgrds,

    Harri

  • it is getting long so all the document will be below

    if you want to do it with interrupts that is ok.
    if you know how to make an interrupt every 20ms
    i guess you raplce the currsor interrupt. so it happen every 18ms.
    if you want much faster i can explain you how to do it.

    to print it on screen the best option is use direct memory if
    you failed to do the two thinks together in realtime and with the
    tools that the language gives you.
    if you use to program in c. if not you need more understanding
    on the language you are using. and their are several options
    the best option is to try all the things.


    : : : : hi!
    : : : : well i will try to make my best!
    : : : :
    : : : : first problem
    : : : : first the mic in, is a condecer microphone whice means that
    : : : : it work on capacitance, so it means you cant realy plug a voltage
    : : : : to the mic connector it wont work! so if you could point me
    : : : : how you gonna plug it in. i really want to know.
    : : : : if you solve that problem and you simply want to sample the sound
    : : : : you should try this site it have source code in c.
    : : : :
    : : : : http://www.cae.wisc.edu/~brodskye/other/code.html#SB16SND
    : : : :
    : : : : second problem
    : : : : if you need to know the time that past since the last clock
    : : : : then you need to work with the 8254 timer. you can mesure time
    : : : : in microsecond in c. it is easy. read port 64 and you need to
    : : : : know that each clock is aproximatly 1 us, i will keep it up to you to figure out the exect time
    : : : :
    : : : : third problem
    : : : : if you use xp you need a low level function to use the port
    : : : : here is a site that as free function
    : : : :
    : : : : http://www.lvr.com/parport.htm
    : : : :
    : : : : so what language are you writing in?
    : : : : thats it i hope.
    : : : : good luck!
    : : : :
    : : : :
    : : : I have connected my frequency generator to mic plug and also pulse sensors output. Am I doing something wrong ?
    : : :
    : : : Anyway, when recording wav I got square wave when plotting wav.
    : : :
    : : : I have almost ready code for recording and signal dispaying on the screen.
    : : :
    : : : But I can't figure out how to calculate freq of pulses ???
    : : :
    : : : Do you know how sensor out should be connected to mic plug ?
    : : :
    : : :
    : : :
    : : for your question
    : : Do you know how sensor out should be connected to mic plug ?
    : : i have no idea! i know that i try to connect voltage to mic plug
    : : and i failed recording.
    : :
    : : about calculate freqency i dont understand the problem. if you are recording sound using waverecorder you should know the frequency sample.
    : : you know how much time is an interval between each sample data of the buffer. and i must mention you have easy life cause you need to know the frequency of squere wave.
    : : so the formula is this -->
    : :
    : : freq = 1 / (number_of_sample_since the last_pulse_on * sample_period_of one_data_at_array).
    : :
    : : i see one problem and that is your duty cycle change but the formula
    : : is witout change.
    : :
    : : if you are using to sample sound direct from microphone you dont have sample rate. and you need to make your clock. in order to know how much time is on interval in your buffer. "in wav read the interval is fix"
    : : so you must use the timer.
    : :
    : :
    : :
    : :
    : :
    : :
    : :
    : Thanks ! Do you think it is possible to acquire freq let's say with 20ms interrupts ? and same time show freq at screen.
    :
    : Realtime DAQ ?
    :
    :
    :

  • : : > first problem
    : : > first the mic in, is a condecer microphone whice means that
    : : > it work on capacitance, so it means you cant realy plug a voltage
    : : > to the mic connector it wont work! so if you could point me
    : : > how you gonna plug it in. i really want to know.
    : : > if you solve that problem and you simply want to sample the sound
    : : > you should try this site it have source code in c.
    : :
    : : This is wrong. You're not plugging a microphone in so the type is irrelevent. You can insert a voltage into the microphone port, however you need to limit the voltage to avoid overloading the circuitry.
    : :
    : : Regards, Jason
    : :
    :
    :
    : That is what I think also. Joystick port works on capacitance.
    :
    : Rgrds,
    :
    : Harri
    :
    :

    maby i wrong. but i try it and failed. so i ask another person and he
    point me to learn more about condencer microphone.
    i mesure the voltage through the plug of the mic and i discover
    that the computer supply voltage to the microphone. so really the microphone must be "dc microphone" --> condencer microphone.
    maby we are not using the same computer. i dont know how it possible that you supply to the microphone voltage through the plug.
    have you try it yet?
    if not i can find you substitute for that problem.
    like using simple low cost 8 bit AD chip that is suitable for your need.

  • Also I would like to know how soundcard based freq ( oscilloscopes works ? Not hole truth, but how that real time screen updating is arranged ?

    With some small interrupts or how ?

    Also when recording wav, I assume it goes to some array. What kind of value that is (raw data), is it amplitude or what ? Each sample contains some value, is it amplitude ?














    : : : > first problem
    : : : > first the mic in, is a condecer microphone whice means that
    : : : > it work on capacitance, so it means you cant realy plug a voltage
    : : : > to the mic connector it wont work! so if you could point me
    : : : > how you gonna plug it in. i really want to know.
    : : : > if you solve that problem and you simply want to sample the sound
    : : : > you should try this site it have source code in c.
    : : :
    : : : This is wrong. You're not plugging a microphone in so the type is irrelevent. You can insert a voltage into the microphone port, however you need to limit the voltage to avoid overloading the circuitry.
    : : :
    : : : Regards, Jason
    : : :
    : :
    : :
    : : That is what I think also. Joystick port works on capacitance.
    : :
    : : Rgrds,
    : :
    : : Harri
    : :
    : :
    :
    : maby i wrong. but i try it and failed. so i ask another person and he
    : point me to learn more about condencer microphone.
    : i mesure the voltage through the plug of the mic and i discover
    : that the computer supply voltage to the microphone. so really the microphone must be "dc microphone" --> condencer microphone.
    : maby we are not using the same computer. i dont know how it possible that you supply to the microphone voltage through the plug.
    : have you try it yet?
    : if not i can find you substitute for that problem.
    : like using simple low cost 8 bit AD chip that is suitable for your need.
    :
    :

  • jasonjason United Kingdom
    : Also I would like to know how soundcard based freq ( oscilloscopes works ? Not hole truth, but how that real time screen updating is arranged ?
    :
    : With some small interrupts or how ?
    :
    : Also when recording wav, I assume it goes to some array. What kind of value that is (raw data), is it amplitude or what ? Each sample contains some value, is it amplitude ?
    :

    Yes, the amplitude of a wave is stored in the array.

    An software oscilloscope works by plotting the amplitude of the wave on the y-axis. Could use a timer to know when to next update the screen. Your callback function which updates the screen is called when the timer ends. Need to program some sort of timebase to plot the amplitude across the screen.

    Regards Jason

  • sound card based frequency measurement is limited upto 20KHz.
    first u should try real-time time-domain analysis and then try the fourier transforms to find out the frequency spectrum.
    can u specify the tools you are using to develop the program.

    bye
    srikanth
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories