KIK 01 Prototype 05

Dependencies:   AverageMCP3008 mbed-rtos mbed mcp3008

Fork of KIK01_Proto03 by Ryo Od

Committer:
ryood
Date:
Fri Sep 15 23:33:27 2017 +0000
Revision:
17:a5d9908bd456
Parent:
16:30cb822e072f
Child:
18:1bf4abf6895b
first commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ryood 3:f89b400cfe57 1 /*
ryood 3:f89b400cfe57 2 * KIK01
ryood 3:f89b400cfe57 3 * Kick Machine
ryood 3:f89b400cfe57 4 *
ryood 17:a5d9908bd456 5 * 2017.09.16 Proto04: SPI1 for AD8402 Wein Bridge DCO & Internal DAC for Dual-OTA-VCA
ryood 15:8f674acdac03 6 * 2017.07.04 Proto03: MCP4922 DCA
ryood 13:43a43da257e3 7 * 2017.06.19 Proto02
ryood 3:f89b400cfe57 8 * 2017.06.04 created.
ryood 3:f89b400cfe57 9 *
ryood 3:f89b400cfe57 10 */
ryood 3:f89b400cfe57 11
ryood 0:2dcec10e9199 12 #include "mbed.h"
ryood 0:2dcec10e9199 13 #include "rtos.h"
ryood 13:43a43da257e3 14 #include "mcp3008.h"
ryood 0:2dcec10e9199 15
ryood 17:a5d9908bd456 16 #define UART_TRACE (1)
ryood 12:5b498285d121 17 #define PIN_CHECK (1)
ryood 0:2dcec10e9199 18 #define TITLE_STR1 ("KIK01 Kick Machine")
ryood 17:a5d9908bd456 19 #define TITLE_STR2 ("20170916")
ryood 0:2dcec10e9199 20
ryood 0:2dcec10e9199 21 #define PI_F (3.1415926f)
ryood 15:8f674acdac03 22
ryood 17:a5d9908bd456 23 #define MCP3008_SPI_SPEED (1000000)
ryood 17:a5d9908bd456 24 #define AD8402_SPI_SPEED (4000000)
ryood 17:a5d9908bd456 25 #define ENVELOPE_UPDATE_RATE (1000) // Hz
ryood 17:a5d9908bd456 26
ryood 17:a5d9908bd456 27 AnalogOut Dac1(A2);
ryood 3:f89b400cfe57 28
ryood 17:a5d9908bd456 29 /*
ryood 16:30cb822e072f 30 SPI SpiM1(SPI_MOSI, SPI_MISO, SPI_SCK);
ryood 17:a5d9908bd456 31 */
ryood 15:8f674acdac03 32
ryood 17:a5d9908bd456 33 SPI SpiM3(D4, D5, D3);
ryood 17:a5d9908bd456 34 MCP3008 Adc0(&SpiM3, D6);
ryood 17:a5d9908bd456 35 MCP3008 Adc1(&SpiM3, D7);
ryood 8:bb34a4894337 36
ryood 14:8e96f97e261b 37 // Check pins
ryood 17:a5d9908bd456 38 DigitalOut Dout0(D8);
ryood 17:a5d9908bd456 39 DigitalOut Dout1(D9);
ryood 17:a5d9908bd456 40 DigitalOut Dout2(D14);
ryood 14:8e96f97e261b 41
ryood 14:8e96f97e261b 42 // Sync
ryood 17:a5d9908bd456 43 DigitalOut SyncPin(D2);
ryood 12:5b498285d121 44
ryood 11:7e11404adca0 45 class EnvelopeAR
ryood 11:7e11404adca0 46 {
ryood 0:2dcec10e9199 47 public:
ryood 0:2dcec10e9199 48 EnvelopeAR(int _attack, int _release, float _v0, float _v1, float _v2, float _attackTauRatio=0.36f, float _releaseTauRatio=0.36f) :
ryood 0:2dcec10e9199 49 amplitude(_v0),
ryood 0:2dcec10e9199 50 v0(_v0),
ryood 0:2dcec10e9199 51 v1(_v1),
ryood 0:2dcec10e9199 52 v2(_v2),
ryood 0:2dcec10e9199 53 vLast(_v0),
ryood 0:2dcec10e9199 54 attackTauRatio(_attackTauRatio),
ryood 11:7e11404adca0 55 releaseTauRatio(_releaseTauRatio) {
ryood 0:2dcec10e9199 56 setAttack(_attack);
ryood 0:2dcec10e9199 57 setRelease(_release);
ryood 0:2dcec10e9199 58 }
ryood 0:2dcec10e9199 59
ryood 0:2dcec10e9199 60 ~EnvelopeAR() {}
ryood 0:2dcec10e9199 61
ryood 0:2dcec10e9199 62 void setAttack(int _attack) {
ryood 0:2dcec10e9199 63 attack = _attack;
ryood 0:2dcec10e9199 64 tau0 = attack * attackTauRatio;
ryood 0:2dcec10e9199 65 }
ryood 11:7e11404adca0 66 int getAttack() {
ryood 11:7e11404adca0 67 return attack;
ryood 11:7e11404adca0 68 }
ryood 0:2dcec10e9199 69
ryood 0:2dcec10e9199 70 void setRelease(int _release) {
ryood 0:2dcec10e9199 71 release = _release;
ryood 0:2dcec10e9199 72 tau1 = release * releaseTauRatio;
ryood 0:2dcec10e9199 73 }
ryood 11:7e11404adca0 74 int getRelease() {
ryood 11:7e11404adca0 75 return release;
ryood 11:7e11404adca0 76 }
ryood 0:2dcec10e9199 77
ryood 5:846772a77d33 78 void setAttackTauRatio(float _attackTauRatio) {
ryood 5:846772a77d33 79 attackTauRatio = _attackTauRatio;
ryood 5:846772a77d33 80 tau0 = attack * attackTauRatio;
ryood 5:846772a77d33 81 }
ryood 11:7e11404adca0 82 float getAttackTauRatio() {
ryood 11:7e11404adca0 83 return attackTauRatio;
ryood 11:7e11404adca0 84 }
ryood 0:2dcec10e9199 85
ryood 11:7e11404adca0 86 void setReleaseTauRatio(float _releaseTauRatio) {
ryood 5:846772a77d33 87 releaseTauRatio = _releaseTauRatio;
ryood 5:846772a77d33 88 tau1 = release * releaseTauRatio;
ryood 5:846772a77d33 89 }
ryood 11:7e11404adca0 90 float getReleaseTauRatio() {
ryood 11:7e11404adca0 91 return releaseTauRatio;
ryood 11:7e11404adca0 92 }
ryood 11:7e11404adca0 93
ryood 11:7e11404adca0 94 float getTau0() {
ryood 11:7e11404adca0 95 return tau0;
ryood 11:7e11404adca0 96 }
ryood 11:7e11404adca0 97 float getTau1() {
ryood 11:7e11404adca0 98 return tau1;
ryood 11:7e11404adca0 99 }
ryood 0:2dcec10e9199 100
ryood 11:7e11404adca0 101 void setV0(float _v0) {
ryood 11:7e11404adca0 102 v0 = _v0;
ryood 11:7e11404adca0 103 }
ryood 11:7e11404adca0 104 float getV0() {
ryood 11:7e11404adca0 105 return v0;
ryood 11:7e11404adca0 106 }
ryood 11:7e11404adca0 107 void setV1(float _v1) {
ryood 11:7e11404adca0 108 v1 = _v1;
ryood 11:7e11404adca0 109 }
ryood 11:7e11404adca0 110 float getV1() {
ryood 11:7e11404adca0 111 return v1;
ryood 11:7e11404adca0 112 }
ryood 11:7e11404adca0 113 void setV2(float _v2) {
ryood 11:7e11404adca0 114 v2 = _v2;
ryood 11:7e11404adca0 115 }
ryood 11:7e11404adca0 116 float getV2() {
ryood 11:7e11404adca0 117 return v2;
ryood 11:7e11404adca0 118 }
ryood 0:2dcec10e9199 119
ryood 11:7e11404adca0 120 float getAmplitude() {
ryood 11:7e11404adca0 121 return amplitude;
ryood 11:7e11404adca0 122 }
ryood 0:2dcec10e9199 123 float getAmplitude(int tick) {
ryood 0:2dcec10e9199 124 if (tick < attack) {
ryood 0:2dcec10e9199 125 // attackの処理
ryood 0:2dcec10e9199 126 amplitude = v0 + (v1 - v0) * (1 - expf(-(float)tick / tau0));
ryood 0:2dcec10e9199 127 vLast = amplitude;
ryood 11:7e11404adca0 128 } else {
ryood 0:2dcec10e9199 129 // releaseの処理
ryood 0:2dcec10e9199 130 amplitude = (vLast - v2) * (expf(-(float)(tick - attack) / tau1)) + v2;
ryood 0:2dcec10e9199 131 }
ryood 0:2dcec10e9199 132 return amplitude;
ryood 0:2dcec10e9199 133 }
ryood 0:2dcec10e9199 134
ryood 0:2dcec10e9199 135 private:
ryood 0:2dcec10e9199 136 int attack;
ryood 0:2dcec10e9199 137 int release;
ryood 0:2dcec10e9199 138 float amplitude;
ryood 0:2dcec10e9199 139 float v0;
ryood 0:2dcec10e9199 140 float v1;
ryood 0:2dcec10e9199 141 float v2;
ryood 0:2dcec10e9199 142 float vLast;
ryood 0:2dcec10e9199 143 float tau0;
ryood 0:2dcec10e9199 144 float tau1;
ryood 0:2dcec10e9199 145 float attackTauRatio;
ryood 0:2dcec10e9199 146 float releaseTauRatio;
ryood 0:2dcec10e9199 147 };
ryood 0:2dcec10e9199 148
ryood 11:7e11404adca0 149 class EnvelopeParam
ryood 11:7e11404adca0 150 {
ryood 5:846772a77d33 151 public:
ryood 5:846772a77d33 152 int attack;
ryood 5:846772a77d33 153 int release;
ryood 5:846772a77d33 154 float v0;
ryood 5:846772a77d33 155 float v1;
ryood 5:846772a77d33 156 float v2;
ryood 5:846772a77d33 157 float attackTauRatio;
ryood 5:846772a77d33 158 float releaseTauRatio;
ryood 5:846772a77d33 159 };
ryood 11:7e11404adca0 160
ryood 9:d1e6eae9722b 161 EnvelopeAR envelopeFrequency(5, 300, 880.0f, 120.0f, 40.0f, 0.36f, 0.1f);
ryood 5:846772a77d33 162 EnvelopeAR envelopeAmplitude(50, 200, 0.99f, 1.0f, 0.0f);
ryood 5:846772a77d33 163
ryood 5:846772a77d33 164 volatile EnvelopeParam frequencyParam;
ryood 5:846772a77d33 165 volatile EnvelopeParam amplitudeParam;
ryood 0:2dcec10e9199 166
ryood 3:f89b400cfe57 167 volatile int ticks;
ryood 3:f89b400cfe57 168 volatile float frequency;
ryood 3:f89b400cfe57 169 volatile float amplitude;
ryood 3:f89b400cfe57 170
ryood 5:846772a77d33 171 volatile float bpm;
ryood 5:846772a77d33 172 volatile int envelopeLength;
ryood 14:8e96f97e261b 173 volatile int stepLength;
ryood 0:2dcec10e9199 174
ryood 17:a5d9908bd456 175 #if 0
ryood 15:8f674acdac03 176 //-----------------------------------------------------------------------------//
ryood 15:8f674acdac03 177 // Internal DCA
ryood 15:8f674acdac03 178 //
ryood 15:8f674acdac03 179 void generateWave_DcaInternal()
ryood 0:2dcec10e9199 180 {
ryood 0:2dcec10e9199 181 phi += phiDelta;
ryood 0:2dcec10e9199 182 if (phi >= 1.0f) {
ryood 0:2dcec10e9199 183 phi -= 2.0f;
ryood 0:2dcec10e9199 184 }
ryood 10:79134dbb339d 185 float level = cosf(PI_F * phi) * amplitude;
ryood 1:f9b967ae26e4 186
ryood 3:f89b400cfe57 187 Dac1.write((level * 0.7f + 1.0f) / 2.0f);
ryood 0:2dcec10e9199 188 }
ryood 0:2dcec10e9199 189
ryood 15:8f674acdac03 190 void generateEnvelope_DcaInternal()
ryood 0:2dcec10e9199 191 {
ryood 0:2dcec10e9199 192 // Frequency Envelope
ryood 0:2dcec10e9199 193 frequency = envelopeFrequency.getAmplitude(envelopeTicks);
ryood 0:2dcec10e9199 194 phiDelta = 2.0f * frequency / SAMPLING_RATE;
ryood 0:2dcec10e9199 195
ryood 0:2dcec10e9199 196 // Amplitude Envelope
ryood 0:2dcec10e9199 197 amplitude = envelopeAmplitude.getAmplitude(envelopeTicks);
ryood 0:2dcec10e9199 198
ryood 0:2dcec10e9199 199 envelopeTicks++;
ryood 7:6735a343780e 200 if (envelopeTicks >= envelopeLength) {
ryood 0:2dcec10e9199 201 envelopeTicks = 0;
ryood 12:5b498285d121 202 phi = PI_F / 2.0f;
ryood 0:2dcec10e9199 203 }
ryood 0:2dcec10e9199 204 }
ryood 0:2dcec10e9199 205
ryood 15:8f674acdac03 206 //-----------------------------------------------------------------------------//
ryood 15:8f674acdac03 207 // External DCA
ryood 15:8f674acdac03 208 //
ryood 15:8f674acdac03 209 void generateWave_DcaExternal()
ryood 15:8f674acdac03 210 {
ryood 15:8f674acdac03 211 phi += phiDelta;
ryood 15:8f674acdac03 212 if (phi >= 1.0f) {
ryood 15:8f674acdac03 213 phi -= 2.0f;
ryood 15:8f674acdac03 214 }
ryood 15:8f674acdac03 215 //float level = cosf(PI_F * phi) * amplitude;
ryood 15:8f674acdac03 216 float level = cosf(PI_F * phi);
ryood 15:8f674acdac03 217
ryood 15:8f674acdac03 218 Dac1.write((level * 0.7f + 1.0f) / 2.0f);
ryood 15:8f674acdac03 219 }
ryood 15:8f674acdac03 220
ryood 15:8f674acdac03 221 void generateEnvelope_DcaExternal()
ryood 15:8f674acdac03 222 {
ryood 15:8f674acdac03 223 // Frequency Envelope
ryood 15:8f674acdac03 224 frequency = envelopeFrequency.getAmplitude(envelopeTicks);
ryood 15:8f674acdac03 225 phiDelta = 2.0f * frequency / SAMPLING_RATE;
ryood 15:8f674acdac03 226
ryood 15:8f674acdac03 227 // Amplitude Envelope
ryood 15:8f674acdac03 228 amplitude = envelopeAmplitude.getAmplitude(envelopeTicks);
ryood 15:8f674acdac03 229
ryood 15:8f674acdac03 230 ampController.outDca(amplitude * 4096);
ryood 15:8f674acdac03 231
ryood 15:8f674acdac03 232 envelopeTicks++;
ryood 15:8f674acdac03 233 if (envelopeTicks >= envelopeLength) {
ryood 15:8f674acdac03 234 envelopeTicks = 0;
ryood 15:8f674acdac03 235 phi = PI_F / 2.0f;
ryood 15:8f674acdac03 236 }
ryood 15:8f674acdac03 237 }
ryood 17:a5d9908bd456 238 #endif
ryood 17:a5d9908bd456 239
ryood 17:a5d9908bd456 240 void AD8402Write(uint8_t address, uint8_t value)
ryood 17:a5d9908bd456 241 {
ryood 17:a5d9908bd456 242 wait_us(10);
ryood 17:a5d9908bd456 243 /*
ryood 17:a5d9908bd456 244 SpiCs = 0;
ryood 17:a5d9908bd456 245 SpiM.write(address);
ryood 17:a5d9908bd456 246 SpiM.write(value);
ryood 17:a5d9908bd456 247 SpiCs = 1;
ryood 17:a5d9908bd456 248 wait_us(1);
ryood 17:a5d9908bd456 249 */
ryood 17:a5d9908bd456 250 }
ryood 17:a5d9908bd456 251
ryood 17:a5d9908bd456 252 void DcoSetFrequency()
ryood 17:a5d9908bd456 253 {
ryood 17:a5d9908bd456 254 #if (PIN_CHECK)
ryood 17:a5d9908bd456 255 Dout1 = 1;
ryood 17:a5d9908bd456 256 #endif
ryood 17:a5d9908bd456 257
ryood 17:a5d9908bd456 258 frequency = envelopeFrequency.getAmplitude(ticks);
ryood 17:a5d9908bd456 259 const float c = 0.00000047;
ryood 17:a5d9908bd456 260 float r = 1.0f / (2.0f * PI_F * frequency * c);
ryood 17:a5d9908bd456 261 uint8_t v = 256.0f * (r - 50.0f) / 10000.0f;
ryood 17:a5d9908bd456 262
ryood 17:a5d9908bd456 263 //printf("%d\r\n", v);
ryood 17:a5d9908bd456 264
ryood 17:a5d9908bd456 265 AD8402Write(0, v);
ryood 17:a5d9908bd456 266 AD8402Write(1, v);
ryood 17:a5d9908bd456 267
ryood 17:a5d9908bd456 268 #if (PIN_CHECK)
ryood 17:a5d9908bd456 269 Dout1 = 0;
ryood 17:a5d9908bd456 270 #endif
ryood 17:a5d9908bd456 271 }
ryood 15:8f674acdac03 272
ryood 2:8dff77a1ee4d 273 void update()
ryood 2:8dff77a1ee4d 274 {
ryood 12:5b498285d121 275 #if (PIN_CHECK)
ryood 15:8f674acdac03 276 Dout0 = 1;
ryood 12:5b498285d121 277 #endif
ryood 15:8f674acdac03 278
ryood 14:8e96f97e261b 279 // Output Sync Signal per steps
ryood 17:a5d9908bd456 280 if (ticks % stepLength == 0) {
ryood 14:8e96f97e261b 281 SyncPin = 1;
ryood 14:8e96f97e261b 282 }
ryood 15:8f674acdac03 283
ryood 17:a5d9908bd456 284 // set envelope parameters
ryood 17:a5d9908bd456 285 envelopeAmplitude.setAttack(amplitudeParam.attack);
ryood 17:a5d9908bd456 286 envelopeAmplitude.setRelease(amplitudeParam.release);
ryood 17:a5d9908bd456 287 envelopeAmplitude.setV0(amplitudeParam.v0);
ryood 17:a5d9908bd456 288 envelopeAmplitude.setV1(amplitudeParam.v1);
ryood 17:a5d9908bd456 289 envelopeAmplitude.setV2(amplitudeParam.v2);
ryood 17:a5d9908bd456 290 envelopeAmplitude.setAttackTauRatio(amplitudeParam.attackTauRatio);
ryood 17:a5d9908bd456 291 envelopeAmplitude.setReleaseTauRatio(amplitudeParam.releaseTauRatio);
ryood 11:7e11404adca0 292
ryood 17:a5d9908bd456 293 envelopeFrequency.setAttack(frequencyParam.attack);
ryood 17:a5d9908bd456 294 envelopeFrequency.setRelease(frequencyParam.release);
ryood 17:a5d9908bd456 295 envelopeFrequency.setV0(frequencyParam.v0);
ryood 17:a5d9908bd456 296 envelopeFrequency.setV1(frequencyParam.v1);
ryood 17:a5d9908bd456 297 envelopeFrequency.setV2(frequencyParam.v2);
ryood 17:a5d9908bd456 298 envelopeFrequency.setAttackTauRatio(frequencyParam.attackTauRatio);
ryood 17:a5d9908bd456 299 envelopeFrequency.setReleaseTauRatio(frequencyParam.releaseTauRatio);
ryood 11:7e11404adca0 300
ryood 17:a5d9908bd456 301 DcoSetFrequency();
ryood 11:7e11404adca0 302
ryood 17:a5d9908bd456 303 ticks++;
ryood 17:a5d9908bd456 304 if (ticks >= envelopeLength) {
ryood 17:a5d9908bd456 305 ticks = 0;
ryood 2:8dff77a1ee4d 306 }
ryood 15:8f674acdac03 307
ryood 14:8e96f97e261b 308 // Output SyncSignal
ryood 14:8e96f97e261b 309 SyncPin = 0;
ryood 15:8f674acdac03 310
ryood 12:5b498285d121 311 #if (PIN_CHECK)
ryood 15:8f674acdac03 312 Dout0 = 0;
ryood 12:5b498285d121 313 #endif
ryood 2:8dff77a1ee4d 314 }
ryood 2:8dff77a1ee4d 315
ryood 5:846772a77d33 316 void setParams()
ryood 5:846772a77d33 317 {
ryood 13:43a43da257e3 318 bpm = Adc0.read_input(7) * 180.0f + 60.0f;
ryood 12:5b498285d121 319 envelopeLength = 60 * ENVELOPE_UPDATE_RATE / bpm;
ryood 14:8e96f97e261b 320 stepLength = envelopeLength / 4;
ryood 11:7e11404adca0 321
ryood 13:43a43da257e3 322 amplitudeParam.attack = Adc0.read_input(0) * envelopeLength;
ryood 13:43a43da257e3 323 amplitudeParam.release = Adc0.read_input(1) * envelopeLength;
ryood 13:43a43da257e3 324 amplitudeParam.v0 = Adc0.read_input(4);
ryood 14:8e96f97e261b 325 amplitudeParam.v1 = Adc0.read_input(5);
ryood 14:8e96f97e261b 326 amplitudeParam.v2 = Adc0.read_input(6);
ryood 5:846772a77d33 327 amplitudeParam.attackTauRatio = 0.36f;
ryood 13:43a43da257e3 328 amplitudeParam.releaseTauRatio = Adc0.read_input(3) + 0.01f;
ryood 11:7e11404adca0 329
ryood 13:43a43da257e3 330 frequencyParam.attack = Adc1.read_input(0) * envelopeLength * 0.1f;
ryood 13:43a43da257e3 331 frequencyParam.release = Adc1.read_input(1) * envelopeLength + 1;
ryood 13:43a43da257e3 332 frequencyParam.v0 = Adc1.read_input(4) * 4000.0f;
ryood 13:43a43da257e3 333 frequencyParam.v1 = Adc1.read_input(5) * 400.0f;
ryood 13:43a43da257e3 334 frequencyParam.v2 = Adc1.read_input(6) * 400.0f;
ryood 13:43a43da257e3 335 frequencyParam.attackTauRatio = Adc1.read_input(2) + 0.01f;
ryood 13:43a43da257e3 336 frequencyParam.releaseTauRatio = Adc1.read_input(3) + 0.01f;
ryood 5:846772a77d33 337 }
ryood 5:846772a77d33 338
ryood 0:2dcec10e9199 339 int main()
ryood 0:2dcec10e9199 340 {
ryood 0:2dcec10e9199 341 printf("%s %s\r\n", TITLE_STR1, TITLE_STR2);
ryood 15:8f674acdac03 342
ryood 17:a5d9908bd456 343 /*
ryood 16:30cb822e072f 344 SpiM1.format(0, 0);
ryood 16:30cb822e072f 345 SpiM1.frequency(2000000);
ryood 17:a5d9908bd456 346 */
ryood 17:a5d9908bd456 347
ryood 17:a5d9908bd456 348 SpiM3.format(8, 0);
ryood 17:a5d9908bd456 349 SpiM3.frequency(MCP3008_SPI_SPEED);
ryood 15:8f674acdac03 350
ryood 17:a5d9908bd456 351 frequency = 100.0f;
ryood 0:2dcec10e9199 352 amplitude = 1.0f;
ryood 17:a5d9908bd456 353 bpm = 120.0f;
ryood 17:a5d9908bd456 354
ryood 17:a5d9908bd456 355 setParams();
ryood 11:7e11404adca0 356
ryood 3:f89b400cfe57 357 ticks = 0;
ryood 2:8dff77a1ee4d 358 Ticker samplingTicker;
ryood 17:a5d9908bd456 359 samplingTicker.attach(&update, (1.0f/ENVELOPE_UPDATE_RATE));
ryood 11:7e11404adca0 360
ryood 3:f89b400cfe57 361 for (;;) {
ryood 13:43a43da257e3 362 #if (PIN_CHECK)
ryood 13:43a43da257e3 363 Dout2 = 1;
ryood 15:8f674acdac03 364 #endif
ryood 5:846772a77d33 365 setParams();
ryood 13:43a43da257e3 366 #if (PIN_CHECK)
ryood 13:43a43da257e3 367 Dout2 = 0;
ryood 15:8f674acdac03 368 #endif
ryood 11:7e11404adca0 369
ryood 11:7e11404adca0 370 #if UART_TRACE
ryood 6:897d6392b408 371 printf("%.1f\t%d\t", bpm, envelopeLength);
ryood 11:7e11404adca0 372
ryood 6:897d6392b408 373 printf("%d\t%d\t", amplitudeParam.attack, amplitudeParam.release);
ryood 6:897d6392b408 374 printf("%.2f\t%.2f\t%.2f\t", amplitudeParam.v0, amplitudeParam.v1, amplitudeParam.v2);
ryood 6:897d6392b408 375 printf("%.2f\t%.2f\t", amplitudeParam.attackTauRatio, amplitudeParam.releaseTauRatio);
ryood 6:897d6392b408 376
ryood 6:897d6392b408 377 printf("%d\t%d\t", frequencyParam.attack, frequencyParam.release);
ryood 6:897d6392b408 378 printf("%.2f\t%.2f\t%.2f\t", frequencyParam.v0, frequencyParam.v1, frequencyParam.v2);
ryood 6:897d6392b408 379 printf("%.2f\t%.2f\r\n", frequencyParam.attackTauRatio, frequencyParam.releaseTauRatio);
ryood 11:7e11404adca0 380 #endif
ryood 11:7e11404adca0 381
ryood 13:43a43da257e3 382 Thread::wait(1);
ryood 3:f89b400cfe57 383 }
ryood 0:2dcec10e9199 384 }