New library versions in third-party.

pull/111/head
Holger Wirtz 3 years ago
parent 82d67515fa
commit 433304ba7b
  1. 29
      MicroDexed.ino
  2. 3
      doc/case.txt
  3. 5
      third-party/ArduinoJson/CHANGELOG.md
  4. 2
      third-party/ArduinoJson/CMakeLists.txt
  5. 11
      third-party/ArduinoJson/README.md
  6. 2
      third-party/ArduinoJson/appveyor.yml
  7. 8
      third-party/ArduinoJson/extras/tests/Cpp11/nullptr.cpp
  8. 94
      third-party/ArduinoJson/extras/tests/JsonArray/remove.cpp
  9. 11
      third-party/ArduinoJson/extras/tests/JsonObject/remove.cpp
  10. 22
      third-party/ArduinoJson/extras/tests/JsonVariant/add.cpp
  11. 36
      third-party/ArduinoJson/extras/tests/JsonVariant/compare.cpp
  12. 9
      third-party/ArduinoJson/extras/tests/JsonVariant/copy.cpp
  13. 9
      third-party/ArduinoJson/extras/tests/JsonVariant/subscript.cpp
  14. 6
      third-party/ArduinoJson/extras/tests/Misc/StringWriter.cpp
  15. 2
      third-party/ArduinoJson/library.json
  16. 2
      third-party/ArduinoJson/library.properties
  17. 1
      third-party/ArduinoJson/src/ArduinoJson/Configuration.hpp
  18. 1
      third-party/ArduinoJson/src/ArduinoJson/Variant/VariantContent.hpp
  19. 4
      third-party/ArduinoJson/src/ArduinoJson/version.hpp
  20. 4
      third-party/Synth_Dexed/README.md
  21. 65
      third-party/Synth_Dexed/examples/Banks/Banks.ino
  22. 5788
      third-party/Synth_Dexed/examples/Banks/banks.h
  23. 69
      third-party/Synth_Dexed/examples/SimplePlay/SimplePlay.ino
  24. 36
      third-party/Synth_Dexed/src/synth_dexed.cpp
  25. 8
      third-party/Synth_Dexed/src/synth_dexed.h
  26. 151
      third-party/Synth_Dexed/tools/sysex2c.py
  27. 1
      third-party/TeensyVariablePlayback/README.md
  28. 2
      third-party/TeensyVariablePlayback/library.json
  29. 2
      third-party/TeensyVariablePlayback/library.properties
  30. 11
      third-party/TeensyVariablePlayback/src/ResamplingSdReader.h
  31. 6
      third-party/TeensyVariablePlayback/src/playsdresmp.cpp

