time dialation/frequency spectrum compression for ultrasonic to audio - Page 1
Forum section: electronics / projects

author: coppercone2
author_rank: Super Contributor
timestamp: September 13, 2018, 09:10:54 pm
content: If I want to listen to the ultrasonic spectrum on the audio spectrum, I.e. compress 20-200KHz and shove it into 200-20000Hz so I can listen to it, what can I do?I have seen bucket brigade devices that store a bunch of samples and basically play it back slow.I know you can also downconvert it using a multiplier but the problem is that the audio spectrum is much narrower then the ultrasonic spectrum, so you end up loosing a bunch of information, and you might need to do weird things like multiple filters to get overtones and stuff.I wanted to know analog implementations of it. Is this a type of 'hilbert transform"?

author: Dubbie
author_rank: Unknown
timestamp: September 13, 2018, 09:57:52 pm
content: This paper here has a nice overview of various suitable techniques.https://repositories.lib.utexas.edu/bitstream/handle/2152/45558/TREPTOW-MASTERSREPORT-2016.pdf

author: coppercone2
author_rank: Super Contributor
timestamp: September 13, 2018, 10:59:54 pm
content: I am interested in wideband. Pitch shifting is narrow band IIRC,

author: DaJMasta
author_rank: Super Contributor
timestamp: September 13, 2018, 11:54:58 pm
content: Didn't read the paper linked, but pitch shifting could be a good choice. If you drop it by 4 octaves (four halvings of frequency), your playback band is 1250Hz to 12500Hz - listenable, but it's all gonna be high. Probably better to shift down 6 octaves, putting it around about vocal range.The audio spectrum is smaller on the linear scale, but it's actually much larger on the logarithmic scale, which is how we hear tones anyways. 20kHz-200kHz is less than 4 octaves, whereas 20Hz-20kHz is 10 octaves or so, so if you wanted to do really exotic processing you could probably drop it down and expand the dynamic range, but I'm not sure it would actually be valuable.

author: SiliconWizard
author_rank: Super Contributor
timestamp: September 14, 2018, 12:02:48 am
content: One approach would be to use a filter bank and downshift each band separately.

author: coppice
author_rank: Super Contributor
timestamp: September 14, 2018, 12:06:37 am
content: Quote from: coppercone2 on September 13, 2018, 10:59:54 pmMany techniques shift the pitch of the entire band. However, if something as basic as the analogue CCD technique would suit you, you can just capture and replay slower with a modest MCU. Finding one with a DAC limits your choice, but there are still a number around.The Hilbert transform rotates a signal's phase by 90 degree at all frequencies. It has nothing to do with altering frequencies..

