Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2008

Tip: Looking for answers? Try searching our database.

Java Audio question - PLEASE HELP

Thread view: 
cpptutor2000@yahoo.com - 13 Apr 2008 21:44 GMT
Could some DSP or Java guru please help me ? I have a simple Java
application that records audio signals and does simple analysis on the
collected data. I am using PCM encoding, with sampling frequency 16000
Hz, 16 bits resolution, single or mono channel, little endian and
signed.

The data is read into a ByteArrayOutputStream and then as soon as I
stop recording, the stream contents are written to a byte array, using
'toByteArray()'. After that, I can get the size of this byte array,
which gives me the total number of bytes collected, keeping in mind
that I am using 16 bit resolution, i.e., each sound sample is 16 bits
long. I am using a software tone generator, with the frequency set at
500.0 Hertz.

Now, from simple DSP principles, we know that if the number of samples
collected is 'n' and the sampling frequency is 'fs', then the time
needed to collect these 'n' samples is n/fs, and the fundamental
frequency recorded is the inverse of this time value.

However, I am only getting frequencies as low as 7 Hz, or 8Hz, which
is just absurd. Could someone please tell me if I am doing something
totally incorrect, or where the flaw in my reasoning is. Any help
would be greatly appreciated. Thanks in advance for your help.
Vladimir Vassilevsky - 13 Apr 2008 22:07 GMT
> Could some DSP or Java guru please help me ? I have a simple Java
> application that records audio signals and does simple analysis on the
[quoted text clipped - 19 lines]
> totally incorrect, or where the flaw in my reasoning is. Any help
> would be greatly appreciated. Thanks in advance for your help.

Once I was asked to make a portable program in Java which should do some
signal processing using the low level waveform I/O.

That appeared to be impossible because of many weird problems (mainly
with the different JVM drivers).

So, don't try to use Java for the signal processing, especially at the
waveform i/o level and in the real time. Java is not for that.

Vladimir Vassilevsky
DSP and Mixed Signal Design Consultant
http://www.abvolt.com
Kenneth P. Turvey - 13 Apr 2008 23:46 GMT
>> Could some DSP or Java guru please help me ? I have a simple Java
>> application that records audio signals and does simple analysis on the
[quoted text clipped - 28 lines]
> So, don't try to use Java for the signal processing, especially at the
> waveform i/o level and in the real time. Java is not for that.

Can you elaborate on what the problems were.  This really shouldn't be a
problem for Java.  I just can't imagine why it would be.

Signature

Kenneth P. Turvey <kt-usenet@squeakydolphin.com>

Vladimir Vassilevsky - 14 Apr 2008 00:23 GMT
>>Once I was asked to make a portable program in Java which should do some
>>signal processing using the low level waveform I/O.
[quoted text clipped - 7 lines]
> Can you elaborate on what the problems were.  This really shouldn't be a
> problem for Java.  I just can't imagine why it would be.

The task was a special modem operating via the sound card continuously.
It worked fine in Win32/C++, however they wanted to make it platform
independent in Java, so they could use the same code in Windows and for
the different flavors of Linux. There were problems with the
interruptions of the continuous flow of the waveform data depending on
the particular JVM and the particular drivers.

Vladimir Vassilevsky
DSP and Mixed Signal Design Consultant
http://www.abvolt.com
Kenneth P. Turvey - 14 Apr 2008 01:52 GMT
> The task was a special modem operating via the sound card continuously.
> It worked fine in Win32/C++, however they wanted to make it platform
> independent in Java, so they could use the same code in Windows and for
> the different flavors of Linux. There were problems with the
> interruptions of the continuous flow of the waveform data depending on
> the particular JVM and the particular drivers.

That's strange.  I could see garbage collection being a problem, but one
would think that such things have a sufficient buffer to make short
delays inconsequential.  I guess not.

Signature

Kenneth P. Turvey <kt-usenet@squeakydolphin.com>

Arne Vajhøj - 14 Apr 2008 02:36 GMT
>> The task was a special modem operating via the sound card continuously.
>> It worked fine in Win32/C++, however they wanted to make it platform
[quoted text clipped - 6 lines]
> would think that such things have a sufficient buffer to make short
> delays inconsequential.  I guess not.

GC is very efficient but had poor real time characteristics.

Often the problems can be resolved by tuning the GC via the many
JVM parameters to do so.

