-
Notifications
You must be signed in to change notification settings - Fork 0
/
frequence_mod_tone.Rmd
60 lines (48 loc) · 1.27 KB
/
frequence_mod_tone.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
title: "frequency modulated tone"
author: "Brian C Leavell"
date: "`r Sys.Date()`"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Generating frequency modulated tone for use in ultrasonic microphone calibration
Goal: Generate broad-spectrum, frequency modulated tone as .wav file.
Why?: Why not? ...To be used for calibration of WildLife Acoustics microphone and Song Meter acoustic recording unit sensitivities.
```{r packages}
library(tuneR)
library(seewave)
```
Create file
Settings:
90 - 1 kHz frequency sweep
Sine wave
Fade-in & Fade-out = 10 msec
Sample rate = 192 kHz
Bit depth = 16 (PCM)
Duration = 2 seconds
```{r tone}
fmtone <- synth(f = 192000,
cf = 90000,
d = 2,
a = 1,
signal = "sine",
fm = c(0,0,-89000,0,0),
output = "Wave"
)
fmtone <- fadew(fmtone, din = 0.010, dout = 0.010, shape = "exp", output = "Wave") # 10 msec fade in and fade out
savewav(fmtone, filename = "90to1kHz_fmtone.wav") #final file save as .wav
```
## Oscillogram
``` {r oscillo}
oscillo(fmtone)
```
## Power spectrum
``` {r powerspec}
meanspec(fmtone, wl = 256)
```
## Spectrogram
``` {r spectrogram}
spectro(fmtone, wl = 1024)
```