個人で「癒し系英語教材」を作って楽しんでみる

「最近ちょっと英語に本気」とチラホラ言ってるけど、それとはちょっと逸れて脇道、なの。

2017-12-15 追記: 以下参照:

ダウンロードという行為そのものが youtube の利用規約に反することを知りませんでした。(なお、ダウンロードするだけで著作権法違反となる、という話ではない。)以下一応読めるようにはしておくけれど、出来れば読まないで。

個人で「癒し系英語教材」を作って楽しんでみる

前置きなのよ

今ちょっと、本題としては「ある学習方法の人体実験中」で、これはあと10日くらいかかりそうなネタなんだけど、その中で色々思うところもあって、ふと思い立って。

Microsoft.Speech に「名言」を喋らせる」に、ヒーリングサウンドを被せて、「お気に入り教材」を作ってしまおうかな、と。Windows で、ですよん。

やり方の目処はたってはいたし、素材さえ揃ってればすぐだろう、とはわかっていたけれど、「使いたい環境音のダウンロード」には時間がかかったので、ほぼ半日作業でしたわ。

なのでね、同じ事をやってみたい人はいるかもしれないけれど、これを「無料で手に入る教材だ」と思ったとしても、作業そのものを楽しめる人以外にはお奨めしません。「お金と時間」を天秤にかけて、お金で解決するなら、何かしら投資した方がいいんじゃないかなと思う。「タダほど高いものはない」かもしれないよ。

BGM として使う環境音を入手

ワタシのお気に入りは、Meditation Forest  想像力と癒しの森。ここから好きなものを、ダウンロードしておいた。ここにある環境音は、「混ぜると気持ちがいい」ので、最初からそのつもりで2つダウンロードした。

ダウンロードしてくるとこれは当然「動画」なのだけれど、欲しいのは音声だけなので、ffmpeg で音声だけ抽出しておく:

1 me@host: Downloads$ for i in 1 2 ; do ffmpeg -i $i.mp4 -vn -acodec copy $i.aac ; done

一応説明:

  • コマンドラインからの入力が面倒になるために、予めエクスプローラから 1.mp4、2.mp4 と名前を変えてある。
  • ワタシは MSYSユーザなので、この例は MSYS bash のコマンドラインである。(DOS ではなくて。)
  • -vn は「ビデオなし」の意味。
  • -acodec copy は「入力のオーディオストリームをそのままコピー」の意味で、入力は AAC なので、出力ファイル名は .aac にしている。(Windows メディアプレイヤーはこれを認識してくれるみたい。)
  • ただし、ここで「AACのまま」にしたいのは多分貧乏性。「音質を落とさないようにする」ためのスキルというか知識なんか皆無で、あとで最後には MP3 にするんだけど、その際に音質落ちない保障はなく、「この時点で音質落とすことはなかろう」程度の理由。

BGM として使う環境音複数を「overlay multiple audio files」する

ffmepgで。

StackOverflow のこれみて混乱してしまったが、結果的にはこれだけで良かった:

1 me@host: Downloads$ ffmpeg -i 1.aac -i 2.aac -filter_complex "amix=inputs=2" mixed.aac

この指定で作ると、時間が長い方に合わせられるので、例えば 1 が 2分、2 が 1分とすると、後半の1分は1の内容だけになる。「時間が短いほうに合わせろ!」という指定があるのかはわからないが、時間指定は出来る:

1 me@host: Downloads$ ffmpeg -i 1.aac -i 2.aac -filter_complex "amix=inputs=2" -t 02:00:00.0 mixed2.aac

というふうに。

なお、

1 me@host: Downloads$ ffmpeg -i 1.aac -i 2.aac -filter_complex "amix=inputs=2" mixed.aac

ではなく

1 me@host: Downloads$ ffmpeg -i 1.aac -i 2.aac -filter_complex "amix=inputs=1" mixed0.aac

とするとミックスの仕方が変わる。詳しいことはわかってない。(どちらも「2つ同時再生」という目的には合うが、音は全く違う。)

名言を Microsoft.Speech に喋らせた音声ファイルを作る

これは結構前に書いた「喋るぞ幸運菓子(Microsoft.Speech)」を、ほんの少し変えるだけの話。まったくもって、なんてことない:

quotes2mp3.ps1
 1 $quotes = Get-Content $pwd/quotes.txt
 2 $logo = [Reflection.Assembly]::LoadWithPartialName("Microsoft.Speech")
 3 $speak = New-Object Microsoft.Speech.Synthesis.SpeechSynthesizer
 4 #Add-Type -AssemblyName System.speech
 5 #$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer
 6 $speak.Rate = -1
 7 #$speak.SetOutputToDefaultAudioDevice()
 8 $speak.SetOutputToWaveFile("quotes.wav")
 9 $speak.SelectVoice('Microsoft Server Speech Text to Speech Voice (en-GB, Hazel)')
