Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

spectral vs time domain.

For general discussion related FlowStone

spectral vs time domain.

Postby tester » Tue May 27, 2014 2:29 pm

I have a problem to solve. If I have a beating sound, made of 2-4 FFT (sine like) components (= slightly irregular envelope, beating speeds unknown) that fades out (not linearly) - I'd like to draw (measure) a curve that follows peak (or average? or peak?) values of that fade out.

Sometimes the beating sound may be made of 2 FFT components, producing 0.2Hz beating. So - how to approach it, to get theoretical curve points in selected points of time? Some sort of envelope follower? Some sort of FFT band recalculation at some sort of resolution?

Martin? KG?
Attachments
curve.png
curve.png (21.71 KiB) Viewed 15184 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: spectral vs time domain.

Postby martinvicanek » Tue May 27, 2014 6:55 pm

The easiest would be to take an envelope follower with a decay time long enough to average out the beating but short enough to follow the fade-out of the sound. (In your graph the beating appears to be much quicker than the fade-out.)
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: spectral vs time domain.

Postby tester » Tue May 27, 2014 7:15 pm

That was an example.

I'm trying to make some sort of analyzer for an instrument (singing bowl).

Basically, the instrument's output is/should be split into multiple, narrow FFT bands (few up to 16). I'm not sure if this can be doable correctly in FS due to lack of resolution (vs performance), but band features can be provided externally from other app, where measurements are made at 128-512kpts (measurements for different purposes).

Anyway, after the sound is split into bands, each band contains 1-4 sine like stable peaks (constant frequency). Now - if some of these peaks are very close, it produces very slow beating, like 1 to even 5 seconds per cycle. But peaks can be far enough from each other and in bi-pair configurations - envelope is more "stable" so to speak.

Now the tricky part. The instrument's fade out speeds (per band) depend on environmental factors, and of course they differ from instrument to instrument. So what I'd like to measure - are time points (like 0.3, 4, 8, 12, 16s) for each band, and use it as a starting point for further work. But. If I use envelope - then at slow beats I would rather need to "reconstruct" the theoretical envelope according to peaking of the beat. If I use FFT sub-arrays (per band) - I could probably (at least this is how I undetrstand it) determine/predict the peak amplitude for selected time points. So I came to conclusion, that maybe a way would be to use FFT data per band to calculate/predict the wave theoretical max peak value at time points? Sort of.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: spectral vs time domain.

Postby KG_is_back » Tue May 27, 2014 9:00 pm

Will the instrument be analyzed in real time? If not then there is a workaround for the envelope.
First analyze the file form backwards forward by envelope follower with infinite release time and zero attack time.
Code: Select all
streamin in;
streamout out;

out=max(out,abs(in));


The output will be a file that contains steps of the peaks (each step expanding to the left form the peak). This will ease the work of a second envelope follower/lowpass filter to smooth the steps.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: spectral vs time domain.

Postby tester » Tue May 27, 2014 10:17 pm

No, not realtime. I usually record c.a. 30-40 seconds long files.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: spectral vs time domain.

Postby martinvicanek » Thu May 29, 2014 9:16 pm

You might try to model your signal as exponentially decaying and fit the time constant. Here is a schematic that may serve as a start. I adopted KG's idea of analyzing the wave file in reverse order, searching for peaks which are greater than previous peaks. The resulting set of data points is used for a linear regression to determine the best exponential envelope fit. Hope it helps.
Attachments
DecayFit.fsm
(1.39 MiB) Downloaded 793 times
DecayFit.png
DecayFit.png (24.99 KiB) Viewed 15053 times
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: spectral vs time domain.

Postby tester » Thu May 29, 2014 11:02 pm

Thanks, I will play with it.

These are kind of sounds I deal with (see attachement). Sometimes band1 is most audible, but not always, so this is just an example. What usually happens - is the change in decay per band, and this is more interesting. :mrgreen:

Theoretically, decay is indeed some sort of exponential fade out, I just didn't know how to approach it due to multi-peak structure.

Anyway you are amazing. :-)
Attachments
sb-example.rar
(1.55 MiB) Downloaded 900 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: spectral vs time domain.

Postby tester » Sat May 31, 2014 9:51 pm

Question. Is it possible to re-make that envelope follower, so that it covers rather whole audio content instead of crossing it? Audio pass through was made on files attached in earlier post.

p.s. there should be no problem with infinities on the beginning. Basically, the first "measure point" starts at around 0.3 to 0.5 seconds after hit, to remove the "hit" part.
Attachments
b.png
b.png (12.29 KiB) Viewed 14983 times
a.png
a.png (11.3 KiB) Viewed 14983 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: spectral vs time domain.

Postby tester » Sun Jun 15, 2014 5:31 pm

After some on-sound experimentation and comparisons, I'm getting to a conclusion, that maybe I will take the old approach for this topic.

Basically, single step would be like this.

1) Load wave file
2) Perform the analysis (use left channel only - should probably work with mono and stereo):
A) Add offset (like 0.3 to 0.5 sec)
B) With this offset:
- get max amplitude of a wave file in range1 (0sec to 4sec)
- get max amplitude of a wave file in range2 (4sec to 8sec)
- get max amplitude of a wave file in range3 (8sec to 12sec)
- get max amplitude of a wave file in range4 (12sec to 16sec)
- get max amplitude of a wave file in range5 (16sec to 20sec)

We assume, that the audio file will be always 21+ seconds long.

How to make it (get amplitude values in specified points of time) with this offline analyzer stuff?
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: spectral vs time domain.

Postby tester » Mon Jun 16, 2014 12:18 am

It looks, that this one works?

Question: if stereo wave file is loaded, then how it is represented after mem to array of floats conversion? Interleaved values?
Attachments
gains-002-temp.fsm
(2.57 KiB) Downloaded 775 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
 
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Next

Return to General

Who is online

Users browsing this forum: No registered users and 69 guests