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

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

flyOrbit Works should for EVERY Android (not tested)

  • Property mode set to 100644
File size: 1.5 KB
Line 
1function initWave=initCodeGenAndroid(audioFileName,sps);
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
7
8longHIGH=1000; %[ms]
9
10longHIGH_s=45+3;
11longLOW_s=89+7;
12mediumLOW_s=21+2;
13shortHIGH_s=5;
14shortLOW_s=8;
15pause_s=480;
16space_s=4049;
17
18initWave=[halfSineGenDirect('u',longHIGH,0,1,sps);zeros(longLOW,1);halfSineGenDirect('u',longHIGH,0,1,sps);zeros(longLOW,1);halfSineGenDirect('u',longHIGH,0,1,sps);halfSineGenDirect('d',mediumLOW,0,1,sps);halfSineGenDirect('u',shortHIGH,0,1,sps)];
19
20initWave2=[initWave;halfSineGenDirect('d',shortLOW,0,1,sps)];
21initWave=[initWave;halfSineGenDirect('d',mediumLOW,0,1,sps)];
22
23
24for i=1:4
25        initWave=[initWave;halfSineGenDirect('u',shortHIGH,0,1,sps);halfSineGenDirect('d',shortLOW,0,1,sps);];
26        initWave2=[initWave2;halfSineGenDirect('u',shortHIGH,0,1,sps); halfSineGenDirect('d',shortLOW,0,1,sps);];
27        endfor
28
29initWave=[initWave;halfSineGenDirect('u',shortHIGH,0,1,sps);halfSineGenDirect('d',mediumLOW,0,1,sps);halfSineGenDirect('u',shortHIGH,0,1,sps)];
30
31initWave2=[initWave2;halfSineGenDirect('u',shortHIGH,0,1,sps);     halfSineGenDirect('d',mediumLOW,0,1,sps);halfSineGenDirect('u',  shortHIGH,0,1,sps)];
32
33initWave=[initWave;zeros(pause,1);initWave;zeros(pause,1);initWave;zeros(pause,1);initWave2;zeros(pause,1);initWave2;zeros(pause,1);initWave2;zeros(pause,1)];
34
35
36
37wavwrite(initWave, sps, bps, audioFileName);
Note: See TracBrowser for help on using the repository browser.