Wednesday, 2 September 2015

filters - My vocoder sounds bad


I'm writing a program to emulate a vocoder and it obviously works, but any speech that comes through is very difficult to understand. I'm going to explain exactly how my implementation works and then maybe somebody with experience with vocoders or DSP can help me.


128 samples of the voice signal go through a Fast Fourier Transform every audio frame. I then take the absolute value of the complex outputs to get the formant of the voice. I chose this rather than multiple band pass filters and envelope followers because it's faster just to do an FFT. I am 100% sure that this is all done correctly.


My carrier wave is run through several band pass filters centered around frequencies corresponding to the FFT output frequencies. To construct the output I multiply the output of these filters by the corresponding amplitudes in the voice formant obtained from the FFT and add all of these products.


There's a few things that I suspect may be causing issues. The algorithm I used to implement the band pass filters is probably not the best. I feed the output of a low pass filter into a high pass filter. I got the algorithms for the filters under the "Algorithmic Implementation" section of the low pass and high pass filter articles on Wikipedia. I have a strong feeling that these simple filters may not be attenuating unwanted frequencies very well but I can't find a better way to make my band pass filter. I also suspect that my carrier wave might not be very good. As I understand it, you need a carrier wave rich in lots of different frequency content (so obviously not a sine wave). I've listened to a lot of vocoders and the carrier wave usually sounds like it's got some dissonant notes in it. I've tried additive synthesis and FM synthesis but I just can't get a carrier wave that doesn't sound too "clean".


If somebody could give me a better band pass algorithm (if that's what I need), a good formula for a carrier wave, or point out some other likely problem I would be very grateful.


ALSO, "vocoder" is not an available tag. Maybe somebody with enough permissions could kindly add this tag? Also, there's a tag for signal-processing but not digital-signal-processing or DSP, I'm not sure if it would be appropriate to add one of these tags or not.



Answer




First, it seems to me that you are doing the analysis incorrectly. 128 linearly spaced channels is both too high (it won't capture a smoothed spectral envelope - vocoders usually have at most ~30 channels) and too small (it has a very poor resolution in the lowest frequencies and won't discriminate different formants). You really need to replace that by a bank of constant-Q band-pass filters, 2 or 3 bands / octave to get something that is coarse enough to capture the spectral envelope without picking individual frequency peaks, yet discriminates the frequencies of interest.


Your analysis and synthesis filters can be implemented with biquads. Running a dozen of those in parallel is not cost-prohibitive compared to a FFT.


As for the carrier wave, you can start with a sawtooth or narrow pulse - avoid waveforms like triangle, square, or sine whose spectrum have "gaps". Then stack a few of them to play a chord. You can thicken the carrier by adding slightly detuned version of each component or octaves. Note that in order to achieve the best sounding results, band-limited synthesis (for example with minBLEPs) has to be used to synthesize the square or sawtooth waves.


torah study - Exercises to prevent eyes tiring



It often happens to me that after learning the whole day and reading lots of text especially with small letters I feel my eyes very tired. Who knows good set of exercises that don't takes lot of time, that helps to prevent eyes tiring.




grammar - Use of も in this sentence: パブもシティーセンターも静かになり ます。


This is the sentence in question from one of my text books.




学生がいませんから、パブもシティーセンターも静かになります。



My Translation - "There are no students so the pubs and city centre become quiet."


Why is it も and not と separating パブ and シティーセンター and then another も before 静か which I don't understand at all?



Answer



As pointed out in the comments, ~も~も (with a positive verb) corresponds usually to the construction "both ... and ..." in English. The Japanese construction is not limited to two nouns, but one has ~も~も~も (which might be "all of ..., ... and ..." in English).


I understand the construction to be "not restrictive" in the sense that ~も~も can mean "both ... and ... and a bunch of other ...". On the other hand ~と~ suggest "exactly ... and ...". So here



学生がいませんから、パブもシティーセンターも静かになります。

Because there are no students, pubs, the city centre and everything else become quiet.


学生がいませんから、パブとシティーセンターが静かになります。
Because there are no students, particularly pubs and the city centre become quiet although everywhere else business is as usual.



Tuesday, 1 September 2015

vocabulary - 天気 vs. 天候, what's the real difference?



What's the real difference between 天気 and 天候? In at least one of my dictionaries, 天候 just redirects to 天気.


I've always thought (read: "felt") that 天候 is the general "concept" of weather, or even climate



秋の天候 - "the [type of] weather in the fall"; 北海道の天候 - "the climate of Hokkaido"



whereas 天気 seems to be the actual tangible weather.




明日の天気は雨です - "Tomorrow (the actual weather) will be rain"; 天気予報 - "weather (not climate) forecast"



これ合ってるか教えてください。


EDIT: After looking a bit more through the different definitions, it seems that 気候 is more closely related to "climate" than 天候.



Answer



Daijisen's got you covered. The usage note under 天気 says that 天気 refers to the atmospheric conditions over a short period of time (two or three days at most), while 天候 is for describing those conditions over a period of several to several tens of days. And of course 天気 can be used in the sense of "good weather", which is a connotation 天候 does not have.


electrochemistry - Is this product description wrong and a simple battery and not a fuel cell?



I won this "toy" at a science fair... Now I have to make a short presentation about it in school. On the package description they describe its energy source as "fuel cell"... It consists out of a metal plate(magnesium), a black metal plate with a black coating and a paper-cotton-like isolator which is between those plates. Through putting salt water on the isolator, there's a voltage difference of 1.76V between the black and the magnesium plate. After a couple of seconds on load the voltage stays constant at 1.31V. My theory is that it's only a simple battery, because there's no continious source of fuel which should be required for naming it fuel cell (according to wikipedia).


Is my thought right?


My idea about the black coat is, that it is a rubberd graphite or "coal" cathode, rubberd because coal or graphite would fall apart quickly. It is described as air-cathode in the package description. My idea is that the black coal or graphite coat is used to provide a larger amount of air to the reaction...


The magnesium plate gets damaged through this reaction, the black thing not.


Which material is the black coat?


and what is the full reaction?


a picture of the components



Answer



Your analysis seems correct, i.e. it is only a fuel cell if the magnesium is being oxidized by the air. You can prove if that is the case, and do so as part of your classroom demonstration, by excluding any air, and therefore oxygen, from the fuel cell.





  1. Use distilled water and fairly pure $\ce{NaCl}$ (rather than table salt) to make the salt solution.




  2. Boil the salt water for a minute or so to remove air bubbles (some oxygen from air dissolves into water).




  3. Put the cell with electrolyte in a plastic bag sealed around the wires and a narrow tube such as a plastic coffee stirrer or soda straw that you'll use later to admit air, carefully squeezing out air bubbles. Seal both bag and tube with plasticine modeling clay or soft wax.





  4. Observe the open circuit voltage of the cell.




  5. Then run it for a while with a load (e.g. a 75 mA 1.5 V lamp) or a 100 ohm resistor, which will draw 1.3 mA), depending on the current output of the cell. You would expect some voltage drop over time, either due to cell polarization or due to any residual oxygen being used up.




  6. To prove that this is a true fuel cell oxidizing the magnesium using air, bubble some air into the plastic bag through the (unplugged) tube. *If the voltage goes back up, then drops down until yet more air is added, you've shown that oxygen is being used and it's a true fuel cell.