Arne
Vladimir Vassilevsky - 14 Apr 2008 14:38 GMT
>>> The task was a special modem operating via the sound card continuously.
>>> It worked fine in Win32/C++, however they wanted to make it platform
[quoted text clipped - 11 lines]
> Often the problems can be resolved by tuning the GC via the many
> JVM parameters to do so.

Exactly. To make it work, I had to tweak many not so obvious parameters
depending on the particular OS, JVM and drivers. That broke the whole
idea of being independent from the platform.

Vladimir Vassilevsky
DSP and Mixed Signal Design Consultant
http://www.abvolt.com
glen herrmannsfeldt - 14 Apr 2008 19:04 GMT
(snip)
(snip)

>> GC is very efficient but had poor real time characteristics.

>> Often the problems can be resolved by tuning the GC via the many
>> JVM parameters to do so.

> Exactly. To make it work, I had to tweak many not so obvious parameters
> depending on the particular OS, JVM and drivers. That broke the whole
> idea of being independent from the platform.

Platform independence, or even a different model of the same platform,
has always excluded speed.  That is, a program may run faster or slower
but it will give the correct output (bits).  Unfortunately, audio
depends not only on the bits but the speed.

-- glen
Arne Vajhøj - 15 Apr 2008 02:22 GMT
>> GC is very efficient but had poor real time characteristics.
>>
[quoted text clipped - 4 lines]
> depending on the particular OS, JVM and drivers. That broke the whole
> idea of being independent from the platform.

You did not have to change the code or even rebuild just the
modify the configuration.

It happen - also for other problem domains than real time.

Arne
Peter Duniho - 13 Apr 2008 22:14 GMT
> [...]
> Now, from simple DSP principles, we know that if the number of samples
> collected is 'n' and the sampling frequency is 'fs', then the time
> needed to collect these 'n' samples is n/fs, and the fundamental
> frequency recorded is the inverse of this time value.

What's the difference between "sampling frequency" and "fundamental  
frequency"?  If "fs" is your sampling frequency, then "fs/n" (i.e. "the  
inverse of this time value") is a meaningless "per second" value, because  
you've removed the "samples" part of the formula.

For example, let's consider a sampling rate of 10 Hz.  If you have 10  
samples, then your "fs/n" value is "1/second".  But if you have 20  
samples, without changing the actual sampling rate, your "fs/n" value is  
"0.5/second" or "1/(2 seconds)".  The actual sampling rate hasn't changed,  
but your calculated value -- whatever it's meant to represent -- is  
changing.

Obviously lengthing the amount of time so that you can get more samples  
doesn't actually change the sampling rate.  So if you're trying to use  
that "fs/n" to map back to some sort of useful number related to the rate  
at which you're sampling, or an audio frequency that you can record, it's  
not going to actually do that.  "fs/n" is an arbitrary value that is  
simply the reciprocal of the number of seconds over which you  
recorded...it has nothing to do with the underlying nature of the data  
you've recorded, other than being a direct (albeit inverse) measure of the  
time duration of the recording.

> However, I am only getting frequencies as low as 7 Hz, or 8Hz, which
> is just absurd. Could someone please tell me if I am doing something
> totally incorrect, or where the flaw in my reasoning is. Any help
> would be greatly appreciated. Thanks in advance for your help.

Perhaps you could be more specific about how you're doing the recording.  
A concise-but-complete code sample would not be unreasonable here.  That  
would allow us to precisely know just how you're capturing the audio data,  
as well as how you're calculating your frequencies.

From your paragraph about "fundamental frequency", I think there's a  
possibility that you're simply not calculating the "frequency" correctly.  
You should first be more clear about what frequency it is you really want  
to calculate (are you looking for the sampling frequency here?).  And you  
should show the code you're using to do that calculation.

Also, "PCM" is by itself somewhat ambiguous.  There are some PCM formats  
that do some rudimentary compression, by encoding each sample as a  
difference from the previous sample (and there are multiple variations on  
that technique).

If your frequency calculation is correct (which hasn't been shown to be  
true yet), and you can take the bytes you saved, group them in twos and  
send them back out to an audio playback interface that takes raw,  
uncompressed samples and they sound correct, then I'd agree something's  
fishy.  But I think it's more likely that either the calculation is simply  
wrong, or that if you treat those bytes as raw, uncompressed samples,  
you'll get garbage trying to play them back.

In other words, I think it's more likely there's a mistake on your part  
than that there's something fishy going on.  But then, I get the  
impression you know that.  :)  So really, the key here is for you to  
provide enough information for someone to explain what your mistake is.  
So far, you haven't.

