找回密码
 注册
查看: 613|回复: 0

R语言 tuneR包 tuneR()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-10-1 13:04:21 | 显示全部楼层 |阅读模式
tuneR(tuneR)
tuneR()所属R语言包:tuneR

                                        tuneR
                                         调谐器

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

tuneR, a collection of examples
调谐器,收集的例子


在调谐器的功能----------Functions in tuneR----------

tuneR consists of several functions to work with and to analyze Wave files. In the following examples, some of the functions  to generate some data (such as sine), to read and write Wave files (readWave, writeWave), to represent or construct Wave files (Wave), to transform  Wave objects (bind, channel,  downsample, extractWave, mono, stereo), and to play Wave objects are used.
调谐器是由几个功能一起工作,来分析无线电波的文件。在下面的例子中,某些功能,生成一些数据(如sine),读取和写入波形文件(readWave,writeWave),代表或构建Wave文件( Wave),转换波对象(bind,channel,downsample,extractWave,mono,stereo),和play波的对象。

Other functions and classes are available to  calculate several periodograms of a signal (periodogram, Wspec), to estimate the corresponding fundamental frequencies (FF, FFpure), to derive the corresponding notes (noteFromFF),  and to apply a smoother. Now, the melody and corresponding energy values can be plotted using the function  melodyplot.
其他的函数和类的信号来计算多个周期图(periodogram,Wspec),估计相应的基本频率(FF,FFpure),得出的相应的票据(noteFromFF),并应用smoother。现在,旋律和对应的能量值可以使用的功能melodyplot绘制。

A next step is the quantization (quantize) and a corresponding plot  (quantplot) showing the note values for binned data. Moreover, a function called lilyinput  (and a data-preprocessing function quantMerge) can prepare a data frame to be presented as sheet music by  postprocessing with the music typesetting software LilyPond.
下一个步骤是量化(quantize)和一个相应的曲线(quantplot)示出为离散化的数据的音符值。此外,调用的函数lilyinput(和数据预处理功能quantMerge)可以准备一个数据框的后处理与排版软件LilyPond的音乐乐谱。

Of course, print (show), plot and summary methods are available for most classes.
当然,打印(显示),图和总结的方法适用于大多数的类。


(作者)----------Author(s)----------


Uwe Ligges, <a href="mailto:ligges@statistik.tu-dortmund.de">ligges@statistik.tu-dortmund.de</a>



实例----------Examples----------


library(tuneR) # in a regular session, we are loading tuneR[在常会,我们正在加载调谐器]
  
# constructing a mono Wave object (2 sec.) containing sinus [构建含有窦的单波对象(2秒)。]
# sound with 440Hz and folled by 220Hz:[和folled由220Hz与440Hz的声音:]
Wobj <- bind(sine(440, bit = 16), sine(220, bit = 16))
show(Wobj)
plot(Wobj) # it does not make sense to plot the whole stuff[它没有任何意义绘制的东西]
plot(extractWave(Wobj, from = 1, to = 500))
## Not run: [#不运行:]
play(Wobj) # listen to the sound[听声音]

## End(Not run)[#(不执行)]

tmpfile <- file.path(tempdir(), "testfile.wav")
# write the Wave object into a Wave file (can be played with any player):[写的波形对象到Wave文件(可与任何播放器播放):]
writeWave(Wobj, tmpfile)
# reading it in again:[再次读入:]
Wobj2 <- readWave(tmpfile)

Wobjm &lt;- mono(Wobj, "left") # extract the left channel[提取左声道]
# and downsample to 11025 samples/sec.:[和下采样11025个样本/秒。]
Wobjm11 <- downsample(Wobjm, 11025)
# extract a part of the signal interactively (click for left/right limits):[提取信号交互方式(单击左/右的范围内)的一部分:]
## Not run: [#不运行:]
Wobjm11s <- extractWave(Wobjm11)

## End(Not run)[#(不执行)]
# or extract some values reproducibly [或提取一些值重复性]
Wobjm11s <- extractWave(Wobjm11, from=1000, to=17000)

# calculating periodograms of sections each consisting of 1024 observations,[计算周期图的部分,每部分组成,共1024个观测值,]
# overlapping by 512 observations:[512观察重叠:]
WspecObject <- periodogram(Wobjm11s, normalize = TRUE, width = 1024, overlap = 512)
# Let's look at the first periodogram:[让我们来看看在第一个周期图:]
plot(WspecObject, xlim = c(0, 2000), which = 1)
# or a spectrogram[或频谱]
image(WspecObject, ylim = c(0, 1000))
# calculate the fundamental frequency:[计算基波频率:]
ff <- FF(WspecObject)
print(ff)
# derive note from FF given diapason a'=440[派生注意从FF和谐= 440]
notes <- noteFromFF(ff, 440)
# smooth the notes:[平滑的注意事项:]
snotes <- smoother(notes)
# outcome should be 0 for diapason "a'" and -12 (12 halftones lower) for "a"[结果应该是0,和谐“的”和-12(12半色调)为“A”]
print(snotes)
# plot melody and energy of the sound:[图的旋律和能源的声音:]
melodyplot(WspecObject, snotes)

# apply some quantization (into 8 parts): [适用于一些量化为8个部分:]
qnotes <- quantize(snotes, WspecObject@energy, parts = 8)
# an plot it, 4 parts a bar (including expected values):[一个图条形(包括预期值),4份:]
quantplot(qnotes, expected = rep(c(0, -12), each = 4), bars = 2)
# now prepare for LilyPond[现在准备LilyPond]
qlily <- quantMerge(snotes, 4, 4, 2)
qlily

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2024-11-28 17:55 , Processed in 0.020234 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表