Skip to content

Commit

Permalink
add readings for my previous posts
Browse files Browse the repository at this point in the history
  • Loading branch information
tyrchen committed Apr 5, 2020
1 parent 5a4451c commit fdf092b
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 217 deletions.
7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,11 @@
"homepage": "https://github.com/tyrchen/book_next#readme",
"dependencies": {
"@sindresorhus/slugify": "^0.9.1",
"async-lock": "^1.2.2",
"@tyrchen/xftts": "^0.1.0",
"audioconcat": "^0.1.3",
"chinese-to-pinyin": "^1.3.1",
"crypto-js": "^4.0.0",
"front-matter": "^3.0.2",
"lame": "^1.2.4",
"proper-lockfile": "^4.1.1",
"ramda": "^0.26.1",
"sorted-array": "^2.0.4",
"websocket": "^1.0.31",
"yargs": "^14.2.0"
}
}
1 change: 0 additions & 1 deletion src/1-summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ title: '目录'
# 目录

- [序言](0-intro-pub.html)
- [目录](1-summary-pub.html)
- [长日无痕(一)](2013/w38/1-no-title-pub.html)
- [闲话说抽象](2014/w08/1-indirection-pub.html)
- [谈敏捷](2014/w08/2-agile-pub.html)
Expand Down
Binary file added src/2020/w03/assets/1.mp3
Binary file not shown.
2 changes: 2 additions & 0 deletions src/2020/w04/1-happy-new-year-pub.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ keywords: [杂谈, 新年]

为啥 rust?这货一不小心连拿了四年 stackoverflow 用户最喜欢的编程语言,你就不想了解一下?新年穿新衣裳,也试试对自己而言的一门新语言嘛。

<!-- split -->

未来几年的软件开发,protable binary(平台无关的受控可执行代码)会越来越重要,而 webassembly 似乎是目前唯一受到几大厂商全力支持的方向。webassembly 的应用场景不仅仅是 web(比如大型游戏的 web 化),更是服务端虚拟化的一个新的,也许是更优的解决方案。Solumon Kykes,Docker 的创始人和 CTO 说:

> If WASM+WASI existed in 2008, we wouldn't have needed to created Docker. That's how important it is. Webassembly on the server is the future of computing. A standardized system interface was the missing link. Let's hope WASI is up to the task!
Expand Down
Binary file added src/2020/w04/assets/1.mp3
Binary file not shown.
4 changes: 2 additions & 2 deletions src/2020/w07/1-video.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ cover: 'assets/progress.jpg'
keywords: [杂谈, 教学]
---

# 如何制作教学视频?看看我的探索之路吧

自从去年 9 月以来,我每天晚上花差不多一个小时给闺女小宝上课。上课的内容很杂,从周一到周日,依次是:历史故事,数学,scratch,科学探索,纪录片,励志电影,以及几何。每每上完课后,我在朋友圈「炫耀」,朋友们都会鼓励我何不干脆把内容做成视频,独乐乐不如众乐乐。后来我做过一些尝试,然而直接录制我跟小宝上课的过程效果不太好,因为一来它太定制化了,二来时间太长,有效信息量不够,除非被逼着,或者闲得无聊,否则不会有人愿意听一个小时左右,没有经过深度加工的,由并不专业的老师讲述的「课程」。我也尝试过把我跟小宝讲的数学课或者科学探索课压缩,去芜存菁,以「李永乐老师」或者「妈咪说」的形式呈现,然而这并不是我擅长的方式,刻意模仿反而失去了我自己讲课的灵魂。

所以录制视频这事,就搁下了。
Expand All @@ -23,6 +21,8 @@ keywords: [杂谈, 教学]

第一批视频做完之后,我拿给老婆听。她听了之后,觉得效果不佳。两个问题:1. 声音太过平淡,听着让人昏昏入睡。2. 节奏有些缓慢,信息密度不够。这两个问题切中要害。对于像我这样没有接受过专业训练的人士来说,给小宝讲课和带着耳机边录边讲完全是两种状态 —— 平日对着小宝那个滔滔不绝口若悬河的我在正式录制内容的时候就像《国王的演讲》里的乔治六世那样,磕磕巴巴,满屏的嗯啊以及口头禅。于是我只好不断地反复重录,有了一个还不错的版本后,再用 iMovie 剪辑,最后配上古筝音乐(高山流水和渔舟唱晚)来掩饰讲解的不自信,以及剪辑后导致的轻微的不流畅感。

<!-- split -->

第一批七个视频,我花了一整个周末来制作,尝试了 notability 和 paper 两个工具,最后确定使用 notability。录好的视频使用 iMovie 编辑起来非常辛苦,因为我的嗯啊实在太多,不得不细细扣除。有些视频录下来是 7 分钟,扣完中间过渡的留白和嗯啊,就剩下五分种。