Pete
glen herrmannsfeldt - 14 Apr 2008 19:18 GMT
>> [...]
>> Now, from simple DSP principles, we know that if the number of samples
>> collected is 'n' and the sampling frequency is 'fs', then the time
>> needed to collect these 'n' samples is n/fs, and the fundamental
>> frequency recorded is the inverse of this time value.

> What's the difference between "sampling frequency" and "fundamental  
> frequency"?  If "fs" is your sampling frequency, then "fs/n" (i.e. "the  
> inverse of this time value") is a meaningless "per second" value,
> because  you've removed the "samples" part of the formula.

If you have n samples and sampling frequency fs then fs/n is the
lowest frequency you get from, for example, an FFT.  That is,
the lowest frequency periodic in n samples.  Whether that should
be called fundamental or not, I don't know.

-- glen
cpptutor2000@yahoo.com - 23 Apr 2008 04:48 GMT
With reference to all the postings I am sorry I have caused confusion
about what I meant by the 'fundamental frequency' etc., May I give a
simple example?

For a given signal being sampled for analysis, the number of points
obtained and the time between samples combine to determine the total
length of time taken to examine the signal. The following definitions
apply:
  fs = sample rate in Hz
  dT = 1/fs = interval between samples
  N = number of samples taken
  T = N x dT = total time period

  f1 = 1/T = frequency of the first harmonic in Hz
Keeping these points in mind, I have found that f1 in my case is
around 7 Hz. I am NOT measuring 7 Hz. If I were to take an FFT of the
collected data, then I can expect to get peaks that are harmonics of 7
Hz. That is if I were to detect if the 500.0 Hz signal of the tone
generator was being picked up, I would have look for the 500/7
harmonic of 7 Hz. I hope I have made myself clear about what I am
trying to do.

On Apr 13, 4:14 pm, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:
> On Sun, 13 Apr 2008 13:44:36 -0700, cpptutor2...@yahoo.com
>
[quoted text clipped - 63 lines]
>
> Pete
Lew - 23 Apr 2008 05:04 GMT
> With reference to all the postings I am sorry I have caused confusion
> about what I meant by the 'fundamental frequency' etc., May I give a
> simple example?

Sure, but please do not top-post, and please do trim what you quote.

> For a given signal being sampled for analysis, the number of points
> obtained and the time between samples combine to determine the total
[quoted text clipped - 6 lines]
>
>    f1 = 1/T = frequency of the first harmonic in Hz

So if you accumulated twice as many samples, over twice as long, your
fundamental frequency would be halved?  That is not sensible.

Signature

Lew

cpptutor2000@yahoo.com - 23 Apr 2008 15:10 GMT
> >    fs = sample rate in Hz
> >    dT = 1/fs = interval between samples
[quoted text clipped - 8 lines]
> --
> Lew
That is precisely the case. Please check the definitions above. Please
note that f1 is the first harmonic if I were to calculate an FFT with
the collected samples. The fundamental frequency is 500.0 Hz, and
stays that way.
Lew - 24 Apr 2008 04:36 GMT
>>>    fs = sample rate in Hz
>>>    dT = 1/fs = interval between samples
[quoted text clipped - 10 lines]
> the collected samples. The fundamental frequency is 500.0 Hz, and
> stays that way.

No, that doesn't make sense.  If I recorded a pure 1000 Hz sine wave, that is
the frequency whether I take 44000 samples for one second or 88000 samples
over two seconds.  The frequency isn't affected by how long I record it.

Signature

Lew

Nigel Wade - 24 Apr 2008 09:34 GMT
>>>>    fs = sample rate in Hz
>>>>    dT = 1/fs = interval between samples
[quoted text clipped - 14 lines]
> the frequency whether I take 44000 samples for one second or 88000 samples
> over two seconds.  The frequency isn't affected by how long I record it.

The frequency *resolution* is, though. That's what the OP was referring to
[rather obliquely]. The OP mistakenly calls this the fundamental frequency.

The sampling rate determines the bandwidth, and the maximum freq. which you can
capture (Nyquist-Shannon). The overall length (in time, not samples) determines
the frequency resolution (Fourier).

Signature

Nigel Wade