10 foreach ($line in $quotes) {
11     $speak.Speak("$line")
12 }
13 $speak.Dispose()

あんまり高速に喋られると聞き取れないので、Rate は「-1」にしてる。出力ファイル名はスクリプト内で決め打ちの「quotes.wav」、見ての通り。

スクリプト中の quotes.txt は、「一行ごとに「名言(英語)」」を書き込んだファイル。ワタシが作ったのはこんな:

quotes.txt
 1 Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction.
 2 Imagination is more important than knowledge.
 3 Gravitation is not responsible for people falling in love.
 4 I want to know God's thoughts; the rest are details.
 5 The hardest thing in the world to understand is the income tax.
 6 Reality is merely an illusion, albeit a very persistent one.
 7 The only real valuable thing is intuition.
 8 A person starts to live when he can live outside himself.
 9 I am convinced that He (God) does not play dice.
10 God is subtle but he is not malicious.
11 Weakness of attitude becomes weakness of character.
12 I never think of the future. It comes soon enough.
13 The eternal mystery of the world is its comprehensibility.
14 Sometimes one pays most for the things one gets for nothing.
15 Science without religion is lame. Religion without science is blind.
16 Anyone who has never made a mistake has never tried anything new.
17 Great spirits have often encountered violent opposition from weak minds.
18 Everything should be made as simple as possible, but not simpler.
19 Common sense is the collection of prejudices acquired by age eighteen.
20 Science is a wonderful thing if one does not have to earn one's living at it.
21 The secret to creativity is knowing how to hide your sources.
22 The only thing that interferes with my learning is my education.
23 God does not care about our mathematical difficulties. He integrates empirically.
24 The whole of science is nothing more than a refinement of everyday thinking.
25 Technological progress is like an axe in the hands of a pathological criminal.
26 Peace cannot be kept by force. It can only be achieved by understanding.
27 The most incomprehensible thing about the world is that it is comprehensible.
28 We can't solve problems by using the same kind of thinking we used when we created them.
29 Education is what remains after one has forgotten everything he learned in school.
30 The important thing is not to stop questioning. Curiosity has its own reason for existing.
31 Do not worry about your difficulties in Mathematics. I can assure you mine are still greater.
32 Equations are more important to me, because politics is for the present, but an equation is something for eternity.
33 If A is a success in life, then A equals x plus y plus z. Work is x; y is play; and z is keeping your mouth shut.
34 Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe.
35 As far as the laws of mathematics refer to reality, they are not certain, as far as they are certain, they do not refer to reality.
36 Whoever undertakes to set himself up as a judge of Truth and Knowledge is shipwrecked by the laughter of the gods.
37 I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones.
38 In order to form an immaculate member of a flock of sheep one must, above all, be a sheep.
39 The fear of death is the most unjustified of all fears, for there's no risk of accident for someone who's dead.
40 Too many of us look upon Americans as dollar chasers. This is a cruel libel, even if it is reiterated thoughtlessly by the Americans themselves.
41 Heroism on command, senseless violence, and all the loathsome nonsense that goes by the name of patriotism -- how passionately I hate them!
42 No, this trick won't work...How on earth are you ever going to explain in terms of chemistry and physics so important a biological phenomenon as first love?
43 My religion consists of a humble admiration of the illimitable superior spirit who reveals himself in the slight details we are able to perceive with our frail and feeble mind.
44 Yes, we have to divide up our time like that, between our politics and our equations. But to me our equations are far more important, for politics are only a matter of present concern. A mathematical equation stands forever.
45 The release of atom power has changed everything except our way of thinking...the solution to this problem lies in the heart of mankind. If only I had known, I should have become a watchmaker.
46 Great spirits have always found violent opposition from mediocrities. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence.
47 The most beautiful thing we can experience is the mysterious. It is the source of all true art and all science. He to whom this emotion is a stranger, who can no longer pause to wonder and stand rapt in awe, is as good as dead: his eyes are closed.
48 A man's ethical behavior should be based effectually on sympathy, education, and social ties; no religious basis is necessary. Man would indeeded be in a poor way if he had to be restrained by fear of punishment and hope of reward after death.
49 The further the spiritual evolution of mankind advances, the more certain it seems to me that the path to genuine religiosity does not lie through the fear of life, and the fear of death, and blind faith, but through striving after rational knowledge.
50 Now he has departed from this strange world a little ahead of me. That means nothing. People like us, who believe in physics, know that the distinction between past, present, and future is only a stubbornly persistent illusion.
51 You see, wire telegraph is a kind of a very, very long cat. You pull his tail in New York and his head is meowing in Los Angeles. Do you understand this? And radio operates exactly the same way: you send signals here, they receive them there. The only difference is that there is no cat.
52 One had to cram all this stuff into one's mind for the examinations, whether one liked it or not. This coercion had such a deterring effect on me that, after I had passed the final examination, I found the consideration of any scientific problems distasteful to me for an entire year.
53 ...one of the strongest motives that lead men to art and science is escape from everyday life with its painful crudity and hopeless dreariness, from the fetters of one's own ever-shifting desires. A finely tempered nature longs to escape from the personal life into the world of objective perception and thought.
54 He who joyfully marches to music rank and file, has already earned my contempt. He has been given a large brain by mistake, since for him the spinal cord would surely suffice. This disgrace to civilization should be done away with at once. Heroism at command, how violently I hate all this, how despicable and ignoble war is; I would rather be torn to shreds than be a part of so base an action. It is my conviction that killing under the cloak of war is nothing but an act of murder.
55 A human being is a part of a whole, called by us _universe_, a part limited in time and space. He experiences himself, his thoughts and feelings as something separated from the rest... a kind of optical delusion of his consciousness. This delusion is a kind of prison for us, restricting us to our personal desires and to affection for a few persons nearest to us. Our task must be to free ourselves from this prison by widening our circle of compassion to embrace all living creatures and the whole of nature in its beauty.
56 Not everything that counts can be counted, and not everything that can be counted counts.

