source: orbit/octave/GenerateAudioCommand/dualBitGen.m @ 3322dad

RawEEGRaw_EEG_PlotServoTab_Interfacepyramid
Last change on this file since 3322dad was 0edc9d8, checked in by AzureViolin <zhanghaotz@…>, 7 years ago

generated working iPad init Code

  • Property mode set to 100644
File size: 662 bytes
Line 
1function wave = dualBitGen(bit,num,sps)
2
3% bit: 1 means bit "1", 0 means bit "0".
4% num: how many certain bit to generate.
5% audioFileName: like 'audio.wav'.
6
7if (bit==0)     bit = 2; endif % data of bit "0" stores in second column in a matrix
8 
9bps = 16;       % bits per sample
10%sps = 960000;     % sample rate [samples/s]
11period = [0.0016 0.0008];   %period of bit "1" and bit "0", respectively [s]
12freq = floor(1./period);       % frequency of the tone [Hz]
13
14nsecs = num*period(bit);      % number of seconds of the audio file
15nsamples = sps*nsecs;
16
17time = linspace(0, nsecs, nsamples);
18wave = [ones(floor(size(time,2)/2),1);zeros(floor(size(time,2)/2),1)];
19
20
Note: See TracBrowser for help on using the repository browser.