help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wavwrite error


From: Pantxo
Subject: Re: wavwrite error
Date: Mon, 10 Sep 2018 02:49:37 -0500 (CDT)

harish3679 wrote
> Hello guys,
> 
> I have problem executing this piece of code, as it throws an error for
> sampling frequency. Please, do share your suggestions
> 
> 
> dur = 1.0;
> fs = 8000;
> tt = 0 : (1/fs) : dur;
> xx = sin( 2*pi*2000*tt );
> wavwrite("sound.wav",xx', fs, 16)
> 
>>> wavwrite("sound.wav",xx', fs, 16)
> error: wavwrite: sample rate FS must be a positive number
> error: called from
>     wavwrite at line 91 column 5
> 
> Thanks and Regards!!
> Harish
> 
> 
> 
> --
> Sent from:
> http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

I don't know what version of Octave you are using but "wavwrite" was removed
in the latest release in favor of "audiowrite" (which has been there since
Octave 4.4).

The problem in your example is that the order of the arguments is not
correct for wavwrite (the filename should be at the end)  but it is correct
for audiowrite. So if your version of Octave is sufficiently recent,
replacing "wavwrite" by "audiowrite" and removing "16" (16 bits per sample
is the default) should do the trick .

Pantxo 



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]