DSPRelated.com
Forums

frequency shifting (compressing?)

Started by kreuters March 14, 2006
hey

i have a high frequency audio stream (352 kHz mono) that i want to shift
down to 44 kHz. instead of simply taking every eigth sample though, i want
to shift the frequency components of the 352 kHz stream so that they are
audible at 44 kHz. ie if there was a sine wave recorded at 100 kHz, i
would like that to be shifted to a sine wave of 12.5 kHz.

what is the easiest way to go about this? i tried taking an FFT block,
reducing that by a factor of 8, then taking the inverse, but it produced
weird time domain discontinuities. can anyone help?


kreuters wrote:
> hey > > i have a high frequency audio stream (352 kHz mono) that i want to shift > down to 44 kHz. instead of simply taking every eigth sample though, i want > to shift the frequency components of the 352 kHz stream so that they are > audible at 44 kHz. ie if there was a sine wave recorded at 100 kHz, i > would like that to be shifted to a sine wave of 12.5 kHz. > > what is the easiest way to go about this? i tried taking an FFT block, > reducing that by a factor of 8, then taking the inverse, but it produced > weird time domain discontinuities. can anyone help?
If I follow you correctly, material on http://www.dspdimension.com/ should help. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
"kreuters" <kreuters@gmail.com> wrote in message 
news:I-ednXToVPpSe4vZnZ2dneKdnZydnZ2d@giganews.com...
> hey > > i have a high frequency audio stream (352 kHz mono) that i want to shift > down to 44 kHz. instead of simply taking every eigth sample though, i want > to shift the frequency components of the 352 kHz stream so that they are > audible at 44 kHz. ie if there was a sine wave recorded at 100 kHz, i > would like that to be shifted to a sine wave of 12.5 kHz. > > what is the easiest way to go about this? i tried taking an FFT block, > reducing that by a factor of 8, then taking the inverse, but it produced > weird time domain discontinuities. can anyone help? > >
I don't understand why taking every eighth sample is not an adequate solution. You will still be sampling any audible signal above the nyquist rate. Can you give a little more detail as to what "high frequency audio stream" means. Is it ultra sound or modulation on a carrier or what?

kreuters wrote:
> > hey > > i have a high frequency audio stream (352 kHz mono) that i want to shift > down to 44 kHz. instead of simply taking every eigth sample though, i want > to shift the frequency components of the 352 kHz stream so that they are > audible at 44 kHz. ie if there was a sine wave recorded at 100 kHz, i > would like that to be shifted to a sine wave of 12.5 kHz.
The easiest way is also the only way - just output the data at 44000 samples a sec. -jim
> > what is the easiest way to go about this? i tried taking an FFT block, > reducing that by a factor of 8, then taking the inverse, but it produced > weird time domain discontinuities. can anyone help?
----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
hey everyone

thanks for the posts, i shall reply below:

> If I follow you correctly, material on http://www.dspdimension.com/ > should help.
yes, i had a look on this site, but i did not find anything that would help me solve the problem, maybe need to check some more.
> I don't understand why taking every eighth sample is not an adequate > solution. You will still be sampling any audible signal above the
nyquist
> rate. Can you give a little more detail as to what "high frequency
audio
> stream" means. Is it ultra sound or modulation on a carrier or what?
the audio signal is a mono recording from a hydrophone of marine mammals, which vocalize up to 200 kHz. i am attempting to make the high frequency vocalizations audible by humans, by squashing it into a 44 kHz audible signal (if that makes sense). clearly taking every eighth point will lose the high frequency info.
> The easiest way is also the only way - just output the data at 44000 > samples a sec.
ok, that would be ideal, but unfortunately i have to process the stream in real time, so this is not really an option. if this is the only method of doing this, is there an alternate method of shifting a higher frequency band into audible range? for example, taking the range 30 - 50 kHz and transposing this somehow to the 0 - 20 kHz band. is this possible? thanks, Richard.
1.  If you're interested in actual real-time signal analysis, then you
must not remove any info. That's not a problem, since there are many
platforms which allow you to apply various numerically-intensive
processing to 352kHz streams in real-time (e.g. modern DSP boards,
Pentium/Athlon boards, etc.).

2.  If you're only interested in providing humans with real-time info,
then consider that humans are much less capable of processing all this
info compared to a dolphin/whale. Therefore, there is no point in
preserving every little bit of information in the signal, but only
keeping in the signal "some" info which a human may find interesting.
(You can keep a recording of the complete data-stream for later
off-line processing, should you find something you consider
"interesting".)
So, what info to keep ?

Method 1  --  If you want part of the spectrum:
You can correctly decimate to 44kHz. This CANNOT be done by your method
of keeping every 8th same, because your method will alias frequency
components above 22kHz. The correct theoretical way is to low-pass
filter to kill all frequency components above 22kHz, and only then keep
every 8th sample. Of course a practical implementation will do it more
efficiently using something called an 8-branch "poly-phase" filter.

Method 2  --  If you want the general structure of the spectrum:
You need to "squash" the frequency down by 8, as Jim says, by outputing
it at 8th of the rate. There are 2 problems with this:
a)  A human hears only down to 20Hz, therefore, all original
frequencies below 160Hz will not be heard by humans after the
processing.
b)  It appears that doing this cannot be done in real-time (the input
rate is higher than the output rate).

