Selaa lähdekoodia

Impove SimpleWavetable example

dds
PaulStoffregen 6 vuotta sitten
vanhempi
commit
8557edb234
5 muutettua tiedostoa jossa 3251 lisäystä ja 3610 poistoa
  1. +0
    -3590
      examples/Synthesis/Wavetable/SimpleWavetable/BasicFlute1_samples.cpp
  2. +0
    -10
      examples/Synthesis/Wavetable/SimpleWavetable/BasicFlute1_samples.h
  3. +3244
    -0
      examples/Synthesis/Wavetable/SimpleWavetable/Flute_100kbyte_samples.cpp
  4. +3
    -0
      examples/Synthesis/Wavetable/SimpleWavetable/Flute_100kbyte_samples.h
  5. +4
    -10
      examples/Synthesis/Wavetable/SimpleWavetable/SimpleWavetable.ino

+ 0
- 3590
examples/Synthesis/Wavetable/SimpleWavetable/BasicFlute1_samples.cpp
File diff suppressed because it is too large
Näytä tiedosto


+ 0
- 10
examples/Synthesis/Wavetable/SimpleWavetable/BasicFlute1_samples.h Näytä tiedosto

@@ -1,10 +0,0 @@
#pragma once
#include <Audio.h>

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

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


extern const uint32_t sample_0_BasicFlute1_BreathyFluteC2[28544];

+ 3244
- 0
examples/Synthesis/Wavetable/SimpleWavetable/Flute_100kbyte_samples.cpp
File diff suppressed because it is too large
Näytä tiedosto


+ 3
- 0
examples/Synthesis/Wavetable/SimpleWavetable/Flute_100kbyte_samples.h Näytä tiedosto

@@ -0,0 +1,3 @@
#pragma once
#include <Audio.h>
extern const AudioSynthWavetable::instrument_data Flute_100kbyte;

+ 4
- 10
examples/Synthesis/Wavetable/SimpleWavetable/SimpleWavetable.ino Näytä tiedosto

@@ -19,7 +19,7 @@
#include <SD.h>
#include <SerialFlash.h>

#include "BasicFlute1_samples.h"
#include "Flute_100kbyte_samples.h"

AudioSynthWavetable wavetable;
AudioOutputI2S i2s1;
@@ -30,21 +30,17 @@ AudioConnection patchCord3(mixer, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1;

// Bounce objects to read pushbuttons
Bounce button0 = Bounce(0, 15);
Bounce button1 = Bounce(1, 15); // 15 ms debounce time
Bounce button2 = Bounce(2, 15);

void setup() {
Serial.begin(115200);
pinMode(0, INPUT_PULLUP);
pinMode(1, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
AudioMemory(20);
sgtl5000_1.enable();
sgtl5000_1.volume(0.8);
mixer.gain(0, 0.7);
wavetable.setInstrument(BasicFlute1);
wavetable.setInstrument(Flute_100kbyte);
wavetable.amplitude(1);
}

@@ -52,14 +48,12 @@ bool playing = false;

void loop() {
// Update all the button objects
button0.update();
button1.update();
button2.update();
//Read knob values
int knob1 = analogRead(A3);
int knob2 = analogRead(A2);
//Get frequency and gain from knobs
float freq = (float)knob1/5.0;
//Get frequency and gain from knobs (Flute range is 261 to 2100 Hz)
float freq = 261.0 + (float)knob1/1023.0 * (2100.0 - 261.0);
float gain = (float)knob2/1023.0;
//Set a low-limit to the gain
if (gain < .05) gain = .05;

Loading…
Peruuta
Tallenna