Please accept my compliments for your thoughtful question; do post your findings here!



Electrolysis in aqueous solution – which equations to use to predict product at each electrode?


When trying to work out what will be produced at each electrode during electrolysis, I'm confused as to which equations to use for hydrogen and oxygen.


For instance, an electrolytic cell containing aqueous nickel(II) bromide, with a nickel cathode and a platinum anode.


At the cathode:


$$\ce{Ni^2+ + 2e- -> Ni}$$


I have read that this does not occur because $\ce{Ni^2+}$ is a worse oxidising agent than $\ce{H+}$, which makes sense because $\ce{H+}$ is lower down on the left side of the electrochemical series meaning its reduction is more feasible.


Water is therefore reduced at the cathode:


$$\ce{2H+ + 2e- -> H2}\quad E^\circ=0.0\ \mathrm V$$



or:


$$\ce{2H2O + 2e- -> H2 + 2OH-}\quad E^\circ=-0.83\ \mathrm V$$


The second equation, however, has water higher up in the electrochemical series. This would suggest nickel should actually be reduced in preference to water.


How do I know which of the two "water-reduction" equations to use?


This is even less transparent for the anode, where bromide should be oxidised to bromine, but there are also two equations showing production of oxygen: one below and one above bromide in the series:


$$\begin{alignat}{2} \ce{O2 + 4H+ + 4e- &-> 2H2O}\quad &E^\circ&=+1.23\ \mathrm V\\[6pt] \ce{O2 + 2H2O + 4e- &-> 4OH-}\quad &E^\circ&=+0.40\ \mathrm V \end{alignat}$$


