source: orbit/octave/GenerateAudioCommand/flyOrbit.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.1 KB
Line 
1function fullCodeWave=flyOrbit(code,space,audioFileName,sps,repeatTime,AndroidOriOS,flipOrNot)
2
3% code: array of 1s and 0s. 1 means bit "1", 0 means bit "0".
4% audioFileName: like 'audio.wav'.
5% space: space between codes [us]
6bps = 16;       % bits per sample
7%sps = 96000;     % sample rate [samples/s]
8
9space=floor(space*48000/1e6);
10
11if length(AndroidOriOS)==3 %iOS
12fullCodeWave=[flyCommand(code,space,'temp1.wav',sps,2,AndroidOriOS,flipOrNot);initCodeGen('temp2.wav');flyCommand(code,space,'temp3.wav',sps,repeatTime,AndroidOriOS,flipOrNot)];
13
14elseif length(AndroidOriOS)==7 %Android
15
16        if AndroidOriOS=='Android'
17        fullCodeWave=[flyCommand(code,space,'temp1,wav',sps,4,AndroidOriOS,flipOrNot);initCodeGenAndroid('temp2.wav',sps);zeros(1,1);flyCommand(code,space,'temp3.wav',sps,repeatTime,AndroidOriOS,flipOrNot)];
18        elseif AndroidOriOS=='Command'
19        fullCodeWave=[flyCommand(code,space,'temp3.wav',sps,repeatTime,AndroidOriOS,flipOrNot)];
20        endif
21
22endif
23
24sizeCode=size(fullCodeWave,1);
25time=linspace(0,sizeCode/sps,sizeCode);
26fullCodeWave = [fullCodeWave sin(time*2*pi*440)'];
27
28wavwrite(fullCodeWave, sps, bps, audioFileName);
Note: See TracBrowser for help on using the repository browser.