Solution for problem (b):
Take short buffer "snapshots" from the 352kHz data-stream, each of
random length in samples between N_low and N_high (e.g.: N_low = 200
samples, N_high = 1000 samples). Each "snapshot" is played at 44kHz
rate, with overlapped windowing with smooth-transition-mixing with the
previous snapshot. The samples from the original 352kHz data-stream
in-between snapshots are not played -- they're thrown away!  (but keep
them in your recording on the hard-disk/tape). The
smooth-transition-mixing windowing prevents hearing discontinuity
clicks. The reason for random buffer lengths is to prevent generating
frequencies which are not present in the original signal. You can try
it with fixed buffer lengths and/or abrupt transitions (no mixing) and
you'll quickly understand why they're necessary...


Can you describe the purpose of your experiments ?  Perhaps other
signal-processing solutions are more appropriate.

Also, I have a question for you:
Do dolphins and whales have a "grammer" in their singing, such as all
human languages have (subject, verb, adjective, etc.) ???
Where can one learn about this (i.e. which books) ?

Gidi


kreuters wrote:

> > if this is the only method of doing this, is there an alternate method of > shifting a higher frequency band into audible range? for example, taking > the range 30 - 50 kHz and transposing this somehow to the 0 - 20 kHz band. > is this possible?
Yes that's possible (assuming you've got "taking the range 30 - 50 kHz" part worked out satisfactorily), but it's not exactly the same as the problem in your original question. You are now talking about filtering out 7/8 of the frequency content. if you do that well, then you can take every eighth sample and output that at 44khz. The original question suggested you were unwilling to discard any of the original signal content. The problem as I see it is you really don't know what is important in your signal. As a result the only way to be sure you are not discarding anything important is to not discard anything. -jim ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
kreuters wrote:
...
> the audio signal is a mono recording from a hydrophone of marine mammals, > which vocalize up to 200 kHz. i am attempting to make the high frequency > vocalizations audible by humans, by squashing it into a 44 kHz audible > signal (if that makes sense). clearly taking every eighth point will lose > the high frequency info.
Well, you won't lose all the info - it's just scrambled with a one-way function. For example, let's assume a dolphin decides to whistle at a constant frequency of 150kHz, where at least part of the information is carried by ampitude modulation, and let's assume that you recorded at 352 kHz. If you just subsample by a factor of 8, this tone gets folded down to 17.7kHz, with all the amplitude modulation intact. You just don't know if the carrier frequency was really 17.7, 26.4, 61.8 or 150kHz (any one is possible).
ok, lots of replies. in order:


> Can you describe the purpose of your experiments ? Perhaps other > signal-processing solutions are more appropriate.
your summary of method 2 covers the situation pretty well. sorry to be misleading about preserving information, i do not need to preserve anything apart from the high frequencies. well, to be precise, what i was planning on doing was sampling at 352 kHz and streaming straight to disk. while the information is recording i was going to take every eighth sample and output that in the left channel of a stereo output. i then wanted some way to squash the higher frequencies (30 - 80 kHz roughly) into audible range and play them back through the right channel of the stereo output, so there would be constant audio feedback of mammal vocalisations. am i correct in thinking that if i band pass filtered the stream between 30 - 80 kHz, then took every eighth sample the audio would be aliased into the audible range? i like the idea of taking small snapshots, might give that a try.
> Also, I have a question for you: > Do dolphins and whales have a "grammer" in their singing, such as all > human languages have (subject, verb, adjective, etc.) ??? > Where can one learn about this (i.e. which books) ?
not to my knowledge, usually mammal vocalistaions fall into two categories, wihstling and clicking. the clicks are broadband (except for porpoises) and used to image their environs (like bat echolocation). the whistling (mainly dolphins, also some whales) is believed to be communication, but no one has "translated" it i don't think. not really my field of expertise, i would suggest having a look at numerous available research papers on the www.
> The problem as I see it is you really don't know what is important in > your signal. As a result the only way to be sure you are not discarding > anything important is to not discard anything.
ok, i hope the above bit clarifies what i am attempting to achieve. single channel for the 0 - 22kHz info and another channel for 30 - 80 kHz info (roughly). are you suggesting that i simply band pass the part of the signal i want then take every 8th sample? would this just alias the required info into audible range? (long time since i took a DSP course) might give that a try, see what it sounds like. thanks.
Some detail:
In my solution, N_low must be >= 2200 samples in this case, because:
352k / 160 = 2200   (160Hz is the lowest frequency of interest).
Of course N_high > N_low.


Be aware of the following:
You say:
> .... marine mammals, which vocalize up to 200 kHz ...
Therefore, you must sample at least with 400kHz in order to capture the complete information. If you have no choice but to sample at 352kHz (no money for better equipment), then remember that the equipment must have an analog low-pass filter (called an "anti-aliasing filter") with cutoff 176kHz before your sampler, otherwise your samples will be corrupted during occurances of "high-frequency" vocalization (between 176kHz and 200kHz). Also, if you mean that there is a frequency component at 200kHz, and that this frequency component is amplitude- or frequency-modulated by the mammal when it "talks", then be aware that any and all modulations causes the frequency-spectrum around it to expand!! so that the highest frequency content may be even higher than 200kHz!!!! (requiring an appropriate increase in your sampling frequency). Gidi