I don't understand which of these equations should be used and how you're supposed to know which to use.



Answer



The given potentials $E = 0.00{\text{ V}}$ and $E = -0.83{\text{ V}}$ for the reduction of water apply to different $\text{pH}$.


The thermodynamic relation of the potential $E$ to the composition of the solution is generally known as the Nernst equation:



$$E = E^\circ + \frac{{0.059{\text{ V}}}}{z}\log \frac{{{{\prod\nolimits_i {\left[ {{\text{ox}}} \right]} }^{{n_i}}}}}{{{{\prod\nolimits_j {\left[ {{\text{red}}} \right]} }^{{n_j}}}}}$$


For the given reaction


$$\ce{2 H+ + 2e- <=> H2}$$


the Nernst equation reads


$$E = 0.00{\text{ V}} + \frac{{0.059{\text{ V}}}}{2}\log \frac{{{{\left[ {{{\text{H}}^ + }} \right]}^2}}}{{\left[{{{\text{H}}_2}}\right]}}$$


Since


$${\text{pH}} = - \log \left[ {{{\text{H}}^ + }} \right]$$


the potential $E$ depends on $\text{pH}$:


$$E = 0.00{\text{ V}} - 0.059{\text{ V}} \times {\text{pH}} + \frac{{0.059{\text{ V}}}}{2}\log \frac{1}{{\left[ {{{\text{H}}_2}} \right]}}$$


Therefore, the potential is $E = 0.00{\text{ V}}$ at $\text{pH} = 0$ and $E = -0.83{\text{ V}}$ at $\text{pH} = 14$ respectively.



grammar - Issues with this sentence


The following dialogue:



A: 将棋がお強いと伺いましたが。
B: いやあ、人に自慢するほどじゃありませんが、始めてもう40年になりますね。



First, I have problems determining the meaning of 伺う. Does it mean "to ask" or "to be told" here?


Second, I just learned about the comparisons with ほど.
There are two patterns I learned:




八ヶ岳は有名な山だが、富士山ほど有名ではない。



and



田中さんほど仕事がよくできる人はいません。



Now, in context of the dialogue in question, I think that pattern 1 is at play here. Still, considering that I don't really know what the first sentence says, I wonder what to make of this :/
I also can't find what いやあ means.


Here's my attempt at translation:




A: Have you been told that you're strong at shougi?
B: ? , while I don't boast towards people like that, for the first time already become 40 years.



Oh and I also can't make much sense of the second part in the second sentence as well :/



Answer




First, I have problems determining the meaning of 伺う. Does it mean "to ask" or "to be told" here?



(~と)伺う here is the humble form (謙譲語) of (~と)聞く, meaning "I heard that~~".

~か伺った or ~~かと伺った would be "I asked whether~~."



Second, I just learned about the comparisons with ほど.
八ヶ岳は有名な山だが、富士山ほど有名ではない。
田中さんほど仕事がよくできる人はいません。



ほど basically means "to the extent (that~)" or "to the (same) extent (as~)". So 富士山ほど有名ではない literally means "not famous to the same extent as Mt. Fuji", hence "is not so famous as Mt. Fuji", and 田中さんほどよくできる人 means "a person who is competent to the same extent as Mr. Tanaka".


And here in your example 人に自慢するほどじゃありません, the ほど also means "to the extent (that~)."



[私の将棋の腕前は]人に自慢するほどじゃありません。

lit.[My shogi technique is]not (good) to the extent that I can boast to others.
I am not good at shogi to the extent that I can boast about it to others.




I also can't find what いやあ means.



It's an interjection (感動詞):



いや〘感〙
驚き・感動・嘆きなどを表す語。いやあ

「いや、びっくりした。」「いや、すばらしい。」
(明鏡国語辞典)




始めてもう40年になりますね。



始めて here is not "for the first time" (初めて)*, but the te-form of the verb 始める, lit. "started and~" → "since I started". 「~~して+ (period of time) +になる」 means "(period of time) has passed since ~~" or "It's been (period of time) since ~~."


"It's already been 40 years since I started (shogi)."


*始めて = [はじめて]{LHHH}, 初めて(for the first time) = [はじめて]{LHLL}


readings - Appending 内 to a company name is read ない or うち?

For example, if I say マイクロソフト内のパートナーシップは強いです, is the 内 here read as うち or ない? Answer 「内」 in the form: 「Proper Noun + 内」 is always read 「ない...