それでは、R で音声を入れる方法を解説します
まずはセットアップです。パッケージを読み込み、取得した API キーを環境変数として設定します。また、このほかにも依存しているプログラムをインストールする必要がありますが、詳しくはブログをご覧ください。
それができたら、あとは関数を実行するだけです。このときに、原稿のファイル、スライドのファイル、声の種類、出力するビデオファイルの名前を指定します。
createProject <- function(dir) { | |
path <- file.path(dir, paste0(basename(dir), ".Rproj")) | |
template_path <- system.file("templates/template.Rproj", | |
package = "devtools") | |
x <- c("Version: 1.0", "", "RestoreWorkspace: Default", "SaveWorkspace: Default", | |
"AlwaysSaveHistory: Default", "", "EnableCodeIndexing: Yes", | |
"UseSpacesForTab: Yes", "NumSpacesForTab: 4", "Encoding: UTF-8", | |
"", "RnwWeave: knitr", "LaTeX: pdfLaTeX") | |
cat(paste(x, collapse="\n"), file=template_path) |
#' | |
#' @importFrom magrittr %>% | |
#' @importFrom stringr str_which str_subset str_replace | |
#' @importFrom rstudioapi isAvailable getActiveDocumentContext getSourceEditorContext | |
library(stringr) | |
library(purrr) | |
library(rstudioapi) | |
suppressMessages(library(here)) | |
whoAmI <- function() { | |
# http://stackoverflow.com/a/32016824/2292993 |
get_os <- function() { | |
if (.Platform$OS.type == "windows") { | |
"win" | |
} else if (Sys.info()["sysname"] == "Darwin") { | |
"mac" | |
} else if (.Platform$OS.type == "unix") { | |
"unix" | |
} else { | |
stop("Unknown OS") | |
} |
inverse_map <- function(x, ...){ | |
mthd <- list(...) | |
lapply(mthd, function(m) do.call(m,list(x))) | |
} |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>AllowClipboardAccess</key> | |
<false/> | |
<key>AppleAntiAliasingThreshold</key> | |
<integer>1</integer> | |
<key>AppleScrollAnimationEnabled</key> | |
<integer>0</integer> |
##' Start JUMAN++ server. | |
##' | |
##' @param host.name host name if necessary | |
##' @param port port number if necessary. By default, 12000 | |
##' @export | |
jum_start_server <- function(host.name = NULL, port = NULL) { | |
rubypath <- Sys.which("ruby") | |
if(identical(rubypath, "")){ | |
stop("PATH to Ruby not found. Please check Ruby is installed.") | |
} |
jum_version <- function(){ | |
p <- system("jumanpp -v", intern = TRUE) | |
if (str_detect(p, "command not found")) { | |
res <- "JUMAN++ is not be installed or we cannot find the path to JUMAN++" | |
} | |
res <- p %>% str_trim() | |
return(res) | |
} |
import os | |
from collections import Counter | |
from prompt_toolkit.keys import Keys | |
os.environ['EDITOR'] = "/Applications/Emacs.app/Contents/MacOS/bin/emacsclient" | |
os.environ['VISUAL'] = "/Applications/Emacs.app/Contents/MacOS/bin/emacsclient" | |
$DIR_HIST_PATH = "/Users/yuya/.dirhist" | |
$PATH.append("/usr/local/bin") |
%let hoge = newdata; | |
title1 "Contents of Data Set &hoge"; | |
title2 'Contents of Data Set &hoge'; |
それでは、R で音声を入れる方法を解説します
まずはセットアップです。パッケージを読み込み、取得した API キーを環境変数として設定します。また、このほかにも依存しているプログラムをインストールする必要がありますが、詳しくはブログをご覧ください。
それができたら、あとは関数を実行するだけです。このときに、原稿のファイル、スライドのファイル、声の種類、出力するビデオファイルの名前を指定します。