author: T3sl4co1l
author_rank: Super Contributor
timestamp: September 14, 2018, 12:17:51 am
content: The best you can do is acquire samples, Fourier transform, rescale the spectrum exactly as described, and transform back.The tricky part is, you're starting with much more data than you end up with, so you must make some kind of decision about what data to loose.If you sample 1ms and play it back over 100ms, there's 99ms of unsampled data lost. Which means infrequent, impulsive signals are probably going to be lost. Continuous tones will be reproduced with reasonable fidelity though.If you sample, at high frequency, for 100ms, and play back the conversion over 100ms as well, the spectrum itself must be decimated or otherwise downsampled somehow. This preserves impulsive content the best, but is much more compute-intensive (you need to process ~40k samples at a go), and destroys a lot of pitch information (which appears to be the intent, so that's alright).Playing back samples (in the audio sense: short snippets of sound) also has the problem that it's a stop-and-go, discontinuous thing, while we expect the signals to come and go as they do. The solution to this is to employ some kind of overlapping or sliding transformation. Maybe the simplest implementation of that would be, take down ~10k samples and append that to a buffer, and do the FT every 25ms. The buffer has a total length of 40k samples, so 10k are added at the head, at the same time 10k are removed from the tail (circular buffer). Mix the outputs from each FT, so that they play back overlapped as well (and give or take some temporal transformation maybe, although I think that's taken care of by nature of this operation?).The best possible case would be to input another 100 samples (of high speed data) to output the next 1 sample (of audio) in a continuous transform. There may be an algorithm for that (sliding FT?), I don't know offhand.Hmm, I think that should be pretty easy (as vector transforms go, that is). If you express the input buffer as (a & b & c) (& = concatenation operator), then the circular-buffering operation is to remove a, time-shift b and c, and add a new sample d, to get the new sample buffer (b & c & d). And we can further express that as a' + b' + c', where a', b' and c' are rectangular-windowed samples, therefore with the well-defined transform F(a' + b' + c') = F(a') + F(b') + F(c') = A + B + C. So we take the transform of a' and subtract it from the running spectrum, time-shift the spectrum B + C (by multiplying each element by e^ωt), and add the transform of d', to finally get the spectrum B + C + D. Then decimate, FT, and play the next sample. (Which can be saved a proportional amount of computation by using the same observation; but these are all linear operations, so what really is the difference in the end? Is it just a sinc(t) interpolation and decimation?? I'd have to write it down.)Tim

author: coppercone2
author_rank: Super Contributor
timestamp: September 14, 2018, 02:17:12 am
content: i need to process that fully but with the playback method I was thinking maybe you can determine some kind of algorithm to keep taking samples during the playback and then do some comparisons, if something is present in the same tones to see if its chirping repeatedly or whatever, or you can just record for a long period of time (they did this with special high speed tape recorders)I was hoping that if you make the playback short enough, you wont miss anything too interesting like animal calls or something

author: mark03
author_rank: Frequent Contributor
timestamp: September 14, 2018, 05:51:38 am
content: I looked into this a while back for my digital bat translator. I wasn't able to find anything in the open literature that looked particularly promising. Lots of talk about the wonders of phase vocoders. But if you experiment with pitch-shifting plugins in, e.g. Audacity, you will discover pretty quickly that fidelity is crap for something like music, when shifting by a large factor. So you have the "speed up" function on youtube which is mainly good for speech, or you have Autotune for music which is generally used << one octave. This seems to be one of those problems, like speech recognition, that everyone assumed we'd have cracked by now, but turns out to be much more difficult than we thought.I also considered an expand-and-stitch algorithm for the case of bat vocalizations separated by relative silence. You could snip out the calls, time expand each one, and splice them back together without any net expansion of the larger timeline. Obviously, if the gaps aren't long enough, your expanded pieces will start to overlap. As I recall, that wasn't going to work very well either, so I didn't pursue it.

author: bson
author_rank: Unknown
timestamp: September 14, 2018, 07:53:09 am
content: Quote from: T3sl4co1l on September 14, 2018, 12:17:51 amThe good news is as long as the frequency scaling is constant so Fout/Fin = K, the phase stays coherent... But if it's non-constant the phase needs to be adjusted to maintain group delay or it will get all messed up and things like chirps will no longer sound right.

author: Mechatrommer
author_rank: Super Contributor
timestamp: September 14, 2018, 08:42:13 am
content: Quote from: T3sl4co1l on September 14, 2018, 12:17:51 amno need FFT. just resample. ie capture at say 100MSa/s, record in any durationtuntil your harddrive is full, and then play it back at 1MSa/s at 100tduration. anyway, its dilation, not dialation.

author: David Hess
author_rank: Super Contributor
timestamp: September 15, 2018, 09:16:28 pm
content: I would be tempted to mix a comb with the entire 20kHz to 200kHz band to down-convert everything in one shot to the audible band without preserving the frequency relationships. Use an adjustable comb frequency to find the most useful one.

author: coppercone2
author_rank: Super Contributor
timestamp: September 15, 2018, 10:34:37 pm
content: It seems that in order to spy on bats successfully you need several different devices.I need to think about comb into mixer though thats complicated

author: T3sl4co1l
author_rank: Super Contributor
timestamp: September 15, 2018, 11:24:22 pm
content: Not really, just sample without antialiasing filter.Tim