Learn R Programming

phonTools (version 0.1-2)

loadsound: Load WAV files into R

Description

A function which allows WAV files to be loaded into R.

Usage

loadsound (filename)

Arguments

filename
a string indicating the name of the WAV file to be loaded.

Value

  • An object of class 'sound', a list containing the elements:
  • filenamea vector containing the filename of the WAV file.
  • fsthe sampling frequency of the sound.
  • durationthe duration of the sound, in milliseconds.
  • sounda vector of numeric values representing the sampled sound.

Details

The function is only compatible with WAV files of 8 and 16 bits. Only mono WAV files are supported. The function returns a sound object. The functions plot() and print() are defined for sound objects.

Examples

Run this code
## For example, for a file named 'filemame.wav' in the working directory
## sound = loadsound ('filename.wav')

## sound
## plot (sound)

Run the code above in your browser using DataLab