LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can you crossfade (fade in/out) arrays?

Still buried in regular work, no time to tinker.  I just want to be sure I understand *exactly* what is meant by your phrase, "the sub-segments have to be centered on the pitch peaks."

Here's what I *think* it means.

1. A given chunk of 512 samples (perhaps with a little +/-) is characterized with a given dominant frequency.  This would be considered THE pitch for that whole chunk. 

2. That pitch / frequency will further determine the lengh of the sub-segments.  The sub-segments will initially be defined such that neighboring sub-segments overlap one another by 50%.  At this point, the sound data hasn't necessarily been changed.  The idea of overlap is handled by defining the range of indices for each of the subsegments, and those ranges overlap.

3.  Subsegments are either deleted or duplicated.  Then those subsegments are placed such that they span the 512-sample range.  The amount of "overlap" may be anything from 0 to 75%.

4. Now the sound data will be "faded" across the subsegments.  A Hanning window or other appropriate shaping function will be applied to each subsegment.

5.  A natural result of this Hanning window (or a Triangle window) would be that the sound is attenuated to 0 at the edges of the subsegment, but is passed through unchanged in the middle.  Thus the amplitude peak can be expected to occur in middle of the subsegment.

So it seems that the requirement that "the sub-segments have to be centered on the pitch peaks" will happen kinda automatically during the fade / merge.  Is this right?

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 81 of 85
(960 Views)
Certainly after the windowing, the peak will be in the middle.  This is all but forced.

The trick here is that these subsegments look like cursive "w"s.  You want that peak to be in the center -before- windowing it.  Otherwise, you attentuate power, and change the "shape" of the fundamental frequency.  Ideally you can 0-pad either side to keep the main peak in the center (those are just going to be zeros after the windowing anyway).

Also, the second sentence of your step 4 should happen before step 3.  You need to window them before composing them again (sillyhead).

Is that more clear?
~milq

Message Edited by Milqman on 04-18-2007 01:50 PM

0 Kudos
Message 82 of 85
(956 Views)
Yes i guess you are right Kevin.
By the way can you please post a screenshot of the "Play 8-bit sound vi" you posted earlier so i can build it in Labview 7?
0 Kudos
Message 83 of 85
(952 Views)
Milq
 
Since you are a few thousand times better than me in DSP related things i have a very basic question about FFT if you could answer it to me.
 
Lets say i have a signal of 2000 samples long and i want to get its spectrum and see what frequencies are included in it. By doing an FFT of size 2000 to it, essentialy you are doing DFT right? The result would be a spectrum that spans half the frequency depending of the Fs etc BUT you wont be able to know where exactly the different frequencies in this signal are "overlapping" (not the appropriate term) each other right? That is why we mostly use FFT with smaller sizes when we know that a signal contains more than one frequency in it? How would you find out where these frequencies start and end in time? Do i make sense?
 
Kind regards
Alex
0 Kudos
Message 84 of 85
(946 Views)
Madgreek,

When you say "essentially" here, that is a really loaded.  Sure, they are similar, though I am not sure why you care.

You wont be able to know where exactly the different frequencies in this signal are "overlapping" (not the appropriate term) each other right?
I have no idea what you are asking here.  Perhaps it is something about bandwidth?
That is why we mostly use FFT with smaller sizes when we know that a signal contains more than one frequency in it?
You can do an FFT on whatever you want.  Interpretation gets a little easier with smaller samples (depending on your application)
How would you find out where these frequencies start and end in time?
I am not sure I follow you here, you would not see freqs start and finish in the spectrum, it would manifest itself in a "wider" bandwidth (given a small freq shift)
Do i make sense?
Perhaps to someone else, long long ago, in a galaxy far far away.

Best of luck,
~milq

0 Kudos
Message 85 of 85
(941 Views)