これはCollected Quotes from Albert Einsteinから持ってきたもの。

さて、上記スクリプトを実行して、目的のファイルを作る:

1 me@host: Downloads$ C:/WINDOWS/SysWOW64/WindowsPowerShell/v1.0/powershell -ExecutionPolicy Unrestricted `pwd -W`/quotes2mp3.ps1
  • ExecutionPolicyについてはここに書いた。
  • 「`pwd -W`」は「絶対パスを渡す必要があって、かつ、MSYS 流儀ではない普通の Windows 流儀のパス指定でなければならない」ために必要。
  • powershell コマンドをフルパス指定で呼び出しているのは単に、ワタシがパスを通してないから。

出来上がったファイルを ffmpeg で見てみたら、「Audio: pcm_s16le」になってた。気にしてこなかったけど、コーデックのコントロールは出来たりしないんだろうかね? Microsoft.Speech の世界で。

環境音と名言音声をミックスして、完成

1 me@host: Downloads$ ffmpeg -i mixed.aac -i quotes.wav -filter_complex "amix=inputs=2" -t 00:10:00.0 -f mp3 quotes_with_bgm.mp3

で完成。

ひとまずまぁまぁの出来。音量のバランスを調整したらもっと良さそうだな、と思うも、これは今回はまぁいいか、と思ったのでやってない。無論「所詮は人口音声」なので、「自然なネイティブ英語」とは程遠いので…、「英語の勉強」たって、たかが知れていますがね…。(つーか、その不自然さで「癒されない」というのは、あるかもねぇ。)

うーん、これだと DIGA に素直に取り込めない…

気軽にいつでも聞くために DIGA に取り込みたかった。「CD-DA形式で音楽CDとして作成」しないとダメ。うーん、以前にもこれ、やったんだけど、そのときわざわざ CD-R 作ったっけかなぁ? 憶えてない…。

改めて、DIGA で取り込めるように MP4 にしちゃえ

これだけのために CD 作るのもなんなので、ちょっと発想を変えて、背景画像をつけて動画(MP4)にしてしまうか…。

まず、もとはといえば「Meditation Forest  想像力と癒しの森」からお取り寄せたのは MP4 なので、ここから絵の方を抜き出す。というか静止画なんで、ほんとはここから抜き出す意味、ないけどね。ともかくこう:

1 me@host: Downloads$ ffmpeg -i 1.mp4 -an -vcodec copy 1_an.mp4

これは DIGA が期待する H.264 として取り出せる。

それと、DIGA が認識する MP4 の音声は AAC でなければならない、ということはわかっているので、PCM になっている quotes.wav も変換しないといけない:

1 me@host: Downloads$ ffmpeg -i quotes.wav -acodec libvo_aacenc quotes.aac

あとは全部踏まえてこう:

1 me@host: Downloads$ ffmpeg -i mixed.aac -i quotes.wav -i 1_an.mp4 -filter_complex "amix=inputs=2" -t 00:10:00.0 -f mp4 quotes_with_bgm.mp4

今度こそ取り込めるだろ…⇒取り込めた。おけ。