source: orbit/octave/GenerateAudioCommand/initCodeGenAndroid.m @ a0b523e

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

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

  • Property mode set to 100644
File size: 1.5 KB
Line 
1function initWave=initCodeGenAndroid(audioFileName);
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
7sps = 48000;     % sample rate [samples/s]
8
9longHIGH=45+3;
10longLOW=89+7;
11mediumLOW=21+2;
12shortHIGH=5;
13shortLOW=8;
14pause=480;
15space=4049;
16
17initWave=[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)];
18
19initWave2=[initWave;halfSineGenDirect('d',shortLOW,0,1,sps)];
20initWave=[initWave;halfSineGenDirect('d',mediumLOW,0,1,sps)];
21
22
23for i=1:4
24        initWave=[initWave;halfSineGenDirect('u',shortHIGH,0,1,sps);halfSineGenDirect('d',shortLOW,0,1,sps);];
25        initWave2=[initWave2;halfSineGenDirect('u',shortHIGH,0,1,sps); halfSineGenDirect('d',shortLOW,0,1,sps);];
26        endfor
27
28initWave=[initWave;halfSineGenDirect('u',shortHIGH,0,1,sps);halfSineGenDirect('d',mediumLOW,0,1,sps);halfSineGenDirect('u',shortHIGH,0,1,sps)];
29
30initWave2=[initWave2;halfSineGenDirect('u',shortHIGH,0,1,sps);     halfSineGenDirect('d',mediumLOW,0,1,sps);halfSineGenDirect('u',  shortHIGH,0,1,sps)];
31
32initWave=[initWave;zeros(pause,1);initWave;zeros(pause,1);initWave;zeros(pause,1);initWave2;zeros(pause,1);initWave2;zeros(pause,1);initWave2;zeros(pause,1)];
33
34
35
36wavwrite(initWave, sps, bps, audioFileName);
Note: See TracBrowser for help on using the repository browser.