第二周周末,我继续用相同的方式制作第二期七个视频。除了对所用工具的熟练,尤其是对 iMovie 快捷键的熟练之外,做视频的能力我并没有太多的长进。7 个视频,大约三十分钟的成品内容,还是要花去我大半个周末 —— 除了我带小宝小贝上舞蹈课的时间外,我都用来闷在书房做视频,一遍遍录制,一点点剪辑,效率之低令人发指。我发现,屏幕录像不是一个好的解决方案。当出现我说错话或者思考时间太长,前后衔接不好种种状况时,我不能把屏幕录像停止下来,只能给自己备注一句:「这段不要」,然后深吸一口气,重复之前讲坏了的内容。被「备注」不要的内容,会在我使用 iMovie 剪辑的时候剪去,同时,有些讲得不够好的地方也会被剪掉,这大大增加了工作量。在「刺客聂政」这篇,我录制了七分钟的内容,最后剪辑出来只有两分多钟。好多内容因为讲得磕巴,太难剪辑,干脆大段删去。因而我边做边找更好的工具。我希望有工具可以允许我像播放幻灯片一样切换我的内容,可以对内容进行批注,并且,还可以在 app 里直接录屏,这样可以随时开始,随时终止 —— 最好呢,还有简单的视频剪辑功能,这样不好的片段,我可以直接删去,省得后来还需要在 iMovie 里二次编辑。
Expand Down
Binary file added src/2020/w07/assets/1.mp3
Binary file not shown.
2 changes: 1 addition & 1 deletion src/2020/w14/1-flutter.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 'flutter: 一周感悟'
authors: [程序君]
cover: 'assets/progress.jpg'
cover: 'assets/flutter.jpg'
keywords: [技术, 前端, flutter]
---

Expand Down
Binary file added src/2020/w14/assets/flutter.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 34 additions & 29 deletions tools/gen_tts.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const fm = require('front-matter');
const path = require('path')
const audioconcat = require('audioconcat');

const { TTS } = require('./tts');
const { TTS } = require('@tyrchen/xftts');
const env = process.env;
const app = env.APP || '1';
const appId = env[`XF_TTS_ID${app}`];
Expand All @@ -21,15 +21,14 @@ async function gen_mp3(text, filename) {
text = text.replace(/”|「|」|"|_|《|》|>/g, '');
// console.log(text);
try {
const tts = new TTS(appId, apiKey, apiSecret, {vcn: 'x2_xiaoyuan', speed: 70});
const tts = new TTS(appId, apiKey, apiSecret, { vcn: 'x2_xiaoyuan', speed: 70 });
await tts.generate(text, filename);
console.log('generated: ', filename);
} catch (error) {
console.error(error);
}
}


async function extract(src) {
const content = await fs.readFile(src, 'utf8');
const { body, attributes } = fm(content);
Expand All @@ -51,35 +50,41 @@ async function main() {
const outPath = path.join(path.dirname(argv.i), 'assets');
const outName = path.basename(argv.i).split('-')[0];
const data = await extract(argv.i);
const output = path.join(outPath, `${outName}.mp3`);

let files = [];
for (const [i, item] of data.entries()) {
let outFile = path.join(outPath, `${outName}-${i}.mp3`);
await gen_mp3(item, outFile);
files.push(outFile);
}
if (data.length == 1) {
await gen_mp3(data[0], output);
console.error('Audio created in:', output);
process.exit(0);
} else {
let files = [];
for (const [i, item] of data.entries()) {
let outFile = path.join(outPath, `${outName}-${i}.mp3`);
await gen_mp3(item, outFile);
files.push(outFile);
}

const output = path.join(outPath, `${outName}.mp3`);
setTimeout(() =>
audioconcat(files)
.concat(output)
.on('start', function (command) {
console.log('ffmpeg process started:', command);
setTimeout(() =>
audioconcat(files)
.concat(output)
.on('start', function (command) {
console.log('ffmpeg process started:', command);

})
.on('error', function (err, _stdout, stderr) {
console.error('Error:', err);
console.error('ffmpeg stderr:', stderr);
process.exit(-1);
})
.on('end', async function () {
for (var f of files) {
await fs.unlink(f);
}
console.error('Audio created in:', output);
process.exit(0);
})
, 1000);
})
.on('error', function (err, _stdout, stderr) {
console.error('Error:', err);
console.error('ffmpeg stderr:', stderr);
process.exit(-1);
})
.on('end', async function () {
for (var f of files) {
await fs.unlink(f);
}
console.error('Audio created in:', output);
process.exit(0);
})
, 1000);
}
}

main()
91 changes: 0 additions & 91 deletions tools/tts/index.js

This file was deleted.

Loading

0 comments on commit fdf092b

Please sign in to comment.