diff --git a/Open_Theremin_V3/EEPROM.h b/Open_Theremin_V3/EEPROM.h index 8253670..003fdf9 100644 --- a/Open_Theremin_V3/EEPROM.h +++ b/Open_Theremin_V3/EEPROM.h @@ -40,7 +40,7 @@ struct EERef{ //Access/read members. uint8_t operator*() const { return eeprom_read_byte( (uint8_t*) index ); } - operator const uint8_t() const { return **this; } + operator uint8_t() const { return **this; } //Assignment/write members. EERef &operator=( const EERef &ref ) { return *this = *ref; } @@ -89,7 +89,7 @@ struct EEPtr{ EEPtr( const int index ) : index( index ) {} - operator const int() const { return index; } + operator int() const { return index; } EEPtr &operator=( int in ) { return index = in, *this; } //Iterator functionality. @@ -143,4 +143,4 @@ struct EEPROMClass{ }; static EEPROMClass EEPROM; -#endif +#endif diff --git a/Open_Theremin_V3/application.cpp b/Open_Theremin_V3/application.cpp index c095237..80dc893 100644 --- a/Open_Theremin_V3/application.cpp +++ b/Open_Theremin_V3/application.cpp @@ -159,7 +159,6 @@ AppMode Application::nextMode() { void Application::loop() { int32_t pitch_v = 0, pitch_l = 0; // Last value of pitch (for filtering) int32_t vol_v = 0, vol_l = 0; // Last value of volume (for filtering) - int32_t pitch_f = 0; // pitch in frequency (for filtering) uint16_t volumePotValue = 0; uint16_t pitchPotValue = 0; @@ -231,7 +230,7 @@ void Application::loop() { OCR0A = pitch & 0xff; #endif -#if L_ENABLED +#if SERIAL_ENABLED if (timerExpired(TICKS_100_MILLIS)) { resetTimer(); Serial.write(pitch & 0xff); // Send char on serial (if used) @@ -245,7 +244,6 @@ void Application::loop() { pitch_v=pitch_l+((pitch_v-pitch_l)>>2); pitch_l=pitch_v; - pitch_f=FREQ_FACTOR/pitch_v; //HW_LED2_ON; @@ -517,4 +515,4 @@ void Application::delay_NOP(unsigned long time) { - + diff --git a/Open_Theremin_V3/application.h b/Open_Theremin_V3/application.h index 841b528..92fa963 100644 --- a/Open_Theremin_V3/application.h +++ b/Open_Theremin_V3/application.h @@ -55,8 +55,8 @@ class Application { unsigned long GetQMeasurement(); - static const float HZ_ADDVAL_FACTOR = 2.09785; - static const float MIDDLE_C = 261.6; + const float HZ_ADDVAL_FACTOR = 2.09785; + const float MIDDLE_C = 261.6; void playNote(float hz, uint16_t milliseconds, uint8_t volume); void hzToAddVal(float hz); diff --git a/Open_Theremin_V3/theremin_sintable.c b/Open_Theremin_V3/theremin_sintable.c index 44ea01b..bc44e2e 100644 --- a/Open_Theremin_V3/theremin_sintable.c +++ b/Open_Theremin_V3/theremin_sintable.c @@ -2,7 +2,7 @@ #include -const int16_t sine_table[1024] PROGMEM = {\ +const int16_t sine_table[1024] PROGMEM = {\ 273,\ 288,\ 302,\ @@ -1029,4 +1029,4 @@ const int16_t sine_table[1024] PROGMEM = {\ 259,\ }; - + diff --git a/Open_Theremin_V3/theremin_sintable2.c b/Open_Theremin_V3/theremin_sintable2.c index 42ecf37..20c88f9 100644 --- a/Open_Theremin_V3/theremin_sintable2.c +++ b/Open_Theremin_V3/theremin_sintable2.c @@ -2,7 +2,7 @@ #include -const int16_t sine_table2[1024] PROGMEM = {\ +const int16_t sine_table2[1024] PROGMEM = {\ 0, 2, 3, @@ -1029,4 +1029,4 @@ const int16_t sine_table2[1024] PROGMEM = {\ -3 }; - + diff --git a/Open_Theremin_V3/theremin_sintable3.c b/Open_Theremin_V3/theremin_sintable3.c index e4a243a..dc75c51 100644 --- a/Open_Theremin_V3/theremin_sintable3.c +++ b/Open_Theremin_V3/theremin_sintable3.c @@ -2,7 +2,7 @@ #include -const int16_t sine_table3[1024] PROGMEM = {\ +const int16_t sine_table3[1024] PROGMEM = {\ 9, 13, 15, @@ -1029,4 +1029,4 @@ const int16_t sine_table3[1024] PROGMEM = {\ 286, }; - + diff --git a/Open_Theremin_V3/theremin_sintable4.c b/Open_Theremin_V3/theremin_sintable4.c index 0fe85c8..324b7b2 100644 --- a/Open_Theremin_V3/theremin_sintable4.c +++ b/Open_Theremin_V3/theremin_sintable4.c @@ -2,7 +2,7 @@ #include -const int16_t sine_table4[1024] PROGMEM = {\ +const int16_t sine_table4[1024] PROGMEM = {\ 0, 3, @@ -1030,4 +1030,4 @@ const int16_t sine_table4[1024] PROGMEM = {\ 0 }; - + diff --git a/Open_Theremin_V3/theremin_sintable5.c b/Open_Theremin_V3/theremin_sintable5.c index 35382e8..bbcd6c5 100644 --- a/Open_Theremin_V3/theremin_sintable5.c +++ b/Open_Theremin_V3/theremin_sintable5.c @@ -2,7 +2,7 @@ #include -const int16_t sine_table5[1024] PROGMEM = {\ +const int16_t sine_table5[1024] PROGMEM = {\ 0, 76, 83, @@ -1029,4 +1029,4 @@ const int16_t sine_table5[1024] PROGMEM = {\ 0 }; - + diff --git a/Open_Theremin_V3/theremin_sintable6.c b/Open_Theremin_V3/theremin_sintable6.c index 1208422..3cae173 100644 --- a/Open_Theremin_V3/theremin_sintable6.c +++ b/Open_Theremin_V3/theremin_sintable6.c @@ -2,7 +2,7 @@ #include -const int16_t sine_table6[1024] PROGMEM = {\ +const int16_t sine_table6[1024] PROGMEM = {\ 0, 5, 10, @@ -1029,4 +1029,4 @@ const int16_t sine_table6[1024] PROGMEM = {\ -3 }; - + diff --git a/Open_Theremin_V3/theremin_sintable7.c b/Open_Theremin_V3/theremin_sintable7.c index 4e72e93..583a144 100644 --- a/Open_Theremin_V3/theremin_sintable7.c +++ b/Open_Theremin_V3/theremin_sintable7.c @@ -2,7 +2,7 @@ #include -const int16_t sine_table7[1024] PROGMEM = {\ +const int16_t sine_table7[1024] PROGMEM = {\ 11, 42, 47, @@ -1030,4 +1030,4 @@ const int16_t sine_table7[1024] PROGMEM = {\ }; - + diff --git a/Open_Theremin_V3/theremin_sintable8.c b/Open_Theremin_V3/theremin_sintable8.c index bb65b71..8b6527d 100644 --- a/Open_Theremin_V3/theremin_sintable8.c +++ b/Open_Theremin_V3/theremin_sintable8.c @@ -2,7 +2,7 @@ #include -const int16_t sine_table8[1024] PROGMEM = {\ +const int16_t sine_table8[1024] PROGMEM = {\ 11, 42, 47, @@ -1029,4 +1029,4 @@ const int16_t sine_table8[1024] PROGMEM = {\ 0 }; - + diff --git a/Open_Theremin_V3/timer.h b/Open_Theremin_V3/timer.h index f7dd397..5f05ede 100644 --- a/Open_Theremin_V3/timer.h +++ b/Open_Theremin_V3/timer.h @@ -34,6 +34,8 @@ inline bool timerUnexpiredMillis(uint16_t milliseconds) { void ticktimer (uint16_t ticks); void millitimer (uint16_t milliseconds); +#if SERIAL_ENABLED const uint16_t TICKS_100_MILLIS = millisToTicks(100); +#endif //SERIAL_ENABLED -#endif // _TIMER_H +#endif // _TIMER_H diff --git a/README.md b/README.md index 128f3a7..7914b33 100644 --- a/README.md +++ b/README.md @@ -20,3 +20,9 @@ http://www.gaudi.ch/OpenTheremin/ 3. Selecting the correct usb port on Tools -> Serial Port 4. Select the correct arduino board from Tools -> Board 5. Upload the code by clicking on the upload button. + +### LICENSE +Written by Urs Gaudenz, GaudiLabs, 2016 +GNU license, check LICENSE file for more information +All text above must be included in any redistribution + diff --git a/README.md~ b/README.md~ index 6f5ef6c..128f3a7 100644 --- a/README.md~ +++ b/README.md~ @@ -1,2 +1,22 @@ -# OpenTheremin_V3 -Open Source Theremin Instrument, Arudino Codes +## Open.Theremin V3 control software + +Arduino UNO Software for the Open.Theremin + +### Don't click on the files! +Click on the "Download ZIP" Button to the right or [Click here](https://github.com/GaudiLabs/OpenTheremin_V3/archive/master.zip) +Then unpack the archive. + +### Open Source Theremin based on the Arduino Platform + +Open.Theremin is an arduino shield to build the legendary music instrument invented by Leon Theremin back in 1920. The theremin is played with two antennas, one to control the pitch and one for volume. The electronic shield with two ports to connect those antennas comprises two heterodyne oscillators to measure the distance of the hand to the antenna when playing the instrument. The resulting signal is fed into the arduino. After linearization and filtering the arduino generates the instruments sound that is then played through a high quality digital analog audio converter on the board. The characteristics of the sound can be determined by a wave table on the arduino. + +For more info on the open source project and on availability of ready made shield see: + +http://www.gaudi.ch/OpenTheremin/ + +### Installation +1. Open up the Arduino IDE +2. Open the File "Open_Theremin_V3.ino" +3. Selecting the correct usb port on Tools -> Serial Port +4. Select the correct arduino board from Tools -> Board +5. Upload the code by clicking on the upload button.