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

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

iOS working code. Run flyOrbit.m

  • Property mode set to 100644
File size: 1.2 KB
Line 
1function initWave=initCodeGen(audioFileName);
2
3% code: array of 1s and 0s. 1 means bit "1", 0 means bit "0".
4% audioFileName: like 'audio.wav'.
5% Multiplyer: value around 1, to change "carrier" period.
6bps = 16;       % bits per sample
7sps = 48000;     % sample rate [samples/s]
8
9_1stHIGH=14;
10_1stLOW=131;
11_3rdLOW=16;
12_4to9HIGH=12;
13_4to9LOW=3;
14space=4049;
15
16initWave=[halfSineGenDirect('u',_1stHIGH,0,1,sps);zeros(_1stLOW,1);halfSineGenDirect('u',_1stHIGH,0,1,sps);zeros(_1stLOW,1);halfSineGenDirect('u',_1stHIGH,0,1,sps);zeros(_3rdLOW,1)];
17
18for i=1:6
19        initWave=[initWave;halfSineGenDirect('u',_4to9HIGH,0,1,sps);zeros(_4to9LOW,1)];
20endfor
21
22initWave=[initWave;zeros(space,1);initWave;zeros(space,1)];
23
24
25_3rd_4thHIGH=12;
26_3rd_4thLOW=18;
27
28_3rdInitWave=[halfSineGenDirect('u',_1stHIGH,0,1,sps);zeros(_1stLOW,1);halfSineGenDirect('u',_1stHIGH,0,1,sps);zeros(_1stLOW,1);halfSineGenDirect('u', _3rd_4thHIGH,0,1,sps);zeros(_3rd_4thLOW,1);halfSineGenDirect('u', _3rd_4thHIGH,0,1,sps);zeros(_3rd_4thLOW,1)];
29
30for i=1:5
31            _3rdInitWave=[_3rdInitWave;halfSineGenDirect('u',_4to9HIGH,0,1,sps);zeros(_4to9LOW, 1)];
32endfor
33
34initWave=[initWave;_3rdInitWave;zeros(space,1);_3rdInitWave;zeros(space,1)];
35
36
37wavwrite(initWave, sps, bps, audioFileName);
Note: See TracBrowser for help on using the repository browser.