source: orbit/octave/GenerateAudioCommand/codeAudioGen.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: 357 bytes
Line 
1function codeAudioGen(code,audioFileName)
2
3% code: array of 1s and 0s. 1 means bit "1", 0 means bit "0".
4% audioFileName: like 'audio.wav'.
5
6bps = 16;       % bits per sample
7sps = 480000;     % sample rate [samples/s]
8
9codeWave=[];
10
11for i=1:size(code,2)
12        codeWave = [codeWave; bitGen(code(i),1,sps)];
13endfor
14
15wavwrite(codeWave, sps, bps, audioFileName);
Note: See TracBrowser for help on using the repository browser.