[R] reducing the sampling rate of a .wav file

Dimitri Liakhovitski dimitri.liakhovitski at gmail.com
Wed Oct 22 22:48:21 CEST 2014


Thank you so much, Uwe!
seavewav is from another package :)

On Wed, Oct 22, 2014 at 4:03 PM, Uwe Ligges
<ligges at statistik.tu-dortmund.de> wrote:
>
>
> On 22.10.2014 21:57, Dimitri Liakhovitski wrote:
>>
>> I've read in a wav file using 'tuneR':
>>
>> silence<-readWave("silence0.5sec.wav")
>>
>> I run summary(silence):
>>
>> Wave Object
>> Number of Samples:      22051
>> Duration (seconds):     0.5
>> Samplingrate (Hertz):   44100
>> Channels (Mono/Stereo): Mono
>> PCM (integer format):   TRUE
>> Bit (8/16/24/32/64):    16
>>
>> Summary statistics for channel(s):
>>
>>     Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
>>        0       0       0       0       0       0
>>
>>
>> I would like to save this file as a lower frequency file so that:
>> Samplingrate (Hertz):   8000
>>
>> Is it possible?
>> I am trying:
>> savewav(silence,filename="silence0.5sec 8000.wav",f=800)
>>
>> But it doesn't work - it saves the file but when I read it in,
>> Samplingrate is still 44100
>>
>
> What is savewav? At least not a tuneR function...
>
> In "tuneR":
>
>
> silence8000 <- downsample(silence, 8000)
> writeWave(silence8000, file="silence0.5sec 8000.wav")
>
> Best,
> Uwe Ligges



-- 
Dimitri Liakhovitski



More information about the R-help mailing list