Ron N. - 23 Apr 2008 05:33 GMT
On Apr 22, 8:48 pm, "cpptutor2...@yahoo.com" <cpptutor2...@yahoo.com>
wrote:
> With reference to all the postings I am sorry I have caused confusion
> about what I meant by the 'fundamental frequency' etc., May I give a
[quoted text clipped - 17 lines]
> harmonic of 7 Hz. I hope I have made myself clear about what I am
> trying to do.

You are using non-standard DSP vocabulary.  500 Hz is your
fundamental, not 7 Hz.  7 Hz might be your DFT bin separation,
bin resolution, or spacing.

You also never answered whether you tried plotting your
data after the type conversion to make sure you didn't
clip or wrap it.
cpptutor2000@yahoo.com - 23 Apr 2008 15:00 GMT
> You also never answered whether you tried plotting your
> data after the type conversion to make sure you didn't
> clip or wrap it.

I did plot the data, after the type conversion. I find the following
(typical data sample length 2048 doubles):
1. a few spikes at the start - most probably due to a large DC offset
being introduced somewhere.
2. a large sequence of zeros - about 250 - 300 samples long
3. the sinusoidal curve that one would expect - a little bit noisy,
but still okay.
Jerry Avins - 23 Apr 2008 16:12 GMT
> With reference to all the postings I am sorry I have caused confusion
> about what I meant by the 'fundamental frequency' etc., May I give a
[quoted text clipped - 17 lines]
> harmonic of 7 Hz. I hope I have made myself clear about what I am
> trying to do.

Pete,

It would help if you used the same terms that the rest of us do. In
particular, it is important to avoid using standard words in
non-standard ways without the sort of glossary you provided here.

*Fundamental* applies not to an FFT, but to the longest-period component
of a periodic waveform. What *you* have called the fundamental is often
referred to as bin width or resolution.

If your signal repeats every 2 ms, then its fundamental is 500 Hz. It
may have harmonics at 1000, 1500, 2000Hz, etc.

Jerry
Signature

Engineering is the art of making what you want from things you can get.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

Lew - 24 Apr 2008 04:42 GMT
>> With reference to all the postings I am sorry I have caused confusion
>> about what I meant by the 'fundamental frequency' etc., May I give a
[quoted text clipped - 30 lines]
> If your signal repeats every 2 ms, then its fundamental is 500 Hz. It
> may have harmonics at 1000, 1500, 2000Hz, etc.

No wonder I was confused.  It was a case of, "There's glory for you!"
(Carroll, Lewis, /Through the Looking-Glass/, Chapter VI, "Humpty Dumpty",
<http://www.gutenberg.org/etext/12>).

Signature

Lew

glen herrmannsfeldt - 24 Apr 2008 21:16 GMT
(snip)

> It would help if you used the same terms that the rest of us do. In
> particular, it is important to avoid using standard words in
> non-standard ways without the sort of glossary you provided here.

> *Fundamental* applies not to an FFT, but to the longest-period component
> of a periodic waveform. What *you* have called the fundamental is often
> referred to as bin width or resolution.

It does make some sense in the context of the FFT, though.
Since FFT has periodic boundary conditions, the lowest non-zero
frequency could be considered the fundamental.  Those who
apply the FFT to non-periodic signals get what they deserve.

> If your signal repeats every 2 ms, then its fundamental is 500 Hz. It
> may have harmonics at 1000, 1500, 2000Hz, etc.

-- glen
dbd - 25 Apr 2008 01:16 GMT
> (snip)

> > snip

> It does make some sense in the context of the FFT, though.
> Since FFT has periodic boundary conditions, the lowest non-zero
> frequency could be considered the fundamental.

In the OP's description, 500 Hz is the lowest non-zero frequency :,).
And it is the 'fundamental of the signal', as opposed belonging to the
set of 'fundamental frequencies of the transform', of which zero is
included as a member.

Does anyone have a suggestion for a description of this area of
vocabulary that is:
1) accessible (free, etc.)
2) complete enough for this level of discussion
3) unambiguous
4) at a suitable level for the OP?

> Those who
> apply the FFT to non-periodic signals get what they deserve.

Those who have known how to apply the FFT to non-periodic signals have
made much good use of it.

> -- glen

Dale B. Dalrymple
Andrew Thompson - 24 Apr 2008 06:31 GMT
On Apr 23, 2:48 pm, "cpptutor2...@yahoo.com" <cpptutor2...@yahoo.com>
wrote:
> With reference to all the postings I am sorry I have caused confusion..

One way to 'cut through the c..onfusion' is to post an
SSCCE.  More info here
http://sscce.org/

