source: orbit/octave/GenerateAudioCommand/initCodeGenAndroid.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.7 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
8_longHIGH=1000; %[us]
9_longLOW=2000;
10_mediumLOW=500;
11_shortHIGH=100;
12_shortLOW=180;
13_pause=10000;
14_space=84354;
15
16longHIGH=floor(_longHIGH*sps/1e6)-1;
17longLOW=floor(_longLOW*sps/1e6)+1;
18mediumLOW=floor(_mediumLOW*sps/1e6)-1;
19shortHIGH=floor(_shortHIGH*sps/1e6)+1;
20shortLOW=floor(_shortLOW*sps/1e6);
21pause=floor(_pause*sps/1e6);
22space=floor(_space*sps/1e6);
23
24initWave=[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)];
25
26initWave2=[initWave;halfSineGenDirect('d',shortLOW,0,1,sps)];
27initWave=[initWave;halfSineGenDirect('d',mediumLOW,0,1,sps)];
28
29
30for i=1:4
31        initWave=[initWave;halfSineGenDirect('u',shortHIGH,0,1,sps);halfSineGenDirect('d',shortLOW,0,1,sps);];
32        initWave2=[initWave2;halfSineGenDirect('u',shortHIGH,0,1,sps); halfSineGenDirect('d',shortLOW,0,1,sps);];
33        endfor
34
35initWave=[initWave;halfSineGenDirect('u',shortHIGH,0,1,sps);halfSineGenDirect('d',mediumLOW,0,1,sps);halfSineGenDirect('u',shortHIGH,0,1,sps)];
36
37initWave2=[initWave2;halfSineGenDirect('u',shortHIGH,0,1,sps);     halfSineGenDirect('d',mediumLOW,0,1,sps);halfSineGenDirect('u',  shortHIGH,0,1,sps)];
38
39initWave=[initWave;zeros(pause,1);initWave;zeros(pause,1);initWave;zeros(pause,1);initWave2;zeros(pause,1);initWave2;zeros(pause,1);initWave2;zeros(pause,1)];
40
41
42
43wavwrite(initWave, sps, bps, audioFileName);
Note: See TracBrowser for help on using the repository browser.