help-octave
[Top][All Lists]
Advanced

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

Re: functions for audio


From: Aaron Brick
Subject: Re: functions for audio
Date: Mon, 4 Jun 2001 00:26:19 -0700
User-agent: Mutt/1.3.17i

hello dave,

thanks a lot for your rapid reply! :)

so, to create a CD-quality one-second sample of middle A:

        fs=44100
        freq=440
        saveaudio ("file", sin ( (2*pi) * (freq/fs) * (1:fs) ), "au", 16)

and then:

        sox -r 44100 -t ul file.au file.wav
        play file.wav

the samples come out super-quiet; i multiplied the sine function by about
100 to solve this.

now for a more complex sound which i'm stuck trying to create. i'm
having conceptual difficulties translating my mathematical ideas into the
sine ( constants * range ) form that octave uses.

i'm used to sound wave equations looking like y = A * sine ( F * x ), where
A is an adjustment in amplitude, and F in frequency. i want a sound whose
amplitude increases over time; normally i would define it by setting A =
(1.01)^x. i don't know syntactically how to do this in octave.

and do you know how to calculate nth roots? i can't find any mention of them
in the manual.

many thanks,

aaron.


so said address@hidden in 1.3K bytes at Mon, Jun 04, 2001:

> 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
> -------------------------------------------------------------
> 


                           - | | | | | | | | | | -
                           -                     -
                           -                     -
                           -     aaron brick     -
                           -    address@hidden    -
                           -                     -
                           -                     -
                           - | | | | | | | | | | -



-------------------------------------------------------------
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]