marcel-licence / esp32_basic_synth Goto Github PK
View Code? Open in Web Editor NEWESP32 based simple synthesizer project
License: GNU General Public License v3.0
ESP32 based simple synthesizer project
License: GNU General Public License v3.0
Hola, este repsoitorio y los demas son fantasticos, he visto cada uno de tus videos y quiero probar esto, lamentablemente soy novato y no se que sketch o .ino subir, hay varios de estos en cada repositorio y no se cual subir al esp32 para que funcione.
Muchas gracias.
Please tell me which Pin of ESP32 the output from the multiplexer is connected to.
As hinted at in a previous issue (and thank you for that prompt attention), the ADC pots are unfortunately not recognised. Output through the DAC is only a non changing, but nice and mellow organ sound. Enabling the debug output doesn't produce any changes in the serial output, just the initial values are shown.
Equipment is: ESP32 Dev, 4067 16 channel Multiplexer, Max 98357A I2S DAC
The following lines were needed in the ADC section for the esp32_basic_synth to compile -
#define analogSetCycles
#define adcStart
#define adcEnd
#define adcBusy
The multiplexer does work, on the synth circuit, when tested with the code here:
https://gtsdtech.wordpress.com/2018/01/15/esp32-working-with-74hc4067-16-channel-mux-demux/
I changed the pins to be the ones in the esp32_basic_ synth and all was fine, a couple of test LED's flashed as their channels were stepped through.
Have tried various changes, but decided to drop them and ask what may be happening.
Thanks for any insight :)
Hello,
easySynth.ino line 345 is referencing method: "Filter_CalculateNone" that is not declared.
I checked the ML_synthtools library as it is where the regular "Filter_Calculate" is declared but the "~None" method is not present there.
Am I looking in the wrong place or is this a bug?
Thanks!
it says ml_status is missing in ml_chorus.cpp file, i've dowloaded your library.
Thanks!
So I'm incorporating an analogue multiplexer over in the Organ_Example project but it comes from here. I am making changes in various files but I ran into this
in file adc_module.ino
#ifdef ADC_MCP_CTRL_ENABLED
#define ADC_OVERSAMPLING 16
#else
#endif
I am not using the gpio expander (that I think MCP refers to) - in this particular project. Therefore I don't want to turn that on, however, the ADC_OVERSAMPLING 16 seems needed and I can't compile without defining ... so I think maybe this is a mistake.
Can it produce the sound of an acoustic piano?
Maybe by sampling or some complex FM synth configuration?
Hi,
I can't get the code to compile. It always stops at "Syntselect was not declared in this scope".
I'm using the Audikit V2.2.
Board in the manager ist ESP32 DEV Modul. Version 1.0.6.n 1.04 makes no difference. I tried some different arduino versions, but didn't work.
Any advice?
Thanks!
Hi! How you connect your midi keyboard to board? I have one esp 32 audio kit board, but I did not understand, which board pin must be connected with midi pin.
also, in this video https://youtu.be/_iwpOnLWirU?t=574 I see something orange, midi-like. Is this mean I can connect midi to audio-in jack?...
Thank you
Translated through Google. Below also in Dutch.
Dear Marcel,
First of all I want to say that I enjoy the videos you make.
It is impressive what is possible with limited resources.
So I thought, I want that too. So I bought an ESP32 Audio Kit and an ESP32 Dev module.
I received a version 2.2 3378 as ESP32 Audio Kit.
Also on the back is the WIFI antenna ESP32-A1S 2974.
The antenna is painted black.
I have read a lot of discussion about the audio chip that is on it and I understand that it will be an ES8388.
The LED flashes at D5. Also a indication?
I see that MIDI input works and in the dump the codes appear ....... but no sound at all.
Not through headphones and not through the speakers.
What am I doing wrong?
See my settings below.
See also the attachments.
If more information is needed, please let me know.
Your help is of course much appreciated.
musical regards,
Arie van den Berg.
Beste Marcel,
Allereerst wil ik je zeggen dat ik geniet van de video's die je maakt.
Het is indrukwekkend wat er mogelijk is met beperkte middelen.
Dus ik dacht, dat wil ik ook. Dus kocht ik een ESP32 Audio Kit en een ESP32 Dev module.
Ik ontving als ESP32 Audiokit een versie 2.2 3378.
Ook staat er achterop de WIFI antenne ESP32-A1S 2974.
De antenne is zwart gelakt.
ik heb heel wat discussie gelezen over de audio chip die er dan opzit en ik begrijp dat het een ES8388
zal zijn. Het ledje knippert bij D5. Ook een aanwijzing?
Ik zie dat MIDI input werkt en in de dump de codes verschijnen ....... maar totaal geen geluid.
Niet via hoofdtelefoon en ook niet via de speakers.
Wat doe ik fout?
Zie onderstaand mijn instellingen.
Zie ook de bijlagen.
Als meer informatie nodig is dan hoor ik dat graag.
Je hulp wordt natuurlijk zeer op prijs gesteld.
Muzikale groet,
Arie van den Berg.
Can the synthesizer be tuned to a specific midi channel? So that he would not perceive other channels. The sequencers allow you to tune any of the 16 channels. This is very useful when there are several synthesizers. VST synthesizers are good, but more interesting for me than hardware.
Hi Marcel,
I dropped my code and replaced it by YOur new version as You added Pitchbend and Modwheel.
I missed the velocity and thought that my keyboards was not sending it. It was not cennected in the code.
in easySynth.ino
inline void Synth_NoteOn(uint8_t ch, uint8_t note, float vel)
{
struct notePlayerT *voice = getFreeVoice();
struct oscillatorT *osc = getFreeOsc();
/*
* No free voice found, return otherwise crash xD
*/
if ((voice == NULL) || (osc == NULL))
{
//Serial.printf("voc: %d, osc: %d\n", voc_act, osc_act);
return ;
}
voice->midiNote = note;
voice->velocity = vel * 1.25 ;// 0.25; /* just something to test */
voice->lastSample[0] = 0.0f;
The behavior should be changed in case when more notes (keys) are played and maxed out the polyphony.
-> other notes should turn off in that case
In addition to that a mono mode could be also nice
I have a Esp32 Audio Kit 2.2, and I have no sound.
I uncommented #define BOARD_ESP32_AUDIO_KIT_ES8388 and add #define ESP32_AUDIO_KIT
I connected MIDI keyboard, and when pressing keys, red LED is flashing.
I read #71 and write ES8388_CFG_I2C / ES8388_CFG_I2S. Actualy, I tried all possible combinations, and finally found my board exactly model and name, and put right pins from datasheet (ES8388_CFG_I2C = 2 and ES8388_CFG_I2S = 1 in my case), exactly as in #71 issue.
(from datasheet:)
DOUT IO35
DIN IO25
LRCK IO26
BCLK IO27
MCLK 0
SCL 32
SDA IO33
finally, I uncomment #define NOTE_ON_AFTER_SETUP but still nothing.
I connected earphones in "Earphones" jack, also I connect speaker to LOUT and ROUT. In earphones always silence, in speaker - silent white noise.
I using just esp32_basic_synth with default z_config, but as I believe, with NOTE_ON_AFTER_SETUP this is not matters.
Switchers in 1 2 3 position (as in photo below):
But! If I connect midi to IO21 (instead of IO22), loud white noise starting from earphones (red led not flashing when i pressing keys)
In serial console I see next:
esp32_basic_synth Copyright (c) 2023 Marcel Licence
This program comes with ABSOLUTELY NO WARRANTY;
This is free software, and you are welcome to redistribute it
under certain conditions;
Initialize Synth Module
Initialize I2S Module
Connect to ES8388 codec...
SDA: 33
SCL: 32
freq: 400000
0x00: 0x05
0x01: 0x40
AdcCh1!
MixChAMPL!
ES8388 setup finished!
Reg 0x00 = 0x05
Reg 0x01 = 0x40
Reg 0x02 = 0x00
Reg 0x03 = 0x00
Reg 0x04 = 0x3c
Reg 0x05 = 0x00
Reg 0x06 = 0x00
Reg 0x07 = 0x7c
Reg 0x08 = 0x00
Reg 0x09 = 0x88
Reg 0x0a = 0x50
Reg 0x0b = 0x02
Reg 0x0c = 0x0c
Reg 0x0d = 0x02
Reg 0x0e = 0x30
Reg 0x0f = 0x20
Reg 0x10 = 0x00
Reg 0x11 = 0x00
Reg 0x12 = 0x16
Reg 0x13 = 0xb0
Reg 0x14 = 0x32
Reg 0x15 = 0x06
Reg 0x16 = 0x00
Reg 0x17 = 0x18
Reg 0x18 = 0x02
Reg 0x19 = 0x22
Reg 0x1a = 0x00
Reg 0x1b = 0x02
Reg 0x1c = 0x08
Reg 0x1d = 0x00
Reg 0x1e = 0x1f
Reg 0x1f = 0xf7
Reg 0x20 = 0xfd
Reg 0x21 = 0xff
Reg 0x22 = 0x1f
Reg 0x23 = 0xf7
Reg 0x24 = 0xfd
Reg 0x25 = 0xff
Reg 0x26 = 0x1b
Reg 0x27 = 0xb8
Reg 0x28 = 0x28
Reg 0x29 = 0x28
Reg 0x2a = 0xb8
Reg 0x2b = 0x80
Reg 0x2c = 0x00
Reg 0x2d = 0x00
Reg 0x2e = 0x1e
Reg 0x2f = 0x1e
Reg 0x30 = 0x1e
Reg 0x31 = 0x1e
Reg 0x32 = 0x00
Reg 0x33 = 0xaa
Reg 0x34 = 0xaa
I2S configured using following pins:
BCLK,BCK: 27
WCLK,LCK: 26
DOUT: 25
DIN: 35
rev: 15329, 15329
Reverb is ready!
MIDI listen on Serial with 115200 baud
Setup Serial2 with 31250 baud with rx: IO21 only
Setup MidiPort2 using Serial2
ESP.getFreeHeap() 83772
ESP.getMinFreeHeap() 83740
ESP.getHeapSize() 286852
ESP.getMaxAllocHeap() 51188
Total heap: 286852
Free heap: 83772
Total PSRAM: 0
Free PSRAM: 0
Firmware started successfully
I moved some processing to the Core0 task loop
At first it wasn't being called but I checked your code and it was updated to the MIDI_VIA_USB... module
so adding that in now it works.
#if (defined ADC_TO_MIDI_ENABLED) || (defined MIDI_VIA_USB_ENABLED)
xTaskCreatePinnedToCore(Core0Task, "Core0Task", 8000, NULL, 999, &Core0TaskHnd, 0);
#endif
In the first 30-60 seconds I get audio glitches - even one where it was making a rough popping on left side then right side alternating.
So processing Core0 seems to slow auto processing which we assume only happens on Core1 in arduino.
Therefore, generally no improvement - but over time things seem to buffer or perform ok.
So I'll look at having a kind of reduced frequency of calls in the Task0loop using some kind of loop count variable to see if that removes that glitch.
Hopefully of use to others and OK by Marcel to offer up as a change.
I've added some simple lines to enable an octave shift of a keyboard by one octave upward.
The situation, was that I've built the synth to pair with a 3 octave 1970's PAiA 2720 keyboard bed. The unison mode was problematic, in that the notes were often too low for where I wanted to play them, it ran out of top end. The mod allows the keyboard to behave as though it has 4 octaves.
It could probably be done another way, but it works :)
Pin is 13 on an ESP32 Dev (can be any pin). 10K to Ground, switch to 3.3V Vcc.
Changed code is in midi_interface.ino, plus 'pinMode (13, INPUT);' in void setup() :
(Copy all below, there's a formatting problem when posted.)
inline void Midi_NoteOn(uint8_t ch, uint8_t note, uint8_t vel)
{
if (digitalRead(13) == HIGH)
{
note = note +12; // raise an octave
}
if (vel > 127
{
/* we will end up here in case of problems with the MIDI connection */
vel = 127
Serial.printf("loud note detected!!!!!!!!!!!!!!!!!!!!!!!\n");
}
if (midiMapping.noteOn != NULL)
{
if (digitalRead(13) == HIGH)
midiMapping.noteOn(ch, note+12, pow(2, ((vel * NORM127MUL) - 1.0f) * 6));
}
{
if (digitalRead(13) == LOW)
midiMapping.noteOn(ch, note, pow(2, ((vel * NORM127MUL) - 1.0f) * 6));
}
}
inline void Midi_NoteOff(uint8_t ch, uint8_t note)
{
if (digitalRead(13) == HIGH)
{note = note +12; } // raise an octave
if (midiMapping.noteOff != NULL)
{
{
if (digitalRead(13) == HIGH)
midiMapping.noteOff(ch, note+12);
}
{
if (digitalRead(13) == LOW)
midiMapping.noteOff(ch, note);
}
}
}
How to get wonderful Super / Hyper Saw sound from your code. Please tell me what needs to be added and where? I can't do it without your help.
Equipment setup is: ESP-WROOM32, MAX98357A I2S DAC, same 16 channel multiplexer as shown in the ADC enabled video.
Issue summary: The code compiles as downloaded, but doesn't if the ESP32_AUDIO_KIT is deselected. Also problems if the AC101 isn't selected. Example - 'l_sample was not declared in this scope' in the I2S_NODAC section (meaning another DAC than the AC101?)
The original version of the code did compile with my parts and worked, had sound from MIDI keys. It only had my own lack of a MIDI controller as a problem. Delightfully fixed and demo'd in your video of the new ADC enabled version.
The audio kit seems to be uncommonly rare, otherwise would have been ordered.
Rather than shooting in the dark, I'd like to know what actually needs to be changed... in the right way for perhaps a more average set of components :)
Edit - Nothing may need to be changed. The audio kit detection will be a built in feature of the Arduino compiler, for one thing. Also, I just read the reply to the ADC connections question and realised I'd not grounded S3! However, there is still no sound output through the MAX98357A.
MIDI can be received via USB activating the MACRO "MIDI_VIA_USB_ENABLED" in config.h.
this is not in the sketch ... do i have to transplant the files from another module into the project?
Thanks for the amazing project, I'm glad I looked for existing ESP32 based synth before starting from scratch!
I'm wondering if someone already tried to use this code on the esp32-lyrat dev board https://www.espressif.com/en/products/devkits/esp32-lyrat dev board
It integrates a different DAC: ES8388 witch is a full coded audio chip integrating also analog inputs, headphone amplifier and analog mixers. I guess it should work since it also uses I2S. Any advice is welcome.
I will try to set it up and report here, first I need to find out where I put my optocouplers..
Thanks again !
C is such a pain.
Would micropython be suitable for this project?
I can work on porting next year.
Hello, how can I use arduino ide to burn files, and it prompts that delay-init is not defined during verification, thanks
Hi Marcel,
Thanks for the great work on this synthesizer (and all of your synth projects for that matter)!
Do you plan to introduce an abstraction layer to your projects, so that for example all midi functionality is extracted to a library of sorts - like you did for the boards as well?
In this case, it might be interesting to add an option for sharing MIDI maps of various controllers. I use the Launchkey Mini mk3 by Novation which is quite inexpensive and has a good availability.
I would be interested to see how others map their Launchkey and I guess that is true for others and other MIDI controllers as well.
Would you be up for this? I think it might increase the reusability of your work which you have spent so much time on I can imagine.
Best,
Daniel
P.S. for all who do not want to go through the process of reading out the MIDI CC messages of the Launchkey Mini mk3, I have created a button/key mapping that I attached to this issue - Happy coding and jamming!
NN stands for note, VV for velocity, PP for potentiometer value, C for channel - the Launchkey has its own channels that can be switched by pressing Shift and Transpose. It makes creating a MIDI mapping for Marcel's project easier and more difficult at the same time :D (more functions that you can code (on the potentiometers in particular), but channels are then different in meaning from what Novation had in mind before..)
In the actual repo the writeDAC() function only exists as a prototype without the function itself (and of course will not compile).
Do you just miss to include it or is it not yet implemented?
I expected something like a pulse density modulated I2S, I've seen it before on https://www.hackster.io/janost/audio-hacking-on-the-esp8266-fa9464
i can compile the code and upload it. But then i got an error message while the es8388 is initialising.
esp32_basic_synth Copyright (C) 2021 Marcel Licence
This program comes with ABSOLUTELY NO WARRANTY;
This is free software, and you are welcome to redistribute it
under certain conditions;
Initialize Synth Module
saw ready
rev: 15329, 15329
Reverb is ready!
Initialize Audio Interface
Connect to ES8388 codec... 0x00: 0x00
0x01: 0x00
Failed!
0x00: 0x00
0x01: 0x00
Failed!
any hint ?
i tryed to get the board jumper setting from your videos but quality was too poor.
Thanks for the help. you're projects are awesome!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.