Have one peice of code to generate the tone,
and a second to do the transform.

--
Andrew T.
Lew - 24 Apr 2008 07:33 GMT
> http://sscce.org/

Swee-eet.

Signature

Lew

Andrew Thompson - 28 Apr 2008 10:27 GMT
> >http://sscce.org/
>
> Swee-eet.

I thought you (amongst others) might like that URL.

It is Dave Minter's mirror of the SSCCE.  Thanks Dave!

--
Andrew T.
Tim Wescott - 13 Apr 2008 22:19 GMT
> Could some DSP or Java guru please help me ? I have a simple Java
> application that records audio signals and does simple analysis on the
[quoted text clipped - 19 lines]
> totally incorrect, or where the flaw in my reasoning is. Any help would
> be greatly appreciated. Thanks in advance for your help.

You haven't said how long your audio clips are, or what you mean by
'getting frequencies'.  I assume you're analyzing them for frequency
content, and finding little or none below 7Hz?

Consider that most audio paths are AC coupled, because humans can't hear
much below 40Hz (or 60, or 20, depending on who you ask).  Given that, a
7Hz low-frequency cut off is generously low.

Signature

Tim Wescott
Control systems and communications consulting
http://www.wescottdesign.com

Need to learn how to apply control theory in your embedded system?
"Applied Control Theory for Embedded Systems" by Tim Wescott
Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html

Mark Space - 13 Apr 2008 23:43 GMT
> Consider that most audio paths are AC coupled, because humans can't hear
> much below 40Hz (or 60, or 20, depending on who you ask).  Given that, a
> 7Hz low-frequency cut off is generously low.

That's a good point, actually.  Even if Java were a DSP system, which it
isn't, you're still at the mercy of whatever cheap-a.s hardware is on
the motherboard of your PC.  I doubt its up to even a low-end studio rig.

If you're using some sort of audio equipment run by Java that's not a
PC, then you need to contact the manufacturer, 'cause there's no way
we're going to know more than the maker.
Peter Duniho - 13 Apr 2008 23:55 GMT
>> Consider that most audio paths are AC coupled, because humans can't  
>> hear much below 40Hz (or 60, or 20, depending on who you ask).  Given  
>> that, a 7Hz low-frequency cut off is generously low.
>
> That's a good point, actually.

Well, it's a good point if the OP actually meant he's trying to detect  
frequencies as low as 7 Hz.

However, given that he specifically said he's using a 500 Hz tone  
generator, software-based no less, there's nothing about his post that  
makes me think he expects to see actual output frequencies of anything  
other than 500 Hz, or that the hardware limitations might apply.

That said, yes...if there's hardware involved and if the OP is actually  
trying to get frequencies as low as 7 Hz, well...that's just unrealistic.  
:)

Pete
Tim Wescott - 14 Apr 2008 02:03 GMT
>>> Consider that most audio paths are AC coupled, because humans can't
>>> hear much below 40Hz (or 60, or 20, depending on who you ask).  Given
[quoted text clipped - 15 lines]
>
> Pete

