Ignore:
Timestamp:
11/29/12 08:17:10 (8 years ago)
Author:
AzureViolin <zhanghaotz@…>
Branches:
master, RawEEG, Raw_EEG_Plot, Servo, Tab_Interface, pyramid
Children:
0401409, 655a816
Parents:
3322dad
Message:

flyOrbit.m can now generate arbitry control code for play from laptop. update read.me

File:
1 edited

Legend:

Unmodified
Added
Removed
  • octave/GenerateAudioCommand/dualIRLEDAudioGen.m

    r0edc9d8 ra0b523e  
    66bps = 16;       % bits per sample 
    77%sps = 96000;     % sample rate [samples/s] 
    8 shortT=floor(0.0008*sps/2); 
    9 longT=floor(0.0016*sps/2); 
    10 codeWave=[ones(longT,1);zeros(shortT,1);ones(longT,1);zeros(shortT,1)]; 
     8 
     9 
     10shortLOW=floor(0.0008*sps/2)+1; 
     11shortHIGH=floor(0.0008*sps/2)-1; 
     12longHIGH=floor(0.0016*sps/2)-1; 
     13longLOW=floor(0.0016*sps/2)+2; 
     14codeWave=[ones(longHIGH,1);zeros(shortLOW,1);ones(longHIGH,1);zeros(shortLOW,1)]; 
    1115 
    1216% notice that the "code" here should be a 28 bit binary array. 
    1317for i=1:size(code,2) 
    14         codeWave = [codeWave; dualBitGen(code(i),1,sps)]; 
     18        codeWave = [codeWave; dualBitGenDirect(code(i),shortHIGH,shortLOW,longHIGH,longLOW)]; 
    1519endfor 
    1620 
    17 codeWave=[codeWave; ones(longT,1)]; %last half period 
     21codeWave=[codeWave; ones(longHIGH,1)]; %last half period 
    1822 
    1923 
     
    2428fullCodeWave=[]; 
    2529for i=1:repeatTime 
    26         fullCodeWave=[fullCodeWave; codeWave; zeros(sps/20,1)]; 
     30        fullCodeWave=[fullCodeWave; codeWave; zeros(4049,1)]; 
    2731endfor 
    2832 
    2933 
    30 caFreq = 19200;       % frequency of the tone [Hz] 
    31 caNsecs = 10;      % number of seconds of the audio file 
    32 caNsamples = sps*caNsecs; 
    33  
    34 caTime = linspace(0, caNsecs, caNsamples); 
    35 carrierWave = [ones(floor(sps/caFreq/2),1);-ones(floor(sps/caFreq/2),1)]; 
    36  
    37  
    38 caWaveRepeat=[]; 
    39 sizeCW=size(carrierWave,1); 
    40 for i=1:ceil(size(fullCodeWave,1)/sizeCW) 
    41         caWaveRepeat=[caWaveRepeat;carrierWave]; 
    42 endfor 
    43  
    44  
    45  
    46 fullCodeWave = fullCodeWave.*caWaveRepeat(1:size(fullCodeWave,1)); 
    4734wavwrite(fullCodeWave, sps, bps, audioFileName); 
Note: See TracChangeset for help on using the changeset viewer.