source: orbit/octave/GenerateAudioCommand/mysound2.m @ f22b7ab

RawEEGRaw_EEG_PlotServoTab_Interfacepyramid
Last change on this file since f22b7ab was 6aa182f, checked in by AzureViolin <zhanghaotz@…>, 8 years ago

add octave script

  • Property mode set to 100644
File size: 513 bytes
Line 
1bps = 16;       % bits per sample
2sps = 8000;     % sample rate [samples/s]
3freq = 400;       % frequency of the tone [Hz]
4nsecs = 5;      % number of seconds of the audio file
5
6nsamples = sps*nsecs;
7
8time = linspace(0, nsecs, nsamples);
9wave = sin(time*2*pi*freq)';
10
11% create the amplitude window (creates the fade in and fade out when multiplied with the sine wave)
12a = b = floor(.3*nsamples);
13window = [linspace(0,1,a), ones(1,nsamples-a-b), linspace(1,0,b)]';
14
15
16wavwrite(wave.*window, sps, bps, 'audio.wav')
Note: See TracBrowser for help on using the repository browser.