@ -536,8 +536,6 @@ void setup()
#endif #endif
#endif #endif
initial_values_from_eeprom(false);
// start SD card // start SD card
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
change_disp_sd(false); change_disp_sd(false);
@ -564,6 +562,8 @@ void setup()
} }
} }
initial_values_from_eeprom(false);
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
change_disp_sd(true); change_disp_sd(true);
#endif #endif
@ -1906,13 +1906,26 @@ void initial_values_from_eeprom(bool init)
check_configuration(); check_configuration();
} }
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) #ifdef DEBUG
{ Serial.print(F("Loading performance "));
Serial.print(configuration.sys.performance_number, DEC);
Serial.print(F(": "));
if (load_sd_seq_json(configuration.sys.performance_number) == true)
Serial.println(F("OK"));
else
Serial.println(F("ERROR"));
#else
load_sd_seq_json(configuration.sys.performance_number);
#endif
/* for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{
set_voiceconfig_params(instance_id); set_voiceconfig_params(instance_id);
} }
set_fx_params(); set_fx_params();
set_sys_params(); set_sys_params();
set_volume(configuration.sys.vol, configuration.sys.mono); set_volume(configuration.sys.vol, configuration.sys.mono); */
#ifdef DEBUG #ifdef DEBUG
show_configuration(); show_configuration();

@ -0,0 +1,3 @@
Hammond 1455Q1602BK
https://www.conrad.de/de/p/hammond-electronics-1455q1602bk-1455q1602bk-profil-gehaeuse-163-x-120-5-x-51-5-aluminium-schwarz-1-st-443133.html?searchType=SearchRedirect

@ -1,6 +1,11 @@
ArduinoJson: change log ArduinoJson: change log
======================= =======================
v6.18.5 (2021-09-28)
-------
* Set `ARDUINOJSON_EMBEDDED_MODE` to `1` on Nios II (issue #1657)
v6.18.4 (2021-09-06) v6.18.4 (2021-09-06)
------- -------

@ -11,7 +11,7 @@ if(ESP_PLATFORM)
return() return()
endif() endif()
project(ArduinoJson VERSION 6.18.4) project(ArduinoJson VERSION 6.18.5)
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
include(CTest) include(CTest)

@ -2,12 +2,17 @@
--- ---
[![arduino-library-badge](https://www.ardu-badge.com/badge/ArduinoJson.svg?version=6.18.4)](https://www.ardu-badge.com/ArduinoJson/6.18.4) [![GitHub Workflow Status](https://img.shields.io/github/workflow/status/bblanchon/ArduinoJson/Continuous%20Integration?logo=github)](https://github.com/bblanchon/ArduinoJson/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A6.x)
[![Continuous Integration](https://github.com/bblanchon/ArduinoJson/workflows/Continuous%20Integration/badge.svg?branch=6.x)](https://github.com/bblanchon/ArduinoJson/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A6.x)
[![Continuous Integration](https://ci.appveyor.com/api/projects/status/m7s53wav1l0abssg/branch/6.x?svg=true)](https://ci.appveyor.com/project/bblanchon/arduinojson/branch/6.x) [![Continuous Integration](https://ci.appveyor.com/api/projects/status/m7s53wav1l0abssg/branch/6.x?svg=true)](https://ci.appveyor.com/project/bblanchon/arduinojson/branch/6.x)
[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/arduinojson.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:arduinojson) [![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/arduinojson.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:arduinojson)
[![Coverage Status](https://coveralls.io/repos/github/bblanchon/ArduinoJson/badge.svg?branch=6.x)](https://coveralls.io/github/bblanchon/ArduinoJson?branch=6.x) [![Coverage Status](https://coveralls.io/repos/github/bblanchon/ArduinoJson/badge.svg?branch=6.x)](https://coveralls.io/github/bblanchon/ArduinoJson?branch=6.x)
[![GitHub stars](https://img.shields.io/github/stars/bblanchon/ArduinoJson?style=flat)](https://github.com/bblanchon/ArduinoJson/stargazers)
[![Discord](https://img.shields.io/discord/844900310409150494.svg?logo=discord&logoColor=white&color=007ec6)](https://discord.gg/DzN6hHHD4h)
[![GitHub stars](https://img.shields.io/github/stars/bblanchon/ArduinoJson?style=flat&logo=github)](https://github.com/bblanchon/ArduinoJson/stargazers)
[![GitHub Sponsors](https://img.shields.io/github/sponsors/bblanchon?logo=github)](https://github.com/sponsors/bblanchon)
[![arduino-library-badge](https://www.ardu-badge.com/badge/ArduinoJson.svg?version=6.18.5)](https://www.ardu-badge.com/ArduinoJson/6.18.5)
ArduinoJson is a C++ JSON library for Arduino and IoT (Internet Of Things). ArduinoJson is a C++ JSON library for Arduino and IoT (Internet Of Things).

@ -1,4 +1,4 @@
version: 6.18.4.{build} version: 6.18.5.{build}
environment: environment:
matrix: matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019

@ -29,6 +29,14 @@ TEST_CASE("nullptr") {
REQUIRE(variant.isNull()); REQUIRE(variant.isNull());
} }
SECTION("JsonVariant.set(nullptr) with unbound reference") {
JsonVariant unboundReference;
unboundReference.set(nullptr);
REQUIRE(variant.isNull());
}
SECTION("JsonVariant.is<nullptr_t>()") { SECTION("JsonVariant.is<nullptr_t>()") {
variant.set(42); variant.set(42);
REQUIRE(variant.is<std::nullptr_t>() == false); REQUIRE(variant.is<std::nullptr_t>() == false);

@ -7,73 +7,83 @@
TEST_CASE("JsonArray::remove()") { TEST_CASE("JsonArray::remove()") {
DynamicJsonDocument doc(4096); DynamicJsonDocument doc(4096);
JsonArray _array = doc.to<JsonArray>(); JsonArray array = doc.to<JsonArray>();
_array.add(1); array.add(1);
_array.add(2); array.add(2);
_array.add(3); array.add(3);
SECTION("RemoveFirstByIndex") { SECTION("remove first by index") {
_array.remove(0); array.remove(0);
REQUIRE(2 == _array.size()); REQUIRE(2 == array.size());
REQUIRE(_array[0] == 2); REQUIRE(array[0] == 2);
REQUIRE(_array[1] == 3); REQUIRE(array[1] == 3);
} }
SECTION("RemoveMiddleByIndex") { SECTION("remove middle by index") {
_array.remove(1); array.remove(1);
REQUIRE(2 == _array.size()); REQUIRE(2 == array.size());
REQUIRE(_array[0] == 1); REQUIRE(array[0] == 1);
REQUIRE(_array[1] == 3); REQUIRE(array[1] == 3);
} }
SECTION("RemoveLastByIndex") { SECTION("remove last by index") {
_array.remove(2); array.remove(2);
REQUIRE(2 == _array.size()); REQUIRE(2 == array.size());
REQUIRE(_array[0] == 1); REQUIRE(array[0] == 1);
REQUIRE(_array[1] == 2); REQUIRE(array[1] == 2);
} }
SECTION("RemoveFirstByIterator") { SECTION("remove first by iterator") {
JsonArray::iterator it = _array.begin(); JsonArray::iterator it = array.begin();
_array.remove(it); array.remove(it);
REQUIRE(2 == _array.size()); REQUIRE(2 == array.size());
REQUIRE(_array[0] == 2); REQUIRE(array[0] == 2);
REQUIRE(_array[1] == 3); REQUIRE(array[1] == 3);
} }
SECTION("RemoveMiddleByIterator") { SECTION("remove middle by iterator") {
JsonArray::iterator it = _array.begin(); JsonArray::iterator it = array.begin();
++it; ++it;
_array.remove(it); array.remove(it);
REQUIRE(2 == _array.size()); REQUIRE(2 == array.size());
REQUIRE(_array[0] == 1); REQUIRE(array[0] == 1);
REQUIRE(_array[1] == 3); REQUIRE(array[1] == 3);
} }
SECTION("RemoveLastByIterator") { SECTION("remove last bty iterator") {
JsonArray::iterator it = _array.begin(); JsonArray::iterator it = array.begin();
++it; ++it;
++it; ++it;
_array.remove(it); array.remove(it);
REQUIRE(2 == _array.size()); REQUIRE(2 == array.size());
REQUIRE(_array[0] == 1); REQUIRE(array[0] == 1);
REQUIRE(_array[1] == 2); REQUIRE(array[1] == 2);
} }
SECTION("In a loop") { SECTION("In a loop") {
for (JsonArray::iterator it = _array.begin(); it != _array.end(); ++it) { for (JsonArray::iterator it = array.begin(); it != array.end(); ++it) {
if (*it == 2) if (*it == 2)
_array.remove(it); array.remove(it);
} }
REQUIRE(2 == _array.size()); REQUIRE(2 == array.size());
REQUIRE(_array[0] == 1); REQUIRE(array[0] == 1);
REQUIRE(_array[1] == 3); REQUIRE(array[1] == 3);
}
SECTION("remove by index on unbound reference") {
JsonArray unboundArray;
unboundArray.remove(20);
}
SECTION("remove by iterator on unbound reference") {
JsonArray unboundArray;
unboundArray.remove(unboundArray.begin());
} }
} }

@ -70,8 +70,13 @@ TEST_CASE("JsonObject::remove()") {
} }
#endif #endif
SECTION("should work on null object") { SECTION("remove by key on unbound reference") {
JsonObject null; JsonObject unboundObject;
null.remove("key"); unboundObject.remove("key");
}
SECTION("remove by iterator on unbound reference") {
JsonObject unboundObject;
unboundObject.remove(unboundObject.begin());
} }
} }

@ -10,21 +10,37 @@ TEST_CASE("JsonVariant::add()") {
DynamicJsonDocument doc(4096); DynamicJsonDocument doc(4096);
JsonVariant var = doc.to<JsonVariant>(); JsonVariant var = doc.to<JsonVariant>();
SECTION("integer") { SECTION("add integer to new variant") {
var.add(42); var.add(42);
REQUIRE(var.as<std::string>() == "[42]"); REQUIRE(var.as<std::string>() == "[42]");
} }
SECTION("const char*") { SECTION("add const char* to new variant") {
var.add("hello"); var.add("hello");
REQUIRE(var.as<std::string>() == "[\"hello\"]"); REQUIRE(var.as<std::string>() == "[\"hello\"]");
} }
SECTION("std::string") { SECTION("add std::string to new variant") {
var.add(std::string("hello")); var.add(std::string("hello"));
REQUIRE(var.as<std::string>() == "[\"hello\"]"); REQUIRE(var.as<std::string>() == "[\"hello\"]");
} }
SECTION("add integer to integer") {
var.set(123);
var.add(456); // no-op
REQUIRE(var.as<std::string>() == "123");
}
SECTION("add integer to object") {
var["val"] = 123;
var.add(456); // no-op
REQUIRE(var.as<std::string>() == "{\"val\":123}");
}
} }

@ -158,6 +158,18 @@ TEST_CASE("Compare JsonVariant with JsonVariant") {
CHECK_FALSE(a > b); CHECK_FALSE(a > b);
} }
SECTION("42 vs 42U") {
a.set(42);
b.set(42U);
CHECK(a == b);
CHECK(a <= b);
CHECK(a >= b);
CHECK_FALSE(a != b);
CHECK_FALSE(a < b);
CHECK_FALSE(a > b);
}
SECTION("42 vs 42.0") { SECTION("42 vs 42.0") {
a.set(42); a.set(42);
b.set(42.0); b.set(42.0);
@ -230,6 +242,30 @@ TEST_CASE("Compare JsonVariant with JsonVariant") {
CHECK_FALSE(a == b); CHECK_FALSE(a == b);
} }
SECTION("42U vs 42U") {
a.set(42U);
b.set(42U);
CHECK(a == b);
CHECK(a <= b);
CHECK(a >= b);
CHECK_FALSE(a != b);
CHECK_FALSE(a < b);
CHECK_FALSE(a > b);
}
SECTION("42U vs 42") {
a.set(42U);
b.set(42);
CHECK(a == b);
CHECK(a <= b);
CHECK(a >= b);
CHECK_FALSE(a != b);
CHECK_FALSE(a < b);
CHECK_FALSE(a > b);
}
SECTION("[1] vs [1]") { SECTION("[1] vs [1]") {
a.add(1); a.add(1);
b.add(1); b.add(1);

@ -83,4 +83,13 @@ TEST_CASE("JsonVariant::set(JsonVariant)") {
REQUIRE(doc1.memoryUsage() == JSON_STRING_SIZE(7)); REQUIRE(doc1.memoryUsage() == JSON_STRING_SIZE(7));
REQUIRE(doc2.memoryUsage() == JSON_STRING_SIZE(7)); REQUIRE(doc2.memoryUsage() == JSON_STRING_SIZE(7));
} }
SECTION("destination is unbound") {
JsonVariant unboundVariant;
unboundVariant.set(var1);
REQUIRE(unboundVariant.isUndefined());
REQUIRE(unboundVariant.isNull());
}
} }

@ -58,6 +58,15 @@ TEST_CASE("JsonVariant::operator[]") {
REQUIRE(1 == var[0].size()); REQUIRE(1 == var[0].size());
REQUIRE(std::string("world") == var[0]["hello"]); REQUIRE(std::string("world") == var[0]["hello"]);
} }
SECTION("variant[0] when variant contains an integer") {
var.set(123);
var[0] = 345; // no-op
REQUIRE(var.is<int>());
REQUIRE(var.as<int>() == 123);
}
} }
SECTION("The JsonVariant is a JsonObject") { SECTION("The JsonVariant is a JsonObject") {

@ -15,6 +15,11 @@ static size_t print(StringWriter& writer, const char* s) {
return writer.write(reinterpret_cast<const uint8_t*>(s), strlen(s)); return writer.write(reinterpret_cast<const uint8_t*>(s), strlen(s));
} }
template <typename StringWriter>
static size_t print(StringWriter& writer, char c) {
return writer.write(static_cast<uint8_t>(c));
}
template <typename StringWriter, typename String> template <typename StringWriter, typename String>
void common_tests(StringWriter& writer, const String& output) { void common_tests(StringWriter& writer, const String& output) {
SECTION("InitialState") { SECTION("InitialState") {
@ -47,6 +52,7 @@ TEST_CASE("StaticStringWriter") {
SECTION("OverCapacity") { SECTION("OverCapacity") {
REQUIRE(20 == print(writer, "ABCDEFGHIJKLMNOPQRSTUVWXYZ")); REQUIRE(20 == print(writer, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
REQUIRE(0 == print(writer, "ABC")); REQUIRE(0 == print(writer, "ABC"));
REQUIRE(0 == print(writer, 'D'));
REQUIRE("ABCDEFGHIJKLMNOPQRST" == std::string(output, 20)); REQUIRE("ABCDEFGHIJKLMNOPQRST" == std::string(output, 20));
} }
} }

@ -7,7 +7,7 @@
"type": "git", "type": "git",
"url": "https://github.com/bblanchon/ArduinoJson.git" "url": "https://github.com/bblanchon/ArduinoJson.git"
}, },
"version": "6.18.4", "version": "6.18.5",
"authors": { "authors": {
"name": "Benoit Blanchon", "name": "Benoit Blanchon",
"url": "https://blog.benoitblanchon.fr" "url": "https://blog.benoitblanchon.fr"

@ -1,5 +1,5 @@
name=ArduinoJson name=ArduinoJson
version=6.18.4 version=6.18.5
author=Benoit Blanchon <blog.benoitblanchon.fr> author=Benoit Blanchon <blog.benoitblanchon.fr>
maintainer=Benoit Blanchon <blog.benoitblanchon.fr> maintainer=Benoit Blanchon <blog.benoitblanchon.fr>
sentence=A simple and efficient JSON library for embedded C++. sentence=A simple and efficient JSON library for embedded C++.

@ -32,6 +32,7 @@
|| defined(__IAR_SYSTEMS_ICC__) /* IAR Embedded Workbench */ \ || defined(__IAR_SYSTEMS_ICC__) /* IAR Embedded Workbench */ \
|| defined(__XC) /* MPLAB XC compiler */ \ || defined(__XC) /* MPLAB XC compiler */ \
|| defined(__ARMCC_VERSION) /* Keil ARM Compiler */ \ || defined(__ARMCC_VERSION) /* Keil ARM Compiler */ \
|| defined(__NIOS2__) /* Altera Nios II EDS */ \
|| defined(__AVR) /* Atmel AVR8/GNU C Compiler */ || defined(__AVR) /* Atmel AVR8/GNU C Compiler */
# define ARDUINOJSON_EMBEDDED_MODE 1 # define ARDUINOJSON_EMBEDDED_MODE 1
# else # else

@ -12,7 +12,6 @@
namespace ARDUINOJSON_NAMESPACE { namespace ARDUINOJSON_NAMESPACE {
//
enum { enum {
VALUE_MASK = 0x7F, VALUE_MASK = 0x7F,

@ -4,7 +4,7 @@
#pragma once #pragma once
#define ARDUINOJSON_VERSION "6.18.4" #define ARDUINOJSON_VERSION "6.18.5"
#define ARDUINOJSON_VERSION_MAJOR 6 #define ARDUINOJSON_VERSION_MAJOR 6
#define ARDUINOJSON_VERSION_MINOR 18 #define ARDUINOJSON_VERSION_MINOR 18
#define ARDUINOJSON_VERSION_REVISION 4 #define ARDUINOJSON_VERSION_REVISION 5

@ -36,7 +36,7 @@ See example sketch.
void setMaxNotes(uint8_t n); void setMaxNotes(uint8_t n);
uint8_t getMaxNotes(void); uint8_t getMaxNotes(void);
void doRefreshVoice(void); void doRefreshVoice(void);
bool decodeVoice(uint8_t* encoded_data, uint8_t* data); bool decodeVoice(uint8_t* data, uint8_t* encoded_data);
bool encodeVoice(uint8_t* encoded_data); bool encodeVoice(uint8_t* encoded_data);
bool getVoiceData(uint8_t* data_copy); bool getVoiceData(uint8_t* data_copy);
void setVoiceDataElement(uint8_t address, uint8_t value); void setVoiceDataElement(uint8_t address, uint8_t value);
@ -169,4 +169,4 @@ See example sketch.
void setTranspose(uint8_t transpose); void setTranspose(uint8_t transpose);
uint8_t getTranspose(void); uint8_t getTranspose(void);
void setName(char* name); void setName(char* name);
void getName(char* buffer); void getName(char* buffer);

@ -0,0 +1,65 @@
#include <Audio.h>
#include "synth_dexed.h"
#include "banks.h"
AudioSynthDexed dexed(4, SAMPLE_RATE); // 4 voices max
AudioOutputI2S i2s1;
AudioControlSGTL5000 sgtl5000_1;
AudioConnection patchCord1(dexed, 0, i2s1, 0);
AudioConnection patchCord2(dexed, 0, i2s1, 1);
void setup()
{
Serial.begin(230400);
AudioMemory(32);
sgtl5000_1.enable();
sgtl5000_1.lineOutLevel(29);
sgtl5000_1.dacVolumeRamp();
sgtl5000_1.dacVolume(1.0);
sgtl5000_1.unmuteHeadphone();
sgtl5000_1.unmuteLineout();
sgtl5000_1.volume(0.8, 0.8); // Headphone volume
randomSeed(analogRead(0));
}
void loop()
{
uint8_t b = random(0, 10);
uint8_t v = random(0, 32);
uint8_t t = random(0, 36);
char voice_name[11];
uint8_t decoded_voice[156];
memset(voice_name, 0, 11);
memcpy(voice_name, &progmem_bank[b][v][117], 10);
Serial.print("Voice: ");
Serial.print(voice_name);
Serial.print(" ");
Serial.print("Transpose: ");
Serial.println(t);
dexed.decodeVoice(progmem_bank[b][v],decoded_voice);
dexed.loadVoiceParameters(decoded_voice);
dexed.setTranspose(t);
Serial.println("Key-Down");
dexed.keydown(48, 100);
delay(100);
dexed.keydown(52, 100);
delay(100);
dexed.keydown(55, 100);
delay(100);
dexed.keydown(60, 100);
delay(2000);
Serial.println("Key-Up");
dexed.keyup(48);
dexed.keyup(52);
dexed.keyup(55);
dexed.keyup(60);
delay(1000);
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,69 @@
#include <Audio.h>
#include "synth_dexed.h"
uint8_t fmpiano_sysex[156] = {
95, 29, 20, 50, 99, 95, 00, 00, 41, 00, 19, 00, 00, 03, 00, 06, 79, 00, 01, 00, 14, // OP6 eg_rate_1-4, level_1-4, kbd_lev_scl_brk_pt, kbd_lev_scl_lft_depth, kbd_lev_scl_rht_depth, kbd_lev_scl_lft_curve, kbd_lev_scl_rht_curve, kbd_rate_scaling, amp_mod_sensitivity, key_vel_sensitivity, operator_output_level, osc_mode, osc_freq_coarse, osc_freq_fine, osc_detune
95, 20, 20, 50, 99, 95, 00, 00, 00, 00, 00, 00, 00, 03, 00, 00, 99, 00, 01, 00, 00, // OP5
95, 29, 20, 50, 99, 95, 00, 00, 00, 00, 00, 00, 00, 03, 00, 06, 89, 00, 01, 00, 07, // OP4
95, 20, 20, 50, 99, 95, 00, 00, 00, 00, 00, 00, 00, 03, 00, 02, 99, 00, 01, 00, 07, // OP3
95, 50, 35, 78, 99, 75, 00, 00, 00, 00, 00, 00, 00, 03, 00, 07, 58, 00, 14, 00, 07, // OP2
96, 25, 25, 67, 99, 75, 00, 00, 00, 00, 00, 00, 00, 03, 00, 02, 99, 00, 01, 00, 10, // OP1
94, 67, 95, 60, 50, 50, 50, 50, // 4 * pitch EG rates, 4 * pitch EG level
04, 06, 00, // algorithm, feedback, osc sync
34, 33, 00, 00, 00, 04, // lfo speed, lfo delay, lfo pitch_mod_depth, lfo_amp_mod_depth, lfo_sync, lfo_waveform
03, 24, // pitch_mod_sensitivity, transpose
70, 77, 45, 80, 73, 65, 78, 79, 00, 00 // 10 * char for name ("DEFAULT ")
}; // FM-Piano
AudioSynthDexed dexed(4,SAMPLE_RATE); // 4 voices max
AudioOutputI2S i2s1;
AudioControlSGTL5000 sgtl5000_1;
AudioConnection patchCord1(dexed, 0, i2s1, 0);
AudioConnection patchCord2(dexed, 0, i2s1, 1);
void setup()
{
AudioMemory(32);
sgtl5000_1.enable();
sgtl5000_1.lineOutLevel(29);
sgtl5000_1.dacVolumeRamp();
sgtl5000_1.dacVolume(1.0);
sgtl5000_1.unmuteHeadphone();
sgtl5000_1.unmuteLineout();
sgtl5000_1.volume(0.8, 0.8); // Headphone volume
}
void loop()
{
static uint8_t count;
if (count % 2 == 0)
{
dexed.loadInitVoice();
}
else
{
dexed.loadVoiceParameters(fmpiano_sysex);
dexed.setTranspose(36);
}
Serial.println("Key-Down");
dexed.keydown(48, 100);
delay(100);
dexed.keydown(52, 100);
delay(100);
dexed.keydown(55, 100);
delay(100);
dexed.keydown(60, 100);
delay(2000);
Serial.println("Key-Up");
dexed.keyup(48);
dexed.keyup(52);
dexed.keyup(55);
dexed.keyup(60);
delay(2000);
count++;
}

@ -338,6 +338,7 @@ void Dexed::setMaxNotes(uint8_t new_max_notes)
Serial.print("Allocating memory for "); Serial.print("Allocating memory for ");
Serial.print(max_notes,DEC); Serial.print(max_notes,DEC);
Serial.println(" notes."); Serial.println(" notes.");
Serial.println();
#endif #endif
if(voices) if(voices)
@ -355,10 +356,10 @@ void Dexed::setMaxNotes(uint8_t new_max_notes)
if(max_notes>0) if(max_notes>0)
{ {
voices=new ProcessorVoice[max_notes]; voices=new ProcessorVoice[max_notes]; // sizeof(ProcessorVoice) = 20
for (i = 0; i < max_notes; i++) for (i = 0; i < max_notes; i++)
{ {
voices[i].dx7_note = new Dx7Note; voices[i].dx7_note = new Dx7Note; // sizeof(Dx7Note) = 692
voices[i].keydown = false; voices[i].keydown = false;
voices[i].sustained = false; voices[i].sustained = false;
voices[i].live = false; voices[i].live = false;
@ -385,8 +386,10 @@ void Dexed::getSamples(uint16_t n_samples, int16_t* buffer)
uint16_t i, j; uint16_t i, j;
uint8_t note; uint8_t note;
float sumbuf[n_samples]; float sumbuf[n_samples];
#ifdef USE_SIMPLE_COMPRESSOR
float s; float s;
const double decayFactor = 0.99992; const double decayFactor = 0.99992;
#endif
if (refreshVoice) if (refreshVoice)
{ {
@ -439,6 +442,7 @@ void Dexed::getSamples(uint16_t n_samples, int16_t* buffer)
fx.process(sumbuf, n_samples); // Needed for fx.Gain()!!! fx.process(sumbuf, n_samples); // Needed for fx.Gain()!!!
#ifdef USE_SIMPLE_COMPRESSOR
// mild compression // mild compression
for (i = 0; i < n_samples; i++) for (i = 0; i < n_samples; i++)
{ {
@ -451,6 +455,7 @@ void Dexed::getSamples(uint16_t n_samples, int16_t* buffer)
else else
vuSignal = 0.0; vuSignal = 0.0;
} }
#endif
//arm_scale_f32(sumbuf, 0.00015, sumbuf, AUDIO_BLOCK_SAMPLES); //arm_scale_f32(sumbuf, 0.00015, sumbuf, AUDIO_BLOCK_SAMPLES);
arm_float_to_q15(sumbuf, buffer, AUDIO_BLOCK_SAMPLES); arm_float_to_q15(sumbuf, buffer, AUDIO_BLOCK_SAMPLES);
@ -1886,7 +1891,8 @@ int32_t logfreq_round2semi(int freq) {
return freq - rem; return freq - rem;
} }
const int32_t coarsemul[] = { //const int32_t coarsemul[] = {
int32_t PROGMEM coarsemul[] = {
-16777216, 0, 16777216, 26591258, 33554432, 38955489, 43368474, 47099600, -16777216, 0, 16777216, 26591258, 33554432, 38955489, 43368474, 47099600,
50331648, 53182516, 55732705, 58039632, 60145690, 62083076, 63876816, 50331648, 53182516, 55732705, 58039632, 60145690, 62083076, 63876816,
65546747, 67108864, 68576247, 69959732, 71268397, 72509921, 73690858, 65546747, 67108864, 68576247, 69959732, 71268397, 72509921, 73690858,
@ -1922,7 +1928,8 @@ int32_t osc_freq(int midinote, int mode, int coarse, int fine, int detune) {
return logfreq; return logfreq;
} }
const uint8_t velocity_data[64] = { //const uint8_t velocity_data[64] = {
uint8_t PROGMEM velocity_data[64] = {
0, 70, 86, 97, 106, 114, 121, 126, 132, 138, 142, 148, 152, 156, 160, 163, 0, 70, 86, 97, 106, 114, 121, 126, 132, 138, 142, 148, 152, 156, 160, 163,
166, 170, 173, 174, 178, 181, 184, 186, 189, 190, 194, 196, 198, 200, 202, 166, 170, 173, 174, 178, 181, 184, 186, 189, 190, 194, 196, 198, 200, 202,
205, 206, 209, 211, 214, 216, 218, 220, 222, 224, 225, 227, 229, 230, 232, 205, 206, 209, 211, 214, 216, 218, 220, 222, 224, 225, 227, 229, 230, 232,
@ -1952,7 +1959,8 @@ int ScaleRate(int midinote, int sensitivity) {
return qratedelta; return qratedelta;
} }
const uint8_t exp_scale_data[] = { //const uint8_t exp_scale_data[] = {
uint8_t PROGMEM exp_scale_data[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 14, 16, 19, 23, 27, 33, 39, 47, 56, 66, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 14, 16, 19, 23, 27, 33, 39, 47, 56, 66,
80, 94, 110, 126, 142, 158, 174, 190, 206, 222, 238, 250 80, 94, 110, 126, 142, 158, 174, 190, 206, 222, 238, 250
}; };
@ -1984,12 +1992,14 @@ int ScaleLevel(int midinote, int break_pt, int left_depth, int right_depth,
} }
} }
static const uint8_t pitchmodsenstab[] = { //static const uint8_t pitchmodsenstab[] = {
uint8_t PROGMEM pitchmodsenstab[] = {
0, 10, 20, 33, 55, 92, 153, 255 0, 10, 20, 33, 55, 92, 153, 255
}; };
// 0, 66, 109, 255 // 0, 66, 109, 255
static const uint32_t ampmodsenstab[] = { //static const uint32_t ampmodsenstab[] = {
uint32_t PROGMEM ampmodsenstab[] = {
0, 4342338, 7171437, 16777216 0, 4342338, 7171437, 16777216
}; };
@ -2253,12 +2263,14 @@ void Dx7Note::oscSync() {
uint32_t Env::sr_multiplier = (1 << 24); uint32_t Env::sr_multiplier = (1 << 24);
const int levellut[] = { //const int levellut[] = {
int PROGMEM levellut[] = {
0, 5, 9, 13, 17, 20, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 42, 43, 45, 46 0, 5, 9, 13, 17, 20, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 42, 43, 45, 46
}; };
#ifdef ACCURATE_ENVELOPE #ifdef ACCURATE_ENVELOPE
const int statics[] = { //const int statics[] = {
int PROGMEM statics[] = {
1764000, 1764000, 1411200, 1411200, 1190700, 1014300, 992250, 1764000, 1764000, 1411200, 1411200, 1190700, 1014300, 992250,
882000, 705600, 705600, 584325, 507150, 502740, 441000, 418950, 882000, 705600, 705600, 584325, 507150, 502740, 441000, 418950,
352800, 308700, 286650, 253575, 220500, 220500, 176400, 145530, 352800, 308700, 286650, 253575, 220500, 220500, 176400, 145530,
@ -3050,7 +3062,8 @@ void PitchEnv::init(FRAC_NUM sample_rate) {
unit_ = _N_ * (1 << 24) / (21.3 * sample_rate) + 0.5; unit_ = _N_ * (1 << 24) / (21.3 * sample_rate) + 0.5;
} }
const uint8_t pitchenv_rate[] = { //const uint8_t pitchenv_rate[] = {
uint8_t PROGMEM pitchenv_rate[] = {
1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12,
12, 13, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, 20, 21, 22, 23, 24, 12, 13, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 30, 31, 33, 34, 36, 37, 38, 39, 41, 42, 44, 46, 47, 25, 26, 27, 28, 30, 31, 33, 34, 36, 37, 38, 39, 41, 42, 44, 46, 47,
@ -3059,7 +3072,8 @@ const uint8_t pitchenv_rate[] = {
153, 159, 165, 171, 178, 185, 193, 202, 211, 232, 243, 254, 255 153, 159, 165, 171, 178, 185, 193, 202, 211, 232, 243, 254, 255
}; };
const int8_t pitchenv_tab[] = { //const int8_t pitchenv_tab[] = {
int8_t PROGMEM pitchenv_tab[] = {
-128, -116, -104, -95, -85, -76, -68, -61, -56, -52, -49, -46, -43, -128, -116, -104, -95, -85, -76, -68, -61, -56, -52, -49, -46, -43,
-41, -39, -37, -35, -33, -32, -31, -30, -29, -28, -27, -26, -25, -24, -41, -39, -37, -35, -33, -32, -31, -30, -29, -28, -27, -26, -25, -24,
-23, -22, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, -23, -22, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10,

@ -59,6 +59,8 @@
#define PORTAMENTO_GLISSANDO_DEFAULT 0 #define PORTAMENTO_GLISSANDO_DEFAULT 0
#define PORTAMENTO_TIME_DEFAULT 0 #define PORTAMENTO_TIME_DEFAULT 0
//#define USE_SIMPLE_COMPRESSOR 1
/***************************************************** /*****************************************************
CODE: orig_code/synth.h CODE: orig_code/synth.h
*****************************************************/ *****************************************************/
@ -548,8 +550,10 @@ class PitchEnv {
void advance(int newix); void advance(int newix);
}; };
extern const uint8_t pitchenv_rate[]; //extern const uint8_t pitchenv_rate[];
extern const int8_t pitchenv_tab[]; //extern const int8_t pitchenv_tab[];
extern uint8_t pitchenv_rate[];
extern int8_t pitchenv_tab[];
//===================================================== //=====================================================

@ -0,0 +1,151 @@
#!/usr/bin/python3
import sys
import os.path
# From: https://github.com/bwhitman/learnfm/blob/master/dx7db.py
def unpack_packed_patch(p):
# Input is a 128 byte thing from compact.bin
# Output is a 156 byte thing that the synth knows about
o = [0]*156
for op in range(6):
o[op*21:op*21 + 11] = p[op*17:op*17+11]
leftrightcurves = p[op*17+11]
o[op * 21 + 11] = leftrightcurves & 3
o[op * 21 + 12] = (leftrightcurves >> 2) & 3
detune_rs = p[op * 17 + 12]
o[op * 21 + 13] = detune_rs & 7
o[op * 21 + 20] = detune_rs >> 3
kvs_ams = p[op * 17 + 13]
o[op * 21 + 14] = kvs_ams & 3
o[op * 21 + 15] = kvs_ams >> 2
o[op * 21 + 16] = p[op * 17 + 14]
fcoarse_mode = p[op * 17 + 15]
o[op * 21 + 17] = fcoarse_mode & 1
o[op * 21 + 18] = fcoarse_mode >> 1
o[op * 21 + 19] = p[op * 17 + 16]
o[126:126+9] = p[102:102+9]
oks_fb = p[111]
o[135] = oks_fb & 7
o[136] = oks_fb >> 3
o[137:137+4] = p[112:112+4]
lpms_lfw_lks = p[116]
o[141] = lpms_lfw_lks & 1
o[142] = (lpms_lfw_lks >> 1) & 7
o[143] = lpms_lfw_lks >> 4
o[144:144+11] = p[117:117+11]
o[155] = 0x3f
# Clamp the unpacked patches to a known max.
maxes = [
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, # osc6
3, 3, 7, 3, 7, 99, 1, 31, 99, 14,
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, # osc5
3, 3, 7, 3, 7, 99, 1, 31, 99, 14,
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, # osc4
3, 3, 7, 3, 7, 99, 1, 31, 99, 14,
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, # osc3
3, 3, 7, 3, 7, 99, 1, 31, 99, 14,
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, # osc2
3, 3, 7, 3, 7, 99, 1, 31, 99, 14,
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, # osc1
3, 3, 7, 3, 7, 99, 1, 31, 99, 14,
99, 99, 99, 99, 99, 99, 99, 99, # pitch eg rate & level
31, 7, 1, 99, 99, 99, 99, 1, 5, 7, 48, # algorithm etc
126, 126, 126, 126, 126, 126, 126, 126, 126, 126, # name
127 # operator on/off
]
for i in range(156):
if(o[i] > maxes[i]): o[i] = maxes[i]
if(o[i] < 0): o[i] = 0
return o
def print_header_data(voice_data):
print("\t\t\t",end="")
for y in range(0,len(voice_data)):
if(y!=len(voice_data)-1):
print("%3d, " % voice_data[y],end="")
else:
print("%3d\n" % voice_data[y],end="")
if((y+1)%8==0 and y!=len(voice_data)-1):
print("\n\t\t\t",end="")
def help_message():
print(progname+" [--decode] <sysex1> [<sysex2> ... <sysexn>]")
#---------------------------------------------------------------------------
progname=sys.argv.pop(0)
if(len(sys.argv)==0):
help_message()
exit(1)
if(sys.argv[0]=="-h" or sys.argv[0]=="--help"):
help_message()
exit(1)
if(sys.argv[0]=="--decode"):
decode=True
sys.argv.pop(0)
else:
decode=False
print("""
//
// File generated with sysex2c.py
//
#pragma once
""")
if(decode==True):
print("uint8_t progmem_bank[%d][32][156] PROGMEM =\n{" % int(len(sys.argv)))
else:
print("uint8_t progmem_bank[%d][32][128] PROGMEM =\n{" % int(len(sys.argv)))
for sysex in sys.argv:
if(not os.path.isfile(sysex)):
print("* File "+sysex+" does not exists.")
exit(10)
if(not os.access(sysex,os.R_OK)):
print("* File "+sysex+" does not readable.")
exit(11)
print("\t{\t// %s" % os.path.basename(sysex))
with open(sysex, "rb") as f:
header = f.read(6)
if(header[0]!=240):
print("* %s: Start of sysex not found." % sysex)
exit(200)
if(header[1]!=67):
print("* %s: Manufactorer-ID not Yamaha." % sysex)
exit(201)
if(header[3]!=9):
print("* %s: Not a 32 voice sysex file." % sysex)
exit(202)
byte_count = header[4]*128+header[5]
if(byte_count!=4096):
print("* %s: Byte count mismatch." % sysex)
exit(203)
patch_data=f.read(4096)
check = ~sum(patch_data) + 1 & 0x7F
f.seek(4102) # Bulk checksum
checksum=int.from_bytes(f.read(1),"little")
if(check!=checksum):
print("* %s: Checksum mismatch!" % sysex)
exit(204)
f.seek(6)
for v in range(1,33):
data=f.read(128)
patchname=str(data[118:128].decode('ascii')).upper().replace('\\','')
print("\t\t{\t// %d: %s" % (v, patchname))
if(decode==True):
print_header_data(unpack_packed_patch(data))
else:
print_header_data(data)
if(v!=32):
print("\t\t},")
else:
print("\t\t}")
if(sys.argv[len(sys.argv)-1]==sysex):
print("\t}")
else:
print("\t},")
print("};")

@ -16,6 +16,7 @@ play 16-bit PCM raw or wav audio samples at variable playback rates on teensy
* [sd classes on wikipedia](https://en.wikipedia.org/wiki/SD_card#cite_ref-93) * [sd classes on wikipedia](https://en.wikipedia.org/wiki/SD_card#cite_ref-93)
## updates ## updates
* 25/09/2021: v1.0.13: positionMillis() implemented for AudioPlaySdResmp
* 25/08/2021: v1.0.12: Skip over RIFF tags in .wav header * 25/08/2021: v1.0.12: Skip over RIFF tags in .wav header
* 12/08/2021: v1.0.11: When playing a mono sample, transmit on both channels (credit to @atoktoto) * 12/08/2021: v1.0.11: When playing a mono sample, transmit on both channels (credit to @atoktoto)
* 28/07/2021: v1.0.10: Fix issues when starting playback in reverse * 28/07/2021: v1.0.10: Fix issues when starting playback in reverse

@ -5,7 +5,7 @@
"keywords": "sound, audio, sample, resample, pitch, interpolation, legrange, sampler, playback, speed", "keywords": "sound, audio, sample, resample, pitch, interpolation, legrange, sampler, playback, speed",
"description": "Teensy Variable Playback", "description": "Teensy Variable Playback",
"url": "https://github.com/newdigate/teensy-variable-playback", "url": "https://github.com/newdigate/teensy-variable-playback",
"version": "1.0.12", "version": "1.0.13",
"export": { "export": {
"exclude": [ "exclude": [
".vscode", ".vscode",

@ -1,5 +1,5 @@
name=TeensyVariablePlayback name=TeensyVariablePlayback
version=1.0.12 version=1.0.13
author=Nic Newdigate author=Nic Newdigate
maintainer=Nic Newdigate maintainer=Nic Newdigate
sentence=Play samples at variable pitch using Teensy Audio Library sentence=Play samples at variable pitch using Teensy Audio Library

@ -14,6 +14,8 @@
#define RESAMPLE_BUFFER_SAMPLE_SIZE 128 #define RESAMPLE_BUFFER_SAMPLE_SIZE 128
#define B2M (uint32_t)((double)4294967296000.0 / AUDIO_SAMPLE_RATE_EXACT / 2.0) // 97352592
class ResamplingSdReader { class ResamplingSdReader {
public: public:
ResamplingSdReader() { ResamplingSdReader() {
@ -91,6 +93,15 @@ public:
} }
} }
uint32_t positionMillis(void) {
if (_file_size == 0) return 0;
return (uint32_t) (( (double)_bufferPosition * lengthMillis() ) / (double)(_file_size/2));
}
uint32_t lengthMillis(void) {
return ((uint64_t)_file_size * B2M) >> 32;
}
private: private:
volatile bool _playing = false; volatile bool _playing = false;

@ -72,14 +72,12 @@ void AudioPlaySdResmp::update()
} }
} }
#define B2M (uint32_t)((double)4294967296000.0 / AUDIO_SAMPLE_RATE_EXACT / 2.0) // 97352592
uint32_t AudioPlaySdResmp::positionMillis() uint32_t AudioPlaySdResmp::positionMillis()
{ {
return ((uint64_t)file_size * B2M) >> 32; return sdReader.positionMillis();
} }
uint32_t AudioPlaySdResmp::lengthMillis() uint32_t AudioPlaySdResmp::lengthMillis()
{ {
return ((uint64_t)file_size * B2M) >> 32; return sdReader.lengthMillis();
} }
Loading…
Cancel
Save