Which is why I asked the OP (who we haven't heard back from) to clarify.  
It sounds like he doesn't quite know what he's doing.

Signature

Tim Wescott
Control systems and communications consulting
http://www.wescottdesign.com

Need to learn how to apply control theory in your embedded system?
"Applied Control Theory for Embedded Systems" by Tim Wescott
Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html

Ron N. - 14 Apr 2008 02:18 GMT
On Apr 13, 1:44 pm, "cpptutor2...@yahoo.com" <cpptutor2...@yahoo.com>
wrote:
> Now, from simple DSP principles, we know that if the number of samples
> collected is 'n' and the sampling frequency is 'fs', then the time
> needed to collect these 'n' samples is n/fs,

Correct.  You have a sample window covering n/fs units
of time.

> and the fundamental
> frequency recorded is the inverse of this time value.

The fundamental frequency recorded depends on the contents
of the actual data, not merely this time value.  What does
depend on 1/(n/fs), the inverse of your time value, is the
frequency spacing between successive bins of a DFT/FFT
performed on a sample window of that given length in time
(perhaps proportional to a form of frequency "resolution").

Are you calling some sort of frequency analysis routine
in Java?  What is the form of the input and the result?
(scalar or complex vector, data type, data packing, and
etc.)

IMHO. YMMV.
John E. Hadstate - 23 Apr 2008 10:18 GMT
> Could some DSP or Java guru please help me ? I have a simple
> Java
[quoted text clipped - 5 lines]
> and
> signed.

Did you properly reconstruct the shorts or ints from the byte
data?  One way to tell is to look at the range of your
reconstructed data (the difference between maximum and minimum)
over an interval.  If the range is 32767 to 32768 (or 0 to
65536, or some such) that can be a strong hint that your bytes
are assembled backwards.  In this case, a plot of the data
should look like rail-to-rail noise.

> The data is read into a ByteArrayOutputStream and then as
> soon as I
[quoted text clipped - 21 lines]
> 8Hz, which
> is just absurd.

However, in a later post you wrote:

> f1 = 1/T = frequency of the first harmonic in Hz
> Keeping these points in mind, I have found that
[quoted text clipped - 6 lines]
> harmonic of 7 Hz. I hope I have made myself clear
> about what I am trying to do.

Even (especially) after reading your later post, I don't
understand what you are saying.  From your later post, it seems
that 7 Hz is your bin resolution, so the first bin corresponds
to 7 Hz, the 2nd to 14 Hz, etc.  Are you saying that you don't
see a spike near bin 71 (500/7)?  Perhaps the amplitude of your
injected tone is too low compared to the amplitude of your
other signal (so the spike is there, it's just lost in the
noise).  What exactly is the problem?
cpptutor2000@yahoo.com - 23 Apr 2008 15:06 GMT
> Even (especially) after reading your later post, I don't
> understand what you are saying.  From your later post, it seems
[quoted text clipped - 4 lines]
> other signal (so the spike is there, it's just lost in the
> noise).  What exactly is the problem?

The problem is, as I mentioned in a posting just before, that when I
plot the data, I see a long sequence of zeros, about 250 - 300 sample
points long, before I see the sinusoidal signal. There are a few sharp
and large spikes at the start, which might be due to DC offset, but I
do not understand the sequence of zeros. The total sample size of the
collected data is 2048.
Ron N. - 23 Apr 2008 19:24 GMT
On Apr 23, 6:06 am, "cpptutor2...@yahoo.com" <cpptutor2...@yahoo.com>
wrote:

> > Even (especially) after reading your later post, I don't
> > understand what you are saying.  From your later post, it seems
[quoted text clipped - 11 lines]
> do not understand the sequence of zeros. The total sample size of the
> collected data is 2048.

It could be a data header.  Or it could be how long it
takes your mic or ADC to initialize.  Why not just ignore
this header or turn-on transient?

Does your sinusoid have roughly balanced positive and
negative values?  Or do you have a DC offset of your
sinusoid?
Jerry Avins - 23 Apr 2008 23:29 GMT
>> Even (especially) after reading your later post, I don't
>> understand what you are saying.  From your later post, it seems
[quoted text clipped - 11 lines]
> do not understand the sequence of zeros. The total sample size of the
> collected data is 2048.

Look to the acquisition software. It's unlikely that there's a
startup-transient that large in the hardware, but there may be an offser
between the pointers that write the data and retrieve it.

Jerry
Signature

Engineering is the art of making what you want from things you can get.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

Jerry Avins - 23 Apr 2008 23:40 GMT
cpptutor2000@yahoo.com wrote:
> On Apr 23, 4:18 am, "John E. Hadstate" <jh113...@hotmail.com> wrote:
>
[quoted text clipped - 13 lines]
> do not understand the sequence of zeros. The total sample size of the
> collected data is 2048.

Look to the acquisition software. It's unlikely that there's a startup
transient that large in the hardware, but there may be an offset
between the pointers that write and retrieve the data.

Jerry
Signature

Engineering is the art of making what you want from things you can get.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

John E. Hadstate - 24 Apr 2008 02:30 GMT
> On Apr 23, 4:18 am, "John E. Hadstate" <jh113...@hotmail.com>
> wrote:
[quoted text clipped - 23 lines]
> size of the
> collected data is 2048.

I'll second Ron's motion and add that some file formats that
I'm familiar with reserve the first 512-byte block (or more)
for "metadata"; that is, special labels that identify things
about the data like the sample rate, the number of bits per
sample, the endian-ness, whether stereo or mono, the number of
channels, etc.  Since these things don't often consume all the
allocated space, the remaining bytes ("reserved for future
expansion" is a favorite phrase here) are often set to zero.

As long as identifiable data starts at a constant offset from
the beginning of the file and assuming that you don't need the
metadata, my advice would be to read it and discard it.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.