help-octave
[Top][All Lists]
Advanced

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

Re: functions for audio


From: David Erman
Subject: Re: functions for audio
Date: 04 Jun 2001 08:30:30 +0200

On 03 Jun 2001 23:15:33 -0700, Aaron Brick wrote:
> hello all,
> 
> i'm trying to use octave to create sound samples of interesting functions.
> it works to some extent, but i seem to be missing, conceptually, one aspect
> of their composition.
> 
> if i execute the following:
> 
>       saveaudio ("file",sin (0:1:1000), "au", 16)
> 
> i get a sound, as expected, but i don't have control over the relationship
> between its frequency and length. changing the value 1000 affects its
> length, and changing the 1 affects its tone _and_ length. how can i have
> direct control over these factors?
> 
> for the sake of this discussion, i would like to create a 1 second long
> sample of a 100 hz sine tone, and a 2 second sample of a 1000 hz sine tone.
> can anyone write the function that yields those sounds?

How about:

fs = 8000;
seconds = 2;
freq = 1000;
x = 1:fs*seconds;
y = sin(2*pi* freq/fs * x);

That's what I usually do.

/ Dave



-- 
M.Sc.EE with emphasis on Signal Processing pending
UIN:5361039



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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