Ignore:
Timestamp:
12/04/12 19:47:09 (9 years ago)
Author:
dorabot <dorabot@…>
Branches:
master, RawEEG, Raw_EEG_Plot, Servo, Tab_Interface, pyramid
Children:
f323fb4
Parents:
dccf843
Message:

add comment to script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • octave/GenerateAudioCommand/flyCommand.m

    r655a816 rcb3655b  
    77%sps = 96000;     % sample rate [samples/s] 
    88 
     9% 4 demo codes here for testing. you can either put a matrix as the first parameter, or just use 'demo1' ~ 'demo4' for testing purpose.  
    910if length(code)==5 
    1011if code=='demo1' 
    11         code=[1 0 1 1 0 1 1 1 0 1 0 0 1 1 0 0 1 0 0 1 1 1 1 1 0 1 1 0];%minimum rotating throttle 
     12        code=[1 0 1 1 0 1 1 1 0 1 0 0 1 1 0 0 1 0 0 1 1 1 1 1 0 1 1 0];%minimum  throttle to make propeller rotating 
    1213elseif code=='demo2' 
    1314        code=[1 1 1 1 1 1 1 1 0 1 0 0 0 1 1 0 1 0 0 1 1 1 1 1 0 0 0 0];%maximum throttle 
     
    5051elseif length(AndroidOriOS)==7 %'Android' 
    5152 
     53% number with _s suffix is in samples. Optimized with 44100 sampling rate. 
    5254longHIGH=875;longHIGH_s=floor(longHIGH*sps/1e6)-3;%longHIGH[us]  longHIGH_s[sample] 
    5355longLOW=729;longLOW_s=floor(longLOW*sps/1e6+3)+1; 
     
    5557shortLOW=333;shortLOW_s=floor(shortLOW*sps/1e6)+1+2; 
    5658 
    57  
    5859shortLOW_ss=floor(shortLOW*sps/1e6)+2; 
    5960 
     61 
     62% PAY ATTENTION to the special starting and ending code of command. 
    6063codeWave=[halfSineGenDirect('d',longLOW_s-1,0,1,sps);halfSineGenDirect('u',longHIGH_s-2,0,1,sps);    halfSineGenDirect('d',shortLOW_ss+2,0,1,sps);halfSineGenDirect('u',longHIGH_s-2,0,1,sps); halfSineGenDirect('d',shortLOW_ss+3,0,1,sps)]; %starting 5 half period 
    6164 
    6265% notice that the "code" here should be a 28 bit binary array. 
     66% function bitGenDirect will generate a complete digit in the form of sine wave of either "0" or "1" 
    6367for i=1:size(code,2) 
    6468codeWave = [codeWave; bitGenDirect(code(i),1,sps,longHIGH_s,   longLOW_s,shortHIGH_s,shortLOW_s)]; 
    6569         
    6670endfor 
     71 
    6772 
    6873codeWave=[codeWave; halfSineGenDirect('u',longHIGH_s,0,1,sps)];  %last half period 
Note: See TracChangeset for help on using the changeset viewer.