source: orbit/octave/GenerateAudioCommand/flyOrbit.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: 939 bytes
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 [samples]
6bps = 16;       % bits per sample
7%sps = 96000;     % sample rate [samples/s]
8if length(AndroidOriOS)==3 %iOS
9fullCodeWave=[flyCommand(code,space,'temp1.wav',sps,2,AndroidOriOS,flipOrNot);initCodeGen('temp2.wav');flyCommand(code,space,'temp3.wav',sps,repeatTime,AndroidOriOS,flipOrNot)];
10
11elseif length(AndroidOriOS)==7 %Android
12fullCodeWave=[flyCommand(code,space,'temp1,wav',sps,20,AndroidOriOS,flipOrNot);initCodeGenAndroid('temp2.wav');zeros(1,1);flyCommand(code,space,'temp3.wav',sps,repeatTime,AndroidOriOS,flipOrNot)];
13
14endif
15
16sizeCode=size(fullCodeWave,1);
17time=linspace(0,sizeCode/sps,sizeCode);
18fullCodeWave = [fullCodeWave sin(time*2*pi*440)'];
19
20wavwrite(fullCodeWave, sps, bps, audioFileName);
Note: See TracBrowser for help on using the repository browser.