help-octave
[Top][All Lists]

## Re: Audio signal

 From: Doug Stewart Subject: Re: Audio signal Date: Sat, 17 Nov 2007 13:55:10 -0500 User-agent: Thunderbird 1.5.0.13 (Windows/20070809)

```polmc wrote:
```
```Ok, I have to synthetize an audio signal. I must do this by suming up the
harmonics of the sound.

So long I've got this:

function sinte(f)
```
t=0:0.0001:0.0854;
```  Fs = 44100;
tau6 = 0.018;
A6 = 25.1;
f6 = f*7;
x6 = A6*exp(-t/tau6).*sin(2*pi*f6*t/Fs);
```
tau7 = 0.016;
```  A7 = 15.8;
f7 = f*8;
x7 = A7*exp(-t/tau7).*sin(2*pi*f7*t/Fs);
```
tau8 = 0.017;
```  A8 = 19.9;
f8 = f*9;
x8 = A8*exp(-t/tau8).*sin(2*pi*f8*t/Fs);
```
tau9 = 0.038;
```  A9 = 12.5;
f9 = f*10;
x9 = A9*exp(-t/tau9).*sin(2*pi*f9*t/Fs);
```
tau10 = 0.017;
```  A10 = 10;
f10 = f*11;
x10 = A10*exp(-t/tau10).*sin(2*pi*f10*t/Fs);
```
x = x6 + x7 + x8 + x9 + x9 + x10;
```
wavwrite(x,Fs,16,"so.wav");
```
endfunction
```

```
When I play the sound, I just hear a short 'puff'.
```The thing is that if I take away the '/Fs', It then sounds like a normal
'beep', which is what I want (I guess). Does anyone know what exactly does
the Fs mean?

```
Yes Fs is the sample frequency. Thus for your code you are sampling the audio signal 44100 samples per second. if you want to hear 5 second of sound then you must get 44100*5 samples anf write it out to the wave file.
```You are only generating  854 samples thus only 854/44100 of a second!!!!!

Doug

```