Quellcode durchsuchen

Add comments to wavetable synth examples

dds
PaulStoffregen vor 6 Jahren
Ursprung
Commit
ab87205424
54 geänderte Dateien mit 52 neuen und 1 gelöschten Zeilen
  1. +10
    -0
      examples/Synthesis/Wavetable/MidiSynth/MidiSynth.ino
  2. +11
    -0
      examples/Synthesis/Wavetable/MidiSynthKeyboard/MidiSynthKeyboard.ino
  3. +9
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/MidiSynthLarge.ino
  4. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/bassoon_samples.cpp
  5. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/bassoon_samples.h
  6. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/clarinet_samples.cpp
  7. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/clarinet_samples.h
  8. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/distortiongt_samples.cpp
  9. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/distortiongt_samples.h
  10. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/epiano_samples.cpp
  11. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/epiano_samples.h
  12. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/flute_samples.cpp
  13. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/flute_samples.h
  14. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/frenchhorn_samples.cpp
  15. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/frenchhorn_samples.h
  16. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/glockenspiel_samples.cpp
  17. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/glockenspiel_samples.h
  18. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/gtfretnoise_samples.cpp
  19. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/gtfretnoise_samples.h
  20. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/harmonica_samples.cpp
  21. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/harmonica_samples.h
  22. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/harp_samples.cpp
  23. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/harp_samples.h
  24. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/mutedgtr_samples.cpp
  25. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/mutedgtr_samples.h
  26. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/nylonstrgtr_samples.cpp
  27. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/nylonstrgtr_samples.h
  28. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/oboe_samples.cpp
  29. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/oboe_samples.h
  30. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/overdrivegt_samples.cpp
  31. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/overdrivegt_samples.h
  32. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/piano_samples.cpp
  33. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/piano_samples.h
  34. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/recorder_samples.cpp
  35. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/recorder_samples.h
  36. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/standard_DRUMS_samples.cpp
  37. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/standard_DRUMS_samples.h
  38. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/steelstrgtr_samples.cpp
  39. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/steelstrgtr_samples.h
  40. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/strings_samples.cpp
  41. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/strings_samples.h
  42. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/timpani_samples.cpp
  43. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/timpani_samples.h
  44. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/trombone_samples.cpp
  45. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/trombone_samples.h
  46. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/trumpet_samples.cpp
  47. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/trumpet_samples.h
  48. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/tuba_samples.cpp
  49. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/tuba_samples.h
  50. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/vibraphone_samples.cpp
  51. +0
    -0
      examples/Synthesis/Wavetable/MidiSynthLarge/vibraphone_samples.h
  52. +14
    -0
      examples/Synthesis/Wavetable/SimpleWavetable/SimpleWavetable.ino
  53. +6
    -0
      examples/Synthesis/Wavetable/ZeldaSynth/ZeldaSynth.ino
  54. +2
    -1
      synth_wavetable.h

+ 10
- 0
examples/Synthesis/Wavetable/MidiSynth/MidiSynth.ino Datei anzeigen

@@ -1,3 +1,13 @@
/* Play notes when your computer sends USB MIDI messages.

To use this example, you must run software on your computer which
sends MIDI. Tools > USB Type must be set to MIDI when uploading.

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

// TODO: smaller samples, to fit in Teensy 3.2 memory
#include "Pizzicato_samples.h"
#include "FrenchHorns_samples.h"
#include "Viola_samples.h"

+ 11
- 0
examples/Synthesis/Wavetable/MidiSynthKeyboard/MidiSynthKeyboard.ino Datei anzeigen

@@ -1,3 +1,14 @@
/* Play notes with a regular USB MIDI Instrument.

To use this example, connect a USB instrument to Teensy 3.6's
USB host port. This cable is recommended:
https://www.pjrc.com/store/cable_usb_host_t36.html

Requires Teensy 3.6 for USB host capability.
Requires Audio Shield: https://www.pjrc.com/store/teensy3_audio.html
*/


#include "Pizzicato_samples.h"
#include "FrenchHorns_samples.h"
#include "Viola_samples.h"

examples/Synthesis/Wavetable/GeneralMidiSynth/GeneralMidiSynth.ino → examples/Synthesis/Wavetable/MidiSynthLarge/MidiSynthLarge.ino Datei anzeigen

@@ -1,3 +1,12 @@
/* Play notes when your computer sends USB MIDI messages.

To use this example, you must run software on your computer which
sends MIDI. Tools > USB Type must be set to MIDI when uploading.

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

#include "bassoon_samples.h"
#include "clarinet_samples.h"
#include "distortiongt_samples.h"

examples/Synthesis/Wavetable/GeneralMidiSynth/bassoon_samples.cpp → examples/Synthesis/Wavetable/MidiSynthLarge/bassoon_samples.cpp Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/bassoon_samples.h → examples/Synthesis/Wavetable/MidiSynthLarge/bassoon_samples.h Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/clarinet_samples.cpp → examples/Synthesis/Wavetable/MidiSynthLarge/clarinet_samples.cpp Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/clarinet_samples.h → examples/Synthesis/Wavetable/MidiSynthLarge/clarinet_samples.h Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/distortiongt_samples.cpp → examples/Synthesis/Wavetable/MidiSynthLarge/distortiongt_samples.cpp Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/distortiongt_samples.h → examples/Synthesis/Wavetable/MidiSynthLarge/distortiongt_samples.h Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/epiano_samples.cpp → examples/Synthesis/Wavetable/MidiSynthLarge/epiano_samples.cpp Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/epiano_samples.h → examples/Synthesis/Wavetable/MidiSynthLarge/epiano_samples.h Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/flute_samples.cpp → examples/Synthesis/Wavetable/MidiSynthLarge/flute_samples.cpp Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/flute_samples.h → examples/Synthesis/Wavetable/MidiSynthLarge/flute_samples.h Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/frenchhorn_samples.cpp → examples/Synthesis/Wavetable/MidiSynthLarge/frenchhorn_samples.cpp Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/frenchhorn_samples.h → examples/Synthesis/Wavetable/MidiSynthLarge/frenchhorn_samples.h Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/glockenspiel_samples.cpp → examples/Synthesis/Wavetable/MidiSynthLarge/glockenspiel_samples.cpp Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/glockenspiel_samples.h → examples/Synthesis/Wavetable/MidiSynthLarge/glockenspiel_samples.h Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/gtfretnoise_samples.cpp → examples/Synthesis/Wavetable/MidiSynthLarge/gtfretnoise_samples.cpp Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/gtfretnoise_samples.h → examples/Synthesis/Wavetable/MidiSynthLarge/gtfretnoise_samples.h Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/harmonica_samples.cpp → examples/Synthesis/Wavetable/MidiSynthLarge/harmonica_samples.cpp Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/harmonica_samples.h → examples/Synthesis/Wavetable/MidiSynthLarge/harmonica_samples.h Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/harp_samples.cpp → examples/Synthesis/Wavetable/MidiSynthLarge/harp_samples.cpp Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/harp_samples.h → examples/Synthesis/Wavetable/MidiSynthLarge/harp_samples.h Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/mutedgtr_samples.cpp → examples/Synthesis/Wavetable/MidiSynthLarge/mutedgtr_samples.cpp Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/mutedgtr_samples.h → examples/Synthesis/Wavetable/MidiSynthLarge/mutedgtr_samples.h Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/nylonstrgtr_samples.cpp → examples/Synthesis/Wavetable/MidiSynthLarge/nylonstrgtr_samples.cpp Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/nylonstrgtr_samples.h → examples/Synthesis/Wavetable/MidiSynthLarge/nylonstrgtr_samples.h Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/oboe_samples.cpp → examples/Synthesis/Wavetable/MidiSynthLarge/oboe_samples.cpp Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/oboe_samples.h → examples/Synthesis/Wavetable/MidiSynthLarge/oboe_samples.h Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/overdrivegt_samples.cpp → examples/Synthesis/Wavetable/MidiSynthLarge/overdrivegt_samples.cpp Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/overdrivegt_samples.h → examples/Synthesis/Wavetable/MidiSynthLarge/overdrivegt_samples.h Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/piano_samples.cpp → examples/Synthesis/Wavetable/MidiSynthLarge/piano_samples.cpp Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/piano_samples.h → examples/Synthesis/Wavetable/MidiSynthLarge/piano_samples.h Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/recorder_samples.cpp → examples/Synthesis/Wavetable/MidiSynthLarge/recorder_samples.cpp Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/recorder_samples.h → examples/Synthesis/Wavetable/MidiSynthLarge/recorder_samples.h Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/standard_DRUMS_samples.cpp → examples/Synthesis/Wavetable/MidiSynthLarge/standard_DRUMS_samples.cpp Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/standard_DRUMS_samples.h → examples/Synthesis/Wavetable/MidiSynthLarge/standard_DRUMS_samples.h Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/steelstrgtr_samples.cpp → examples/Synthesis/Wavetable/MidiSynthLarge/steelstrgtr_samples.cpp Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/steelstrgtr_samples.h → examples/Synthesis/Wavetable/MidiSynthLarge/steelstrgtr_samples.h Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/strings_samples.cpp → examples/Synthesis/Wavetable/MidiSynthLarge/strings_samples.cpp Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/strings_samples.h → examples/Synthesis/Wavetable/MidiSynthLarge/strings_samples.h Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/timpani_samples.cpp → examples/Synthesis/Wavetable/MidiSynthLarge/timpani_samples.cpp Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/timpani_samples.h → examples/Synthesis/Wavetable/MidiSynthLarge/timpani_samples.h Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/trombone_samples.cpp → examples/Synthesis/Wavetable/MidiSynthLarge/trombone_samples.cpp Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/trombone_samples.h → examples/Synthesis/Wavetable/MidiSynthLarge/trombone_samples.h Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/trumpet_samples.cpp → examples/Synthesis/Wavetable/MidiSynthLarge/trumpet_samples.cpp Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/trumpet_samples.h → examples/Synthesis/Wavetable/MidiSynthLarge/trumpet_samples.h Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/tuba_samples.cpp → examples/Synthesis/Wavetable/MidiSynthLarge/tuba_samples.cpp Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/tuba_samples.h → examples/Synthesis/Wavetable/MidiSynthLarge/tuba_samples.h Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/vibraphone_samples.cpp → examples/Synthesis/Wavetable/MidiSynthLarge/vibraphone_samples.cpp Datei anzeigen


examples/Synthesis/Wavetable/GeneralMidiSynth/vibraphone_samples.h → examples/Synthesis/Wavetable/MidiSynthLarge/vibraphone_samples.h Datei anzeigen


+ 14
- 0
examples/Synthesis/Wavetable/SimpleWavetable/SimpleWavetable.ino Datei anzeigen

@@ -1,3 +1,17 @@
/* Play a flute sound when a button is pressed.

Connect a pushbutton to pin 1 and pots to pins A2 & A3.
The audio tutorial kit is the intended hardware:
https://www.pjrc.com/store/audio_tutorial_kit.html

Without pots connected, this program will play a very
strange sound due to rapid random fluctuation of the
pitch and volume!

Requires Teensy 3.2 or higher.
Requires Audio Shield: https://www.pjrc.com/store/teensy3_audio.html
*/

#include <Bounce.h>
#include <Audio.h>
#include <Wire.h>

+ 6
- 0
examples/Synthesis/Wavetable/ZeldaSynth/ZeldaSynth.ino Datei anzeigen

@@ -1,3 +1,9 @@
/* Play Zelda music.

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

#include <Bounce.h>
#include <Audio.h>
#include <Wire.h>

+ 2
- 1
synth_wavetable.h Datei anzeigen

@@ -46,6 +46,7 @@ enum envelopeStateEnum { STATE_IDLE, STATE_DELAY, STATE_ATTACK, STATE_HOLD, STAT
#define NOTE(N) (440.0 * pow(2.0, (N - 69) / 12.0))
#define DECIBEL_SHIFT(dB) (pow(10.0, dB/20.0))

// TODO: move all this stuff into the AudioSynthWavetable class, not global scope
struct sample_data {
// SAMPLE VALUES
const int16_t* sample;
@@ -166,7 +167,7 @@ public:
void playFrequency(float freq, int amp = DEFAULT_AMPLITUDE);
void playNote(int note, int amp = DEFAULT_AMPLITUDE);
bool isPlaying(void) { return env_state != STATE_IDLE; }
void setFrequency(float freq);
void setFrequency(float freq);
virtual void update(void);
envelopeStateEnum getEnvState(void) { return env_state; }

Laden…
Abbrechen
Speichern