Browse Source

Improve wavetable Zelda example

dds
PaulStoffregen 6 years ago
parent
commit
d79b1b254f
9 changed files with 5090 additions and 14507 deletions
  1. +0
    -7560
      examples/Synthesis/Wavetable/Zelda/BasicFlute1_samples.cpp
  2. +0
    -12
      examples/Synthesis/Wavetable/Zelda/BasicFlute1_samples.h
  3. +0
    -6904
      examples/Synthesis/Wavetable/Zelda/FrenchHorns_samples.cpp
  4. +0
    -10
      examples/Synthesis/Wavetable/Zelda/FrenchHorns_samples.h
  5. +2534
    -0
      examples/Synthesis/Wavetable/Zelda/MutedTrumpet_samples.cpp
  6. +3
    -0
      examples/Synthesis/Wavetable/Zelda/MutedTrumpet_samples.h
  7. +2537
    -0
      examples/Synthesis/Wavetable/Zelda/WT_Trumpet_samples.cpp
  8. +3
    -0
      examples/Synthesis/Wavetable/Zelda/WT_Trumpet_samples.h
  9. +13
    -21
      examples/Synthesis/Wavetable/Zelda/Zelda.ino

+ 0
- 7560
examples/Synthesis/Wavetable/Zelda/BasicFlute1_samples.cpp
File diff suppressed because it is too large
View File


+ 0
- 12
examples/Synthesis/Wavetable/Zelda/BasicFlute1_samples.h View File

#pragma once
#include <Audio.h>

extern const AudioSynthWavetable::sample_data BasicFlute1_samples[2];
const uint8_t BasicFlute1_ranges[] = {54, 127, };

const AudioSynthWavetable::instrument_data BasicFlute1 = {2, BasicFlute1_ranges, BasicFlute1_samples };


extern const uint32_t sample_0_BasicFlute1_BreathyFluteC2[28544];

extern const uint32_t sample_1_BasicFlute1_BreathyFluteA2[31616];

+ 0
- 6904
examples/Synthesis/Wavetable/Zelda/FrenchHorns_samples.cpp
File diff suppressed because it is too large
View File


+ 0
- 10
examples/Synthesis/Wavetable/Zelda/FrenchHorns_samples.h View File

#pragma once
#include <Audio.h>

extern const AudioSynthWavetable::sample_data FrenchHorns_samples[1];
const uint8_t FrenchHorns_ranges[] = {127, };

const AudioSynthWavetable::instrument_data FrenchHorns = {1, FrenchHorns_ranges, FrenchHorns_samples };


extern const uint32_t sample_0_FrenchHorns_FrenchHornsA4L[55040];

+ 2534
- 0
examples/Synthesis/Wavetable/Zelda/MutedTrumpet_samples.cpp
File diff suppressed because it is too large
View File


+ 3
- 0
examples/Synthesis/Wavetable/Zelda/MutedTrumpet_samples.h View File

#pragma once
#include <Audio.h>
extern const AudioSynthWavetable::instrument_data MutedTrumpet;

+ 2537
- 0
examples/Synthesis/Wavetable/Zelda/WT_Trumpet_samples.cpp
File diff suppressed because it is too large
View File


+ 3
- 0
examples/Synthesis/Wavetable/Zelda/WT_Trumpet_samples.h View File

#pragma once
#include <Audio.h>
extern const AudioSynthWavetable::instrument_data WT_Trumpet;

+ 13
- 21
examples/Synthesis/Wavetable/Zelda/Zelda.ino View File

/* Play Zelda music.
/* Play Zelda music, Overland Theme from The Wind Walker

Reference for this music:
https://www.youtube.com/watch?v=RekBzP114do&t=1091s


Requires Teensy 3.6 due to 520 kbytes of wavetable data
Requires Audio Shield: https://www.pjrc.com/store/teensy3_audio.html Requires Audio Shield: https://www.pjrc.com/store/teensy3_audio.html
*/ */


#include <SerialFlash.h> #include <SerialFlash.h>


#include "Pizzicato_samples.h" #include "Pizzicato_samples.h"
#include "FrenchHorns_samples.h"
#include "Viola_samples.h" #include "Viola_samples.h"
#include "BasicFlute1_samples.h"
#include "WT_Trumpet_samples.h"
#include "MutedTrumpet_samples.h"
#include "PlaySynthMusic.h" #include "PlaySynthMusic.h"


//#define DEBUG_ALLOC //#define DEBUG_ALLOC
for (int j = 0; j < 4; ++j) for (int j = 0; j < 4; ++j)
mixer[i].gain(j, 0.25); mixer[i].gain(j, 0.25);
for (int i = 0; i < 4; ++i) for (int i = 0; i < 4; ++i)
mixer[TOTAL_MIXERS - 1].gain(i, i < SECONDARY_MIXERS ? 1.0 / SECONDARY_MIXERS : 0.0);
mixer[TOTAL_MIXERS - 1].gain(i, 0.5);
usbMIDI.setHandleNoteOn(OnNoteOn);
usbMIDI.setHandleNoteOff(OnNoteOff);
//usbMIDI.setHandleNoteOn(OnNoteOn);
//usbMIDI.setHandleNoteOff(OnNoteOff);
//volumeTimer.begin(setVolume, 100000); //volumeTimer.begin(setVolume, 100000);
guitarHeroTimer.begin(guitarHeroMode, 1000000/120);
//guitarHeroTimer.begin(guitarHeroMode, 1000000/120);
//midiMapTimer.begin(printVoices, 5000); //midiMapTimer.begin(printVoices, 5000);


delay(2000); delay(2000);
unsigned char c,opcode,chan; unsigned char c,opcode,chan;
unsigned long d_time; unsigned long d_time;
// Volume control
// uncomment if you have a volume pot soldered to your audio shield
/*
int n = analogRead(15);
if (n != volume) {
volume = n;
codec.volume((float)n / 1023);
}
*/
// read the next note from the table // read the next note from the table
c = *sp++; c = *sp++;
opcode = c & 0xF0; opcode = c & 0xF0;
wavetable[chan].setInstrument(Viola); wavetable[chan].setInstrument(Viola);
break; break;
case 57: case 57:
wavetable[chan].setInstrument(BasicFlute1);
wavetable[chan].setInstrument(WT_Trumpet);
break; break;
default: default:
wavetable[chan].setInstrument(FrenchHorns);
wavetable[chan].setInstrument(MutedTrumpet);
break; break;
} }
return; return;
return; return;
} }


usbMIDI.read();
//usbMIDI.read();
//for (int i = 0; i < TOTAL_BUTTONS; ++i) buttons[i].update(); //for (int i = 0; i < TOTAL_BUTTONS; ++i) buttons[i].update();
//if (buttons[0].fallingEdge()) AudioSynthWavetable::print_performance(); //if (buttons[0].fallingEdge()) AudioSynthWavetable::print_performance();
//if (buttons[1].risingEdge()) { //if (buttons[1].risingEdge()) {

Loading…
Cancel
Save