Class blog 3/11
ECE 3340 - Han Q. Le (c)
Miscellaneous notes and HW4A
In the below, items are posted in reverse orders: latest questions/comments are at the top and the earliest at the bottom.
5. Problem 1A: band pass filters
Issue: the band filters are presumably set up correctly, the output sounds appear OK all along, until the last minute when suddenly, the sounds don’t sound right after saved and exit.
Answer: Most likely errors: incorrect application of the band filters.
Many in the class may have the same problem and error described here, so please read.
5.1 First thing first: check you answer
After you filter the sounds, put them back in the
App and obtain the spectrum for each sound (make sure select the
time duration to be over the entire signal). Below are typical
results:
For sound 1 (instrument 1), this is what it should look like
(doesn’t have to be exact, but all the strong harmonics should be
there)
For sound 2 (instrument 2): (the chart on the left cut off at -80 dB from the peak, so you don’t see the bottom).
Yours don’t have to look exactly like the above to get full credit, but if you have weird lines from the other sound or interference, you will not get full credit. So, please check.
If they don’t look like these, even if you went through the instructions properly and the process correctly, then see 5.2 below.
5.2 Explanation of what may go wrong:
For HW 4A, Problem 1A, if you notice about the spectrum of the first sound:
There are 11 dominant harmonics, neglecting
those weak ones below -55 dB. It means you will need saved bands +
current bands. An option is to saved 10 bands (5 bands each time),
and the last band will be the current one that needs not be saved.
This is the way the App works:
- when you save the first 5 bands (demonstrated in class), it will
be applied automatically every time you run this:
,
whether once or continuous
- when you save the next 5 bands, you have 10 in save, which will
be applied. All you have to do is to set up ONE LAST band - no
need to save it - and just run. The App automatically retrieves
all the saved bands and applies whichever current band(s) you have
to do the filtering.
- Mistake is made
when you don’t bother to set up the last band and leave whatever
there, thinking that only saved bands matter:
In the example above. this last green band that you
don’t save and don’t think it matters, actually will be applied
and it means you are
unintentionally filtering a broad range of the spectrum with noises and interference within the
green band above. This explains why your filtered sound
sounds weird and not as expected.
If the saved bands
contain all you want, then simply turn off all bands for the
final sound processing calculation by setting the band
amplitudes to be exactly 0.
Bottom line: If something doesn’t sound right, most
likely, you make the mistake described above: you inadvertently
include a portion of spectrum that you don’t mean to. So, be aware of how the App works.
4. List handling
Once you have two musical data array, say sound1 and sound2, what can you do to put them together? this is the easiest:
See how Join works:
In[29]:=
Out[31]=
But if you want exactly length, for example, you want sound1 at srate to be exactly t1 sec and same with sound 2, then what can you do?
What if sound1 is actually shorter than t1 time? that’s the beauty of UpTo:
In[32]:=
Out[33]=
In[34]:=
Out[35]=
See what UpTo does?
3. Element reference in a list
Do you notice what is wrong here?
What’s wrong is about [ ] vs [[ ]]
If you are
user, you would know that [[ ]] is
needed to reference (or index-refer) to an element within a list.
Please see Tutorial 2, look
at the example in the tutorial:
So, back to the example above, if we want the 7th element of tx array, we should write:
and not
2. Band pass filters for 1A
This has been expanded and updated in Section 5 above.
1. Watching for “blue” objects
Executing the code below, it doesn’t work. Do you notice why?
Any time you see a “blue” item on the right side of an equation, it means it will be used undefined. That’s all there is to it. Just pay attention to the details.
In a related example, the below doesn’t work either, inspite of the fact that everything has been executed:
Can you spot why? spot the “blue” thing
and find out what’s wrong. Typo is essential in programming also:
look at "carnoise" vs "carrnoise".