High Voltage Forum

General electronics => Computers, Microcontrollers, Programmable Logic, Interfaces and Displays => Topic started by: Max on April 04, 2020, 09:35:28 PM

Title: Syntherrupter - A Feature-rich, Polyphonic Interrupter
Post by: Max on April 04, 2020, 09:35:28 PM
Good evening everyone,


I would like to introduce you to my polyphonic MIDI interrupter, which I gave the fabulous name "Syntherrupter". Here's how it sounds:

And here's how it looks. Left to right is power switch, charging port, USB serial port, interrupter output (optical). Note that there's an optical receiver next to the transmitter that's not needed.
(https://raw.githubusercontent.com/MMMZZZZ/Syntherrupter/dev/Documentation/Pictures/Syntherrupter_Max_Back.jpeg)
(https://raw.githubusercontent.com/MMMZZZZ/Syntherrupter/dev/Documentation/Pictures/Syntherrupter_Max_Internal.jpeg)

Motivation
Netzpfuscher's UD3 (https://highvoltageforum.net/index.php?topic=188.msg4678#msg4678) has awesome features but many people prefer "simpler" drivers like the UD2.7. However, most "normal" standalone interrupters that are readily available have rather rudimentary features. The very popular Onetelsa MIDI interrupter f.ex. can only play two notes simultaneously and even that not very well (popping noises, only limited safety features). This is where Syntherrupter comes in. It aims to be the most feature-rich interrupter that works with any tesla coil.

Key features

Getting Started
Click here! (https://github.com/MMMZZZZ/Syntherrupter/blob/dev/Documentation/Wiki/Getting%20Started.md#readme)

MIDI Setup on the PC:
Open and play MIDI files with SynthFont (for good sound quality: download the SGMv2.01-Sal-Guitar-Bass-v1.3 (https://sites.google.com/site/soundfonts4u) soundfont). You can select a different output for each track which we can use to send some tracks to the interrupter. You might want to change the instrument of these tracks to use ADSR (more details below).
SynthFont allows you to send MIDI data directly to a serial port (=Syntherrupter). The baud rate is 115200baud/s.
If you want to use another Software you'll need two little tools that are very easy to use: Hairless MIDI<->Serial (https://projectgus.github.io/hairless-midiserial/). and loopMIDI (https://www.tobias-erichsen.de/software/loopmidi.html). When you start loopMIDI it creates a virtual MIDI device that you can select in any MIDI software as output (or input btw). And hairless MIDI<->Serial makes the bridge between this virtual MIDI device and the serial COM port.
This sounds complicated but since the last both programs remember the settings, you only have to start them - no other click needed. The setup has proven its reliability and usability many times and many hours.


Kind regards,
Max


Edit 21.05.20: Since the first release there have been quite a few significant improvements, like polyphony. I'm working on this post to keep everything documented. Most things are up to date, but not all. If something is still in work, it is noted there.
Edit 05.11.20: Most of the Information has now been migrated to the wiki. Hence this post got much shorter and easier to read.
Title: Re: Powerful easy to build MIDI Interrupter
Post by: Max on April 07, 2020, 01:10:30 PM
Did an extensive test of the interrupter with a static load (I probably won‘t be able to test the complete tesla coil until the end of the lockdown). I‘m pretty happy with how it performs.
Smoke on the Water is a pretty good demonstration of its Pitch Bend, Modulation and ADSR capabilities, although the last one is less noticeable (Especially in the second half of the video!)



Kind regards,
Max
Title: Re: Powerful easy to build MIDI Interrupter
Post by: Mads Barnkob on April 13, 2020, 09:47:58 PM
Thank you very much for the extensive thread and sharing all of your work, ready to duplicate!

It does however seem a little overwhelming and complicated, but once you show the picture of the inside, it seems a little simple again. But all the uses of different software and "conversions" could be a problem in the future? Instead of just having a MIDI interrupter appear as a MIDI channel on a USB->MIDI interface? You are running a seriel through USB jack communication?

How would you adapt this to something like 8 channel/voice MIDI interrupter, maybe a bit overkill, but I am looking into driving 4 coils at once at some point and would construct something in one unit at a point.

Is there a lot of custom MIDI editing to implement all the features of your driver or how well does it take a MIDI file straight from the internet?

Pitch bending on metal, sounds awesome, that ring down of the metal vibration is priceless.
Title: Re: Powerful easy to build MIDI Interrupter
Post by: Max on April 14, 2020, 02:46:08 AM
Hi Mads,


Thanks for the reply! Its actually pretty simple - in all the points you mentionned. I guess I have a complicate sounding way of describing stuff...

Software vs Hardware MIDI adapter: how difficult is it to use the hardware converter? Plug in, plug in, done. In software: double click on exe, double click on exe, done. The two programs, hairless midi serial and loopmidi are really simple. In hairless midi serial you select your input, output and baud rate - all of which is remembered when closing the program. The serial port is even determined automatically in case you change the USB port. Loopmidi is even more simple: start/stop - that’s it.
Both programs are small, free, stable, without noticeable latency or other bottlenecks, and have been around for years. In my opinion this solution has no disadvantage over the hardware solution. The latter would require me to buy a MIDI to USB adapter, a MIDI cable, MIDI connector and add some circuitry to the interrupter as MIDI requires an optocoupler on the receiver side.
Additionnaly I can plug my keyboard (which has USB) to my PC and switch with two clicks in hairless MIDI serial between keyboard and MIDI file. I prefer this over changing midi cables (especially during a live performance).

Multiple Channels: now this is an interesting idea. It would actually be pretty simple to modify the midi class for listening to certain chanels only. You could then have multiple instances of this class running. They would all receive the same data but only react if it belongs to their channel(s).
I guess the limit would be the amount of timers used to generate the output signal; which means you can have up to 6 independent outputs.
The biggest amount of work is without any doubts the user interface. I guess you‘d need at least to set the volume and midi channel for each output. This is still not a lot of work but for sure more than the changes to the „actual“ code.

You mentioned 8 voices for 4 tesla coils. This of course requires polyphony which I tried a loooong time to get working - without success. As I have no idea how to solve them I don‘t think I‘ll try it again anytime soon. I also lost interest because I really don‘t miss it. Listening to my favorite tesla coil title Counting Stars I don‘t know which other voice I‘d like to play on the tesla coil, too. And this is true for almost all of my MIDI files.

MIDI file preparation: usually none at all. 8) Most of the work is finding good MIDI files. I‘m looking for two things. First, the melody is monophonic it is no problem if it switches between tracks but there shouldn‘t be anything else on these tracks. Second, there are „meaningful“, rich other voices that can be played on regular speakers. This is even more important than the first point because you can easily copy/move notes to a separate track. Writing your own accompaninent is way harder ;)
I haven‘t done any other MIDI file modifications yet. The Counting Stars video above, the Smoking Water video in my previous post and the Pirates of the Carribean video in the first post all use an unmodified MIDI file. The only change was me setting the modulation manually in the Pirates video (you could save that change to the MIDI file with ~two clicks).
In theory you don‘t need the other voices but in my opinion it adds so much to the overall sound that I don‘t (want to) use any of these prepared single/dual voice MIDI files for tesla coils.
I have to admit I can‘t see what other processing you would need to do with other MIDI interrupters except for changing the channel number.

Hope this sounds less complicated and more helpful ;)


Kind regards,
Max
Title: Re: Powerful easy to build MIDI Interrupter
Post by: Max on April 23, 2020, 09:25:46 PM
Good evening everyone,


So Mads input motivated me to do two things: 1. create an english version of the GUI and 2. implement the possibility for multiple tesla coils.
When I said I didn't want to touch the GUI anymore it was mainly because when I first created it, fonts looked really ugly. Therefore almost all Text in the GUI are actually pictures. Looks fine, but is a pain in the ass to work with and even worse to create translations.

Since I was almost a "day 1" nextion user, they had quite some time to improve their software. As of today, most fonts look quite good. So I decided to start from scratch and implement the new functions. This time I try to make it as easy as possible to change the language afterwards (basically a list of all strings which then can be replaced with content in your language). I'm documenting the code that runs on the nextion, too (was not well documented). The new GUI can be found in a separate branch on GitHub: https://github.com/MMMZZZZ/Syntherrupter/tree/GUI-Redesign (https://github.com/MMMZZZZ/Syntherrupter/tree/GUI-Redesign)
Here's a little preview. The GUI has space to select from up to 10 coils which shall receive the new settings. The Tiva microcontroller can only handle up to 6, but there might be ways to increase the number.
 [ Invalid Attachment ]

I'm thinking about adding other features, like changing the ADSR parameters in the GUI. Your input (or even contribution) is highly welcome!
I haven't touched the Tiva code yet. I'll start working on that once the GUI gets usable.


Kind regards,
Max
Title: Re: Powerful easy to build MIDI Interrupter
Post by: futurist on April 24, 2020, 01:19:44 PM
Big thanks for sharing your project!

Hairless midi to serial with loopmidi is really easy to use, I use same setup with onetesla interrupter on atmega328p mcu
What was wrong with polyphony? Can you describe why the coil sounded bad?
Title: Re: Powerful easy to build MIDI Interrupter
Post by: Max on April 24, 2020, 02:18:51 PM
One thing I forgot to mention about the USB thing: the reason it is so practical is because the microcontroller board already has Serial-USB. Otherwise a USB-MIDI adapter would indeed be the easier solution.
Thinking about USB... it just came to my mind that the microcontroller actually has full USB functionality so it could be possible to make it identify as MIDI device without additional cables, adapters or software. That would be awesome! I'll have to check that.

Considering polyphony... I tried the following: A sample-ISR is called at 55kHz. Each call increases the "tick count" in an array. A second array stores the ticks necessary for 1 period of an active note. Once that value is reached, an output pulse is generated and the tick counter of this note is set back to 0. That idea was proposed by Netzpfuscher and basically I don't see many other ways of doing it.
The first big problem is: Two pulses can follow each other very shortly. 1 "tick" is not enough time to ensure primary current has ringed down to 0. That means you have a high risk of hard switching on the next ontime (UD1/UD2 drivers always switch at the beginning of an ontime to start the oscillation and only after that first kick start using ZCS. UD+ (which I have) is even "worse" as it has a startup oscillator switching at least twice). This becomes even more of a problem when low notes (allowing looong ontimes) are mixed with high notes. Therefore a minimum offtime needs to be ensured between notes. How? Well I implemented three different ways:
1. Skip. If the next ontime is too close to the current, skip it.
2. Delay. Wait until the minimum offtime is over before generating the pending ontime.
3. Merge. If a ontime shall be generated, "look ahead" if another one is too close. If yes, merge them, meaning generate a pulse with the sum of both widths. I thought this should be the best sounding option.

The issue with all three was - if i remember correctly; that was at least a year ago - it sounded very distorted even with only two notes. Playing three notes I could no more identify the notes playing. The three variants all sounded a bit different, and even without a minimum offtime it didn't sound good. The most demotivating thing for me: on the scope the output signal looked just the way I expected it. This means, I had a perfect overlay of two tones, just like if you had or'ed them together (plus the offtime thing). So my code worked fine, or in other words: I had no idea how to make it sound better. I never tested it with an actual coil but only with a piezo and my oscilloscope. I absolutely want to ensure proper operation before attaching it to anything that can blow up. And I didn't implement any other basic features, like receiving MIDI data. Notes, ontimes etc was all hard coded (and perfectly fine for such first tests).
Additionnal issues: The skip/delay and especially the merge code took quite some time, actually about 50% of the CPU time. this does not leave a lot of time for servicing UART interrupts or MIDI processing like I'm doing now. I'd have to look into things like uDMA to gain time but as of now this is above my skills.

Bottom line: I waste most of the CPU time generating a signal that sounds worse than a single note and I have no idea how to improve sound or CPU time.
I attached that old code below in case anyone is interested. It is more or less commented. The whole nextion stuff can be ignored. What I described above happens inside "notesSampleISR", "newNote" and "main".


Kind regards,
Max
Title: Re: Powerful easy to build MIDI Interrupter
Post by: Netzpfuscher on April 24, 2020, 04:56:15 PM
The thing I proposed is a little bit different, but this should work too. I proposed a thing more like a DDS with a accumulator.
I heaven't read the datasheet of the tiva but the big ARM micros can chain timers, so a sound generation like mine in the UD3 can be possible. I haven't found anything that sounds better and it need not so much CPU cycles. You don't need a super high clocking ISR for sound generation. Only like 10 times the highest frequency you want to play.

You need a free running hardware counter/timer the frequency from like 100-300kHz without interrupts. Then you need a 10kHz sample ISR and a One-Shot timer for the Ontime.

You can take a look in the midi ISR from the UD3:

https://github.com/Netzpfuscher/UD3/blob/master/common/ud3core/tasks/tsk_midi.c#L241

In essence you generate your pulses in the ISR and write the Ontime in a FIFO, you don't send them to the One-Shot timer. At the end of the ISR where all of your pulses are generated and stored in the FIFO you take the first item out of the FIFO and send it to the one-shot timer. (The coil fires one pulse) then you exit the ISR. The next time you do the same. The ISR is 10 times faster than your highest tones so you call the ISR at the worst case 10 times before a new value is pushed to the FIFO, so the FIFO will not overflow and the next pulse repetition rate can only as high as 10kHz so you have enough space between the pulses. You get Jitter on the pulses because timing for a single channel can be delayed until the ISR is often enough called. But it sounds good.

If you can chain timers you can use a second timer for the offtime. Which get started with the falling edge of the output of the one-shot timer, it contains the minimum time for a next pulse. If the offtime ISR get's fired you take a value from the FIFO, if its empty exit, otherwise load the pulse in the one-shot timer. Then you generate the pulses faster than the 10kHz from the sample ISR and still be safe not to overlap pulses.

If you need more help we can make a skype call, then I can guide you through my code.
Title: Re: Powerful easy to build MIDI Interrupter
Post by: Uspring on April 25, 2020, 01:00:19 PM
You can avoid too close bursts in polyphony to some extent by using just intonation https://en.wikipedia.org/wiki/Just_intonation . The frequency ratios there are fractions m/n of integers. In order to play two notes with a frequencies f1 and f2 at a ratio of m/n, i.e. f1/f2 = m/n, choose a tick frequency of n*f1 and fire a burst every nth tick and every mth tick. Bursts of these two series will either coincide or are spaced apart at least one tick period.

This also works for more than 2 voices with the caveat, that tick frequencies can become too large, implying too small burst spacings. From the point of view of musical harmony, these cases are somewhat exotic and probably uncommon. But tastes differ.
Title: Re: Powerful easy to build MIDI Interrupter
Post by: futurist on April 26, 2020, 01:37:40 AM
The first big problem is: Two pulses can follow each other very shortly. 1 "tick" is not enough time to ensure primary current has ringed down to 0. That means you have a high risk of hard switching on the next ontime (UD1/UD2 drivers always switch at the beginning of an ontime to start the oscillation and only after that first kick start using ZCS. UD+ (which I have) is even "worse" as it has a startup oscillator switching at least twice). This becomes even more of a problem when low notes (allowing looong ontimes) are mixed with high notes. Therefore a minimum offtime needs to be ensured between notes. How? Well I implemented three different ways:
1. Skip. If the next ontime is too close to the current, skip it.
2. Delay. Wait until the minimum offtime is over before generating the pending ontime.
3. Merge. If a ontime shall be generated, "look ahead" if another one is too close. If yes, merge them, meaning generate a pulse with the sum of both widths. I thought this should be the best sounding option.

This is polyphony on my coil, onetesla interrupter, UD+ with SKM400GB123DH6 halfbridge

It's crudely implemented, if second note plays when first is playing, the second note is ORed together but limited to some max. pulse width
Interrupter occasionally misses some notes, makes random pulses, but the actual result is decent and so far it isn't destroying IGBTs :)
https://highvoltageforum.net/index.php?topic=160.msg1049

Maybe in addition to limiting pulse width there should be some minimum dead time between pulses. If some pulses are omitted you probably wouldn't notice any sound difference


Title: Re: Powerful easy to build MIDI Interrupter
Post by: Max on April 26, 2020, 04:42:40 PM
Hello everyone!


Thanks for the replies and ideas!

@Netzpfuscher:Sorry for misunderstanding/misquoting your idea and thank you for the explanations. I tried to understand them and your code, unfortunately without much success. I'll have another look at it once I get the current changes to my software done (see below). If then I don't manage to understand your idea, I'll happily accept your kind offering for sykiping!

@Uspring:
Had that in mind, too, at the beginning (mainly because it simplifies the code). However to avoid too close pulses this would require to start any note in phase with all the notes that are already playing. This requires delays that increase with every additionnal note playing.
If you want to use the coil together with a normal synth like me it would probably sound pretty bad (some pieces/notes more than others) because your intonation is different

@futurist:I'd have to have another look at his code. I knew that ORing different notes together is the idea behind polyphony and that it works pretty well in quite a few coils. It was my idea, to, and it was what my code seemed to do. As I said, I couldn't really find a reason for the bad sound.
Edit: I overlooked your link. Interesting problem. I haven't had that on my old quick 'n dirty ATMEGA MIDI Interrupter and not on the Tiva one either. The ATMEGA one has probably played around 5 hours total and the Tiva (release version 1.1) around 2 hours. As I stated before I use MIDI files from various sources (whichever sounds best) and mostly unmodified.


What I did in the meantime... I mostly finished the work on the multiple coils part. You can now control up to 6 coils (won't increase it further) independently of each other. Simply select the coil(s) to which you want to send your next settings. In MIDI Live mode you can select for each coil to which MIDI channels it shall listen. More details about new features can be found on the release page (https://github.com/MMMZZZZ/Syntherrupter/releases/tag/v2.0-beta-1).

I looked into the Tiva USB functionality. In theory it is well possible to write software that makes it identify as MIDI device. In practice this is A LOT of work; you have to write your own USB stack since there's no MIDI-USB library available for Tiva. I don't know if I would get it to work at all and even if so, it would cost me days and days. Comparing that to the easy to use hairless midi<->serial and loopmidi solution its not worth the time at all for me.

More interesting is the EEPROM. This seems to be quite easy to use so I'll work on that in the next days. The idea is that you can change as much settings and limits as possible without reflashing the Tiva or Nextion. After this I may restart working on polyphony.

Finally I did a quick video demonstrating most of the new features (using a pencil that costs more than the whole interrupter  ;D ). Note that in the microcontroller source code the max coil limit was set to 3, hence only three coils showing up in the GUI.


Kind regards,
Max
Title: Re: Powerful easy to build MIDI Interrupter
Post by: Max on May 06, 2020, 01:16:53 AM
Yet another milestone: EEPROM works! Release details over here: https://github.com/MMMZZZZ/Syntherrupter/releases/tag/v2.0

This means many things that were defined at compile time can now be changed at runtime. F.ex. set the absolute maximum ratings for each coil, change display brightness, etc. In case anyone uses this interrupter and misses some settings, feel free to leave your feedback ;)
At this point I have pretty much everything completed that I wanted to do, and I like the user interface. I'd consider this release as ready to use with no known bugs or problems.

Only missing thing is ADSR... those values can't be changed at runtime yet. That aside, I can now have another look at Netzpfuschers polyphony code and maybe try to implement it.


Kind regards,
Max



Some examples of the new GUI. Note: If the Syntherrupter is configured with lets say 2 instead of 6 outputs, the outputs 3-6 and their settings won't be displayed.
Settings page for the tesla coils:
 [ Invalid Attachment ]

Page for the user settings:
 [ Invalid Attachment ]

A new keyboard...
 [ Invalid Attachment ]

And brightness control
 [ Invalid Attachment ]

MIDI Live Mode when configured to three coils only:
 [ Invalid Attachment ]
Title: Re: Powerful easy to build MIDI Interrupter
Post by: Max on May 14, 2020, 01:11:36 AM
Good evening,


Thanks to Netzpfuschers explications I finally got some promising results for polyphony! As of now the interrupter is configured to play up to 4 notes on 4 independant outputs, making a total of 16 independant notes with ADSR.


It already sounds quite good, but there are still lots of problems to solve.

Kind regards,
Max
Title: Re: Powerful easy to build MIDI Interrupter
Post by: Mads Barnkob on May 14, 2020, 11:26:23 AM
Thanks to Netzpfuschers explications I finally got some promising results for polyphony! As of now the interrupter is configured to play up to 4 notes on 4 independant outputs, making a total of 16 independant notes with ADSR.

It already sounds quite good, but there are still lots of problems to solve.
  • I need to get the timers working as oneshot timers instead of PWM + ISR stopping the gimer after each pulse
  • The code misses some notes; not exactly clear why.
  • One midi file causes way too high ontimes, and prevents the interrupter from normal operation. Very strange... probably too many commands at the same time.
  • Minor bugs...

Very nice progress, I am following this project with great interest in building my own version of it one day :) You are in a terratory where I have little to none experience and have failed to localize time to get it.

The notes you are missing, are those very short or very long notes? There could be some racing conditions at play...
It could also be related to the overflow of MIDI commands, I recall that I read about that being a problem with other MIDI interrupters.

How well does the same MIDI file scale on to lets say a small 300 kHz DRSSTC making 40 cm sparks compared to a 40 kHz DRSSTC making 4 meter sparks? There is differences in their ring-up times and thus it would be awesome to have some auto-scaling features to adapt on-time on the fly for the resonant frequency of the connected coil.
Title: Re: Powerful easy to build MIDI Interrupter
Post by: Max on May 14, 2020, 12:14:33 PM
Hi Mads,


Thanks! Since I only have one single tesla coil, resonating at around 65kHz, I can't test what effect such drastic differences have. However... The non-polyphonic release of my interrupter (https://github.com/MMMZZZZ/Syntherrupter/releases) is tested and works well, even with furious MIDI files. And it already supports what you thought to be useful. If you have a look at my video a few posts ago (https://highvoltageforum.net/index.php?topic=1020.msg7396#msg7396) you can see how to set different ontimes/duties for different outputs. This means that you can set 100us for coil 1 and 500us for coil 2 and the MIDI velocity of a note will be matched to the different range on each coil, allowing you to compensate the described effects.

Maybe one word about the third slider in the video, which became a button (visible in the screenshots in the post next to the one linked above). Constant duty is fine because it assures a pretty constant volume. However it causes rather weak arcs with deep notes, since the duty cycle gets very small. On the other hand constant duty leads to very weak high notes, since the ontime gets too small. Therefore the default mode is "auto", meaning that low notes will be played at constant duty, and high notes at constant ontime.
Remember, if you know the "safe operating area" of your coil(s), you can save these values in the settings, and you can enter whatever you want on the MIDI page, the Interrupter won't leave the SOA. Therefore its safe to play around with constant duty / constant ontime!

Considering the missing notes I don't think their length is the problem. To me it seems more like it simply misses the MIDI command because it's too busy doing other stuff.  I "simply" have to improve the efficiency of my code.


Kind regards,
Max
Title: Re: Powerful easy to build MIDI Interrupter
Post by: futurist on May 15, 2020, 12:45:31 PM
Nice progress Max! Can't wait to built it myself.
I have one small and one medium sized DRSSTC, and friend has big CM600 coil so we could test the interrupter on 3 independent outputs

Where is the best to buy arm dev. board and display?

Title: Re: Powerful easy to build MIDI Interrupter
Post by: Max on May 15, 2020, 09:15:48 PM
Hello futurist,


Thank you! Looking forward to your experiences!

I bought my Tiva LaunchPad directly from TI: http://www.ti.com/tool/EK-TM4C1294XL#buy (http://www.ti.com/tool/EK-TM4C1294XL#buy)
Shipping is currently 7€. That's pretty high if you order one single dev board (I didn't...  ;D ) The TI page says that aside from themselves only Mouser and Digikey have them in stock. I never had issues with mouser; prices aren't especially low, but ok. Their biggest downside for me is that they ship from the USA, which means around 20$ shipping costs. However, orders above 50$ ship free :) Can't say anything about digikey.

The Nextion Touch display can only be ordered from their site: https://www.itead.cc/nextion-nx8048t050.html (https://www.itead.cc/nextion-nx8048t050.html)
You can find them on ebay, however that are incompatible twins - always. They look the same but they're only meant for the chinese market and can't be easily programmed.
Actually I'd love to find an as easy-to-use alternative since their customer support seems to be pretty bad (never had to use it). However it seems like there is no real alternative out there; only a few more professional and way more expensive solutions.
Edit 2: You could actually buy the 7inch model (65€) instead of the 5inch one (56€). Both have the exact same resolution, therefore no changes to the GUI are needed. Depends on whether you prefer bigger buttons and fonts or a more compact interrupter  :)
29.09.20: That‘s not true anymore. See here: https://highvoltageforum.net/index.php?topic=1020.msg8521#msg8521


Edit: If I'm already writing here, I can report about my progress as well. I fixed the issue with the missing notes and I managed to assure the minimum offtime after each note. Sounded even better; I'm really happy with that  :D . After fixing another issue, namely that all notes were assigned to the same channel, even if they came from different channels, I now get a fault interrupt. No real clue where that comes from, and it is rather annoying to debug.
Another problem: I have no idea how to assure that I'm not exceeding my duty cycle. Actually, measuring it is not the biggest problem, the question would rather be what to do when it gets to high? Skip notes? Reduce volume for a second or two?
Yet another edit: duty cycle limiting is actually not hard at all. Aaand the annoying bug is gone. I'll implement duty cycle limiting, allow in the GUI to modify the minimum offtime and then I think I'm done. It looks like the total voice limit lies around 16, maybe higher if time critical effects like pitch bend are not used. On a piezo it sounds good up to 4-5 voices; any higher is very noisy. This would mean that you can control up to 4 coils with 4 voices each.
I guess with some optimization effort it could be increased, but it would probably need significant changes to my code...


Kind regards,
Max
Title: Re: Powerful easy to build MIDI Interrupter
Post by: Max on May 18, 2020, 04:15:16 PM
Maybe the most interesting update until now: With release v3.0.0 (https://github.com/MMMZZZZ/Syntherrupter/releases/) Polyphony works. 6 voices on 6 independant outputs with reasonable quality and no audible glitch during pitch bending (which requires fast updating).
Actually the 6 voices is not a hard limit and can be increased to whatever number you want (though I didn't test any further). The problem is that above 4 notes the sound quality suffers, at least on my piezo I used for testing (should be a bit better on a tesla coil). Looking at most midi files, you rarely see more than 4 notes for second voices, so you can still have a two voice melody.
I didn't want to offer binaries for other maximum voice counts, since that would multiply with the maximum coil count, both settings which have to be set before compiling.

Also included: duty cycle limiting, minimum offtime (to prevent that two pulses follow each other immediately and the driver (hard)switches while there's still primary current flowing).

The v2.x.x firmware will still be maintained since it offers the superior sound for single notes (absolutely no jitter). Maybe I'll add a switch in the settings that allows between (clean) monophinc operation and polyphonic operation.

I'll try to make a video with static load in the next days. However it doesn't sound better or worse than the short demo above. It's just not skipping notes anymore  ;D

Edit: Well, that excitement didn‘t last for too long. I‘m missing data in some cases. Whether I use the 16 byte hardware FIFO, or a 128 Byte buffer, whether that buffer is filled by polling or by an ISR, whether I enable or disable compiler optimizations - NONE of all the combinations makes a difference, and I miss/overwrite every single time the same bytes. That makes me wonder if the issue is really due to my code or if it might be hairless midi<->serial... I‘ll check that tomorrow.
Edit2: Release is fine. Explanation in the next post.



Kind regards,
Max
Title: Re: Powerful easy to build MIDI Interrupter
Post by: Mads Barnkob on May 19, 2020, 09:26:06 AM
The joy of simultaneously doing hardware and software development!

You are also at a high pace in new releases, my best advice is to slow it down abit and do sprints on very few features at a time, get it to work 100%, then move on to the next feature. Else you quickly end up in your current situation where you are not sure what effected what :)

Best of luck and really looking forward to see your final result
Title: Re: Powerful easy to build MIDI Interrupter
Post by: Max on May 19, 2020, 11:49:02 AM
You're right, I should have slowed down a bit, because I overlooked that my code did exactly what it was supposed to do ;D What happened was a program change in the middle of the piece (= change of the instrument/ADSR curve). I overlooked that this command was actually in the MIDI file and thought it resulted from overwritten data.

While I couldn't hear any missing notes so far, I found out during the debugging process that the 16 Byte FIFO is actually too small (the FIFO overrun bit was set). Therefore I'll keep the bigger buffer. It costs a little bit of CPU time but  it won't miss any data for sure. Maybe I'll have a look at uDMA to eliminate that additional CPU usage. However if by CPU is too busy there are many other more time consuming things to look at.
Oh, and I found another small bug in the MIDI processing which is actually there from day one, and through all the hours (!) of testing for v1, v2, v3 I never noticed it.

After some more testing with loads of serial data I'll update the releases.


Kind regards,
Max
Title: Re: Powerful easy to build MIDI Interrupter
Post by: Max on May 20, 2020, 12:15:43 PM
Good morning,


The impact of the optimizations was actually bigger than I thought (should probably have waited with my last reply...).  I can now play 8 voices with less jitter than before.

This time I tested it pretty hard, passing all 16 MIDI channels to the interrupter, which should play on all 6 outputs around 6-10 notes from 4 out of the 16 channels (the other 12 were only to see if it processes the data fast enough) Result: noisy, but no missed notes. That noise increases with the output count, so you should use a Tiva firmware with as few outputs as possible. If you don't use one of the outputs, unassign all channels; this helps reducing the noise. With only one or two outputs, which will propably the case for most people, you can barely hear any noise.

I've successfully tested release v3.0.1 on my DRSSTC (static load) for over an hour with all kinds of MIDI files and I really like the way it sounds. I'll probably edit this tomorrow but as of now I think I'm pretty much done with the code. I do have some ideas for future improvements but honestly I'm too happy with the current state to start working on something new.  ::)

This video demonstrates pretty much everything. Just to remember, this is an unmodified MIDI file I found when searching for the song. Simply pass the channels you like to the interrupter, and you get this. Many voices, fast notes, ADSR, effects. Note that I reduced the constant duty for low notes at around 01:00 to protect my poor breakers  ;D

While the video above is for sure more impressive, I wanted to share this one too, because a) I have an earworm and b) I really like the staccato ADSR sound. The slight reverb comes actually more from ADSR than from the metal / the room.


I'm really looking forward to the next possibility to run the setup as tesla coil again, instead of cooking some steel...


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: futurist on May 21, 2020, 12:16:04 AM
I ordered dev. board and display and I'm eager to give some feedback :)
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on May 21, 2020, 07:46:28 PM
Note to myself: extensive testing is not complete testing. While playing around with the interrupter today I found a couple smaller issues. Nothing critical though. As always, you'll find the current release and what's changed on GitHub: https://github.com/MMMZZZZ/Syntherrupter/releases/ (https://github.com/MMMZZZZ/Syntherrupter/releases/)

An interesting observation: While my oscilloscope tells me that duty cycle limiting works, there are some note combinations that cause really high peak input currents. I already noticed a long time ago (before this project) that same duty does not mean same power. So it could simply be a particular "bad" combination within the limits... I'm interested if this will cause bigger arcs, too. However, it looks like ironically, I will not be the first one to produce any arcs with my interrupter  ::) It'll take weeks until I get access to a decent test location.

Edit: Just wanted to notify everyone that I rewrote the first post. It is an almost complete documentation of the Syntherrupter's features*. I'll add the missing bits over the next days.
*which it already was more or less for firmware v1.x, but that wasn't really helpful anymore.


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on May 24, 2020, 12:12:36 PM
While I use MIDI over USB-UART only, others would certainly like to have a direct MIDI input. Since MIDI uses an oddball baudrate of 31250, which most USB ports are not capable of, that feature requires a second UART. Yesterday I realized that this is actually pretty simple to add. Result: It can now receive MIDI data over the USB UART, or over the Rx/Tx Pins PC4/PC5 at 31250bps. Note that the data of both UARTs ends up in the same buffer. Therefore make sure only one of the ports receives data at the same time otherwise it'll be scrambled together.

Unfortunately I have no MIDI cables or optocouplers I'd need for testing. So in case anyone has the motivation and materials needed, I attached the binaries.
Edit: Attachment removed since it has been published on GitHub. Please check the release page (https://github.com/MMMZZZZ/Syntherrupter/releases) for the current firmware.


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: futurist on June 13, 2020, 10:39:23 AM
Finally received dev. board and display and I have few questions

What is the best way to power everything? USB or internal battery?
Do I need any additional switches, power switch, or safety switch for turning off outputs?

Before I do anything I have to ask my local machinist to cut out a hole in aluminium enclosure for the display
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on June 13, 2020, 01:25:41 PM
Hi futurist,


The best way to power it is over USB. That can be your PC (500mA min!) or a powerbank. A normal battery is problematic since the Nextion display requires regulated 5V, otherwise you damage it! With this in mind I oped for the powerbank; cheap, regulated and with charge controller.

The software has a safety feature integrated which turns all outputs off if you hit the white background below the control sliders. If you don’t trust that you can of course add a safety switch which cuts the supply or the connection to your optic transmitter(s).

Although there is a standby function which turns off the display backlight, it is not a soft power off. So if you‘re using batteries, you need a power switch.

The hole for the display... yeah I wanted to do it on a CNC to get a nice chamfer around. But thanks to lockdown I ended up doing it by hand. Looks better than expected!


Kind regards,
Max

Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: futurist on June 13, 2020, 03:42:50 PM
Thanks Max, I'll go with USB power and won't bother with batteries

How did you cut hole for the display? Turned out very nice
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on June 13, 2020, 04:26:50 PM
Thank you!

I used a dremel to cut a first window, leaving around 3mm to 5mm on each side. And then filed, filed, filed. First with a rough one, to remove the material, then took it with a finer to the final dimensions.  Finished with 800 grit sand paper to break the edges.
Finally, if you have no chamfer you might want to paint that "vertical inner" surface of the hole in black. then it doesn't look as thick (I forgot to do it...). Material thickness is 3mm btw.

Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Mads Barnkob on June 22, 2020, 10:21:15 AM
It seems like mouser is the best bet to get the parts from the same place, at least for me.

But I can not get the 5.0" 800x480 version of the display, only if I take the 7.0" can I get that resolution. Would that work?

The Tiva kit seems to be the same price everywhere.

I like the screw fibre optic transmitters and receivers, so thought about trying out these broadcom ones, not cheap, but not SUPER expensive either. Mouser does not sell the IF-D97 / IF-E97 anymore :(

 [ Invalid Attachment ]
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on June 22, 2020, 11:02:24 AM
Hello Mads,
 
 
Yes, Tiva is pretty much the same price everywhere. Except that in the TI store you don‘t pay taxes. Don‘t ask me why. And it passed customs with no problems either. This however only makes sense if you order >2 boards.

I like the screw fibre optic transmitters and receivers, so thought about trying out these broadcom ones, not cheap, but not SUPER expensive either. Mouser does not sell the IF-D97 / IF-E97 anymore :(
What a bummer. I haven't seen them anywhere else. Or at least not for <10$.

Oh I didn't know Mouser has Nextion displays - or at least a few of them. As long as your display is a genuine Nextion one (seems to be the case) and has a resolution of 800x480 it should work almost (!) out of the box. You have to open the Nextion file in the editor and change the device to your model. Since the resolution is the same, no other changes are necessary.
You‘re right, Mouser doesn‘t have the 5 inch version. The 7 inch version is from the "Enhanced" series (instead of the "Basic" series) which offers a few more features and costs ~20$ more. If you really want to get it as soon as possible no worries, AFAIK it will work just fine. Just know that those features (like GPIO pins or a RTC clock) are useless since the firmware is written for the "Basic" version which doesn't have them.
Otherwise I would recommend to order the display directly from the manufacturer. Saves you ~20$ for the 7inch or ~30$ for the 5inch display.
The Nextion Touch display can only be ordered from their site: https://www.itead.cc/nextion-nx8048t050.html (https://www.itead.cc/nextion-nx8048t050.html)
You can find them on ebay, however that are incompatible twins - always. They look the same but they're only meant for the chinese market and can't be easily programmed.
[...]
Edit 2: You could actually buy the 7inch model (65€) instead of the 5inch one (56€). Both have the exact same resolution, therefore no changes to the GUI are needed. Depends on whether you prefer bigger buttons and fonts or a more compact interrupter  :)


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Mads Barnkob on June 22, 2020, 12:33:51 PM
I was also pretty sure I had read somewhere in the thread that you said the 7" would be usable as well. So I searched for "display" and 7", but did not find it, because you wrote 7inch :)

I will try it out with the 7" and just get it all from mouser for making it easier for myself. It is after all the opto parts that make up the biggest part of it anyway. Unless I find a cheaper alternative, not ordering right away :)
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: AstRii on July 02, 2020, 05:34:23 PM
Looks so nice, great work!
I would love to build one, but before i go and buy the components i have a couple of questions.

I can't see a reason why not, but just to be sure, can you use a software like FL Studio to send the MIDI data to the interrupter? Or what software would you recommend?

You said the output pins from the board to the optical TX are 3.3V @2mA, so i guess i also need some transistors to switch the 100mA OPF1412T right?
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on July 02, 2020, 07:04:55 PM
Thank you very much AstRii!


I can't see a reason either :) You can try it out before building one. Install the program "loopmidi" (Details in the first post. Maybe use CTRL-F to find it quickly) and check if FL Studio finds the virtual MIDI port.

You're right, the pins can only provide 2mA. In further revisions I might be able to increase it to 8mA, but not sure. So yes, you definetly need a driving transistor.


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: AstRii on July 02, 2020, 11:17:48 PM
Ok i checked, FL Studio does recognize the virtual port. So i just bought the components from the links you provided. Can't wait for them to arrive :)
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on July 04, 2020, 12:17:47 AM
Good evening,


I released a new beta firmware. I won't be able to do any testing for a couple weeks but since there are no "safety relevant" changes, I see no risk in using it with a tesla coil. The only thing I do not know is if the new features work as expected.

The most important changes are support for MIDI "Expressions" and custom pitch bend ranges. Expressions are used for nuances, like crescendos (increase in volume). Some pieces set a custom pitch bend range f.ex. to perform larger "sweeps". Until now this sounded awful and made the file or at least parts of it completely unusable.
Of course, the additionnal MIDI UART is part of this release, too (see previous post (https://highvoltageforum.net/index.php?topic=1020.msg7796#msg7796)).

As always, the details are listed on the GitHub release page (https://github.com/MMMZZZZ/Syntherrupter/releases/tag/v3.1.0-beta.1).

@AstRii: Looking forward to your experiences with FL studio!  :D


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on July 09, 2020, 09:09:08 PM
Good evening,


As I said in my last post I currently do not have access to my interrupter, so I couldn't test anything. However, I found a spare Tiva LaunchPad so I can at least test with speakers.

First of all, the untested beta I released with the last post contains some dumb copy paste errors making it useless. I hope I fixed all of them by now (still can't test the MIDI input).
Just to be clear, the latest stable release is absolutely fine and contains none of those errors.

Now the interesting part. I added a new feature, stereo sound! You can place each coil with a slider between "left" and "right". If the MIDI file uses the pan command you can hear how the sound moves from left to right or vice versa. When testing it (with speakers), I liked it so much I wanted to build a second DRSSTC to get that effect  ;D Ok, admittedly it is not better than normal stereo but still. Imagine up to 6 coils in a row and a "wave" of music going through them.
You can disable it if you want. In that case the coil ignores the "position" of the sound. This is the power on default.
Picture of the new menu with the slider:


While playing around with the code I found that pitch bend is actually not that smooth at all. I never really noticed it, but with the latest changes it got worse for some reasons. I realized quite soon that the way I generate the output signals was absolutely not "pitch bend friendly". So I rewrote it in parts and pitch bend is now as smooth as it can be. I think I managed to get an overall better sound quality but especially with many voices (and I mean full 8 voices on all 6 outputs) it may sound a bit worse in some cases. Shouldn't be a big issue though.

Since I tested it as good as I could I released a new beta. It still has the beta status because the MIDI UART is untested. As I said way back, I have no possibilities to test it. Other than that I'd consider it safe to use.
All details on the GitHub release page (https://github.com/MMMZZZZ/Syntherrupter/releases/tag/v3.1.0-beta.2).


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: TMaxElectronics on July 13, 2020, 01:20:59 AM
Quote
Ok i checked, FL Studio does recognize the virtual port. So i just bought the components from the links you provided

I just tried my Synth with FL studio and ran into a problem:
When playing midi with the default settings, the notes are off beat (in a random direction for each note), but that can be solved by switching Settings -> Audio -> Playback tracking to "Driver"
After that I have yet to find any issues.

Just thought I'd put this out there in case anybody else has that issue (i tried things for probably an hour to figure this out :P)
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on July 14, 2020, 12:03:47 AM
Good evening,


There was one last thing left that allows a very easy and important optimization. Since the first v3.x.x release I re-calculated all notes for every single MIDI command - even if only a single note was affected. This of course is horribly inefficient since up to 47 notes are processed in vain. With the latest beta I finally fixed this and guess what - it made a big difference ;D

6 outputs with 8 notes each? Easy, no problem. Tons of CPU time left. So why not ... increase the note limit to 16. Yes, that's right, it is now possible to play 16 notes on each of the 6 outputs. However, this doesn't mean that 16 notes on each output make sense... Take your usual duty limit of 10%. That leaves only 0.6% duty for each note, or in other words: almost nothing. However, if you have a robust DRSSTC or even a SSTC which could handle 50% duty, the 16 notes could be useful.
Since the useful voice limit might be different for each coil, you can now set your own limit - ranging from 1 to 16 - under Settings -> Coil Settings.
Oh, and a higher number of outputs no more means noisier music. ;)

Details and Firmware as always on GitHub (https://github.com/MMMZZZZ/Syntherrupter/releases/tag/v3.1.0-beta.3)

In the next days I'll try to upload a video demonstrating 6 outputs with stereo.


Kind regards,
Max Zuidberg
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on July 15, 2020, 09:35:15 PM
Finally some videos!

First video demonstrates "normal" stereo operation. The MIDI file had plenty of pan commands, letting the voices bounce around from left to right. The 6 outputs were configured to be evenly spread across the "left-right"-range. The resistors are there to connect the 6 outputs to the left and right audio input of my PC so that I can record the result in stereo.

While this is already quite fun to play with, you're actually a bit limited; many MIDI files do not play with stereo effects. Most of them simply place each channel somewhere around the center and that's it. To get those nice stereo effects without too much MIDI editing, I added some non-registered parameters (basically MIDI commands that are used to configure any configurable parameter of your synth. It's no more than "set ADDRESS to DATA"). These allow to map - for each MIDI channel - a note range to a stereo range. F.ex. the well known guitar in Thunderstruck plays notes from 59 (B4) to 71 (B5). This is my input range. Now I can define where those notes will end up. If I want them to play in the left half I set the output range to be 0-63. To play them in the right half the range needs to be 64-127. If you want the highest note on the left, and the lowest note on the right, you simply swap the range limits and set it to 127-0 instead of 0-127.
Note: Do not confuse this with the coil positions that you can configure on the touch display. Those positions define where each output "listens". What I discussed here is where the notes will appear. Both are independant from each other.

I wanted to upload a third video, demonstrating how a "rich" MIDI plays with 6 outputs, loading the interrupter with about 25 simultaneous voices. Unfortunately I goofed up the audio so I'll have to do that again.

If you want to use the stereo features described above, here are the non-registered parameters you need. If this is the first time you hear "non-registered parameter" you may want to check this tutorial: https://www.recordingblogs.com/wiki/midi-registered-parameter-number-rpn (https://www.recordingblogs.com/wiki/midi-registered-parameter-number-rpn)
Parameter Function  NRP Number (Coarse)  NRP Number (Fine)  Data Entry (Coarse)  Data Entry (Fine)
Mode  42  0  X (don't care)  0=Mapping off,
  1=Mapping on,
  2=Omni Mode
Input range  42  1  Upper End (0-127)  Lower End (0-127)
Output range  42  2  Upper End (0-127)  Lower End (0-127)
Mapping the note range 59-71 to the stereo range 0-127 on channel 10 looks like this (in SynthFont):


I attached the modified MIDI file used in the second video. Channels 3, 4 and 10 were modified and passed to the interrupter. Since NRPs are manufacturer-specific, and since I chose a range that's not used AFAIK, the modified MIDI will play perfectly normal on any other synth or interrupter. The original file can be found here: https://bitmidi.com/acdc-thunderstruck-k-mid (https://bitmidi.com/acdc-thunderstruck-k-mid)

Edit: Finished the two missing features (NRP reset and omni mode) and released it as v3.1.0-beta.4 (https://github.com/MMMZZZZ/Syntherrupter/releases/tag/v3.1.0-beta.4).

Edit2: If you wonder what that omni mode does, here's again Thunderstruck but this time with one channel in omni mode ;)

Edit3: fixed NRP table


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: futurist on July 18, 2020, 09:37:00 AM
Hi Max

Can't wait to test new features :D

I finally managed to finish mechanical part, now I have to wire everything
How do you connect 1414T transmitters (to what pins, how large is the resistor)?
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on July 18, 2020, 11:42:49 AM
Hello futurist,


Congrats to the mechanical part. I‘d love to see your finished interrupter!

It‘s been quite some time since I made that little print for the transmitter. Here is what I remember:
The transmitter is just an infrared LED. Three of the four center pins are cathode, one is anode. From the datasheet I determined Vf and If which gave me a resistor value of 60Ohm when using it with 5V. Again, thats what I remember, you should check the values. Current was around 60mA so a BC546C was sufficient. This transistor has enough gain and speed for this application. Many other standard transistors should work, too. Final schematic: Resistor to 5V, Anode to resistor, cathode to collector, emitter to ground, base to a 560Ohm resistor which goes to the pin with the interrupter signal.
I use the 5V instead of the 3.3V because the 5V come directly from the USB port. The 3.3V are provided by an onboard regulator where I don‘t know how much additional current it can handle.


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: futurist on July 18, 2020, 03:06:21 PM
Thanks!

Duty cycle is very low so it could probably be powered directly from processor, but in any case I'll use external transistor
I'm little short on THT components, but I managed to find four old 2N2222 transistors, I'll post some photos later today or tomorrow
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on July 18, 2020, 03:20:16 PM
Duty cycle is low, but that doesn't help since the GPIO pins are current limited by their internal resistance (not short circuit proof AFAIK). Somewhere in the datasheet is described how the voltage drops if you draw more current than allowed. You wouldn't get much more than those 2mA and especially not the 10s of mA required to get a proper signal from the transmitter.
Therefore I'm glad you still had those transistors!  :)

Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: futurist on July 19, 2020, 05:12:49 PM
I don't have enough space to connect microusb cable to debug port, is there any way to solder individual wires without desoldering microusb socket from dev. board?

edit: where do I connect LCD?
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on July 19, 2020, 05:44:34 PM
Good evening,


@futurist:
You can see the PCB USB traces in the following documentation from TI, page 26: https://www.ti.com/lit/ug/spmu365c/spmu365c.pdf Hope this helps you.
Display connections and setup is described in the very first post of the topic, under "Replica with touch display".

Other news:
A new version of the Nextion Editor has been released (v1.61.1) which breaks the option to upgrade the Nextion firmware over USB. It's fixed in the source code but I didn't want to draw yet another beta release just for this fix.
The developper of SynthFont, the MIDI Software I'm using for years now, has offered to make SynthFont send MIDI directly to a serial port. No MIDI to USB converters, no MIDI serial bridges needed :D I really appreciate his support and initiative!


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: futurist on July 22, 2020, 12:33:12 AM
I managed to program everything but I didn't have enough time to test it on the coil
 [ Invalid Attachment ]

 [ Invalid Attachment ]

Turned out nice, can't wait for the next weekend :)
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on July 23, 2020, 02:44:14 PM
Quote from: futurist
Turned out nice
Agreed! I like those 4 transmitters in a row.
... and I didn't know that Broadcom, formerly Avago, once belonged to Agilent. Interesting how many companies are in some way connected to HP.

By chance I read about a MIDI feature called "running status", which is used by some MIDI devices to reduce the amount of bytes necessary to send. It is explained over here: http://midi.teragonaudio.com/tech/midispec/run.htm
While this is not important if connected to a computer (it's not used there since MIDI USB data rates make such tricks needless), it could be relevant for MIDI In which still operates at the slower 31250baud/s.
When reading about running status I realized that my code does not handle MIDI real time messages correctly. They would lead to missing or hanging notes. I didn't know that since I never used a MIDI program that sends them. However, i heard FL Studio does.
Support for running status and the fix for real time messages will be included in the next release.


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: davekni on July 24, 2020, 03:26:07 AM
Most of the MIDI computer files (.mid) that I've analyzed use running-status.  Perhaps that's due to some original keyboard 31250-BAUD source, or to reduce file size.  Either way, I needed to include running-status in my MIDI interpretation code to make it at all useful.  It would seem likely that some software reading .mid files and sending them real-time to a USB port wouldn't bother removing running-status.  (I have no personal experience with such USB MIDI output software.)
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: TMaxElectronics on July 24, 2020, 04:48:34 AM
the running status is something that I have personally never seen in a Midi datastream from a pc. If I understand correctly, the way that the software midi layer works on windows, is that there is a single packet for each command and it is up to the output driver to decide whether to use running status or not (don't quote me on that though, my knowledge about that is very limited).
The midi out from hairless midi serial certainly does not use the running status (at least I have never noticed), neither does the USB audio implementation that I'm using for my interrupter (though the bandwidth of that is of course quite a bit higher :P ).

@futurist
Are those four tx modules all going to be used or are they just for future expansion? I'd love to hear some of the stereo effects with more than two coils.  If it sounds cool enough I might just steal coincidentally have the same idea for my midi stick :P
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on July 25, 2020, 01:53:30 AM
Sometimes I hate it if I have new ideas... Because now I have enough stuff to release yet another beta (https://github.com/MMMZZZZ/Syntherrupter/releases/tag/v3.1.0-beta.5). Too tired to make screenshots or videos of the differences but all of them are described on the release page. The fixes I mentioned in the previous replies are of course included. However, the running status feature and the real time fix are untested since I have no devices that use these features. The other features are tested and working as expected.

@TMaxElectronics: watching you... (https://www.youtube.com/watch?v=QCOXARv6J9k&t=1m36s)

@davekni: "running status" is not part of the USB MIDI specifications (at least that's what I read on midi.org). That's probably the reason why no MIDI program sends "incomplete" packages - which is more or less what TMaxElectronics said, too. A tool like hairless MIDI serial could reintroduce it, since it is "serial" MIDI and not USB MIDI anymore, but it doesn't.
My very first MIDI interrupter was able to parse MIDI0 files. I don't know where my MIDI0 files came from, but the few I tested didn't use running status... (Bad) luck I guess.


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: futurist on July 25, 2020, 04:22:11 PM
@futurist
Are those four tx modules all going to be used or are they just for future expansion? I'd love to hear some of the stereo effects with more than two coils.  If it sounds cool enough I might just steal coincidentally have the same idea for my midi stick :P

I have two coils, medium SKM400 halfbridge and small TO-247 halfbridge, so I'll definitely try the stereo option
Friend has CM600 coil and it would be great to test all three coils, but we have to find a place to do it
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on July 28, 2020, 02:05:18 AM
It bothered me that the sliders "waste" a lot of space in the lower end of the range. Almost 10% of the range belongs to the value zero. I completely rewrote the math behind the sliders (math for a slider? yes!) and I think they work much better now. However, I have no access to an actual Nextion display; I'm limited to the simulator. Therefore it'd be great if someone* could test it and tell me, if it is easier to set values with the new version.
*actually only futurist could do it AFAIK...  ;D

Nextion source file with new sliders can be downloaded here: https://github.com/MMMZZZZ/Syntherrupter/blob/v3.1.0-better-sliders/Syntherrupter_Nextion/Syntherrupter_Nextion.HMI
The compiled Nextion file is attached below.

Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Mads Barnkob on July 28, 2020, 08:36:14 AM
Looking forward to get this put together :) I must say that the Omni-mode is what I have dreamt about for years, I am really looking forward to use that feature (and not so much that I now have to build 6 identical coils)

I have just ordered all the parts I needed from digikey, since they are the only seller of the locking screw head opto parts with a good enough price to justify the import tax.

Here is the digikey order numbers if anyone else needs them

Dev board:
296-37267-ND‎
‎EK-TM4C1294XL‎
LAUNCHPAD TM4C129X EVAL BRD

Display:
‎1597-104990606-ND‎
‎104990606‎
NEXTION ENHANCED NX8048P070-011R

Optic transmitter:
‎FB162-ND‎
‎IF-E96E‎
LED FIBER OPTIC 645NM RED

Optic receiver:
FB124-ND‎
‎IF-D95OC‎
DETECTOR PHOTOLOGIC 5 TTL
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: futurist on July 28, 2020, 01:11:56 PM
*actually only futurist could do it AFAIK...  ;D

I will, I didn't have any free time this weekend to play with the coil
I'm going on vacation Thursday and I'll try new firmware asap
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on July 29, 2020, 05:23:35 AM
Good morning!


Today I tried some MIDIs and realized that it is pretty annoying to edit the MIDI files each time. It would be useful to enable and configure the stereo note mapping directly on the Syntherrupter. So I added a new page which allows exactly this: edit NRPs and generally send any MIDI command you want. Screenshot is attached below. Haven't yet created a release.

Other ideas I'll implement sooner or later:
I'll try new firmware asap
Great! Thank you.
I'm going on vacation Thursday
Since you're currently the only one who could have played with real tesla coils, I don't like this for sure. However I hope you'll enjoy it! ;)

Looking forward to get this put together :) I must say that the Omni-mode is what I have dreamt about for years, I am really looking forward to use that feature (and not so much that I now have to build 6 identical coils)
Honestly it already works pretty well with only 4 coils. However, having played with those features myself, I have to build 6 identical tesla coils, too. One day...  ;D Maybe smaller SSTCs. Then I could even build 12 coils  8) Oooh so many ideas, so little time...


Kind regards,
Max

Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: futurist on July 29, 2020, 06:09:14 PM
I'll try new firmware asap
Great! Thank you.
I'm going on vacation Thursday
Since you're currently the only one who could have played with real tesla coils, I don't like this for sure. However I hope you'll enjoy it! ;)

By vacation I meant going home :) Now I have two tesla coils to play with
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on July 29, 2020, 10:00:44 PM
... and suddenly your post makes quite a bit more sense. ;D
Once I have the feedback for the sliders I'll throw out another beta release so that you can play with the NRP editor, too. It should make experimenting a lot easier.

While I give my best to keep the user interface as intuitive as possible I'm starting to think that I'll have to write a serious manual sooner or later... Again, any feedback is highly appreciated. Especially since you can play with the UI without buying any hardware ;)


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: futurist on August 03, 2020, 10:05:59 AM
It was quite windy these days so I couldn't test both of the coils, I played a few midis on my smaller coil
/>
Duty cycle max. 5 %, max. on-time 300 us
I'm still getting used to UI, polyphony will probably sound nicer if I increase max. duty cycle

Sliders (unfortunately youtube rotated video)
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on August 03, 2020, 04:31:04 PM
@futurist:
Thank you for the video. Unfortunately my timing is horrible: Today I finally got access to my interrupter, so I could play around with the sliders, too. Feels okay to me, but I added a rounding feature (value only increases in steps of 5 or 0.5), which gives a more "stable" feeling. How do they feel to you? Do you find it difficult to set the values you want?

You made me realize that the name "Max. Ontime/Duty" on the MIDI Live page is rather confusing, so I renamed them to "Note Ontime/Duty", which should be clearer.

Now concerning the strange behavior in your first video: I couldn't really find a combination that reproduced the behavior, therefore I'd ask you to tell me
I suspect the duty cycle limiter in combination with a rather high minimum ontime required by your coil to be the cause of the problems.

Since I was able to test everything today, I published Beta 6 (https://github.com/MMMZZZZ/Syntherrupter/releases/tag/v3.1.0-beta.6). It includes the NRP editor, and the sliders futurist already played with. Oh and I kinda verified the running status feature, and it worked as expected.


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: futurist on August 04, 2020, 10:48:35 AM
As I said I'm still getting used to UI but for now everything works nicely and it isn't difficult to set the exact values I want

You're right about min. on-time, I have 30 us min. on-time on onetesla interrupter. Do you plan to add min. on-time setting?

Can you suggest max. duty cycle and min. off-time?
Onetesla interrupter doesn't have duty cycle limiter and I didn't blow up the bridge. Here is same MIDI played with onetesla interrupter
/>
Currently I have max. on-time 300 us, min. off-time 0 us and max. duty 5 %. I'm waiting for wind and rain to stop to test it further
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on August 04, 2020, 02:08:07 PM
Hello futurist,


As I said I'm still getting used to UI but for now everything works nicely and it isn't difficult to set the exact values I want
Happy to hear that!  :D

Min ontime is planned, but as part of a more advanced feature (see https://github.com/MMMZZZZ/Syntherrupter/issues/5 (https://github.com/MMMZZZZ/Syntherrupter/issues/5)). It‘ll be interesting to get this to work with the duty cycle limiter...
This means that it will take me quite some time.

I‘d GUESS that you‘re around 20% duty. That’s a pretty common value for MIDI operation - especially with such high pitches like in Popcorn.
10% is commonly assumed to be safe for DRSSTCs, and if your peak current is not at the very edge of what your IGBTs can handle, 20% should be ok. But keep an eye on the temperatures! IGBTs, wiring, MMC and inner turn of the primary tend to get hot.
Another thing you might consider: my DRSSTC handles 25% duty without problems, but my fuses don‘t. For single phase input I have the limit at around 8%.

For the min offtime you have to watch your primary current with your oscilloscope and see how long it takes the primary current to ring down to 0 after the ontime ends. It depends on so many things that I cannot estimate it for you. It‘s like asking „at which ontime will the OCD trip“.
The purpose of the min offtime is to prevent any ontime while there‘s still current from the last one. Since two ontimes can follow each other with only microseconds inbetween, you could be hard switching at peak current otherwise. Pretty much all drivers switch „hard“ at the beginning of an ontime to get the oscillation started (and thus receive feedback).

Btw yesterday I finally found a way to test the MIDI In feature but it didn‘t work. However, I‘m not sure what‘s the reason. Looking at the serial data with my scope I don‘t recognize any MIDI commands... I‘ll let this aside for now, make some last improvements to v3.1.0 and start working on the feature mentionned above.

Edit: I attached "my" Popcorn MIDI file. Haven't found a better version yet. The only thing I modified are the MIDI Programs to use the ADSR curves I liked. For this reason you should set the Note Ontime to 1/3 or less of the coil's max ontime. If this is too low for your coil, you can increase it, but this will affect the sound (probably not much). Except for the percussion channel 9, you can pass any of the other channels to the Syntherrupter. Even all if you like.
Oh... and one thing you didn't mention in your last reply: To what value did you set the MIDI Voices limit on the "Settings->Coil Limits" page? It's the number of notes the Syntherrupter will at most play simultaneously on that coil. If you have no idea what value you should chose, 8 is a good start (and the default value I think).



Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: AstRii on August 05, 2020, 08:01:11 PM
Finally! Guys i recommend you to buy the display from mouser or some other local store, i waited for almost 3 weeks for it to arrive, but it's finally here. It works like a charm. I need to find some nice enclosure for it. Thank you Max for sharing the project with us! :)

(https://scontent-dus1-1.xx.fbcdn.net/v/t1.15752-9/117014555_290451172053492_344595119118117971_n.jpg?_nc_cat=104&_nc_sid=b96e70&_nc_ohc=JuPrZz81rkIAX90Ixjo&_nc_ht=scontent-dus1-1.xx&oh=c1257bf70b0e5cda8545dd08d1e349b7&oe=5F516AD9)
 
I tried my DRSSTC I on about 50% the power, since it's already so loud it can be heard in the whole street, soon i wanna try it on full power.


Though i think there are some glitches or maybe they are features and i didn't fully understand the GUI. I hope i can provide some further feedback soon.
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Mads Barnkob on August 06, 2020, 10:51:43 AM
Finally! Guys i recommend you to buy the display from mouser or some other local store, i waited for almost 3 weeks for it to arrive, but it's finally here. It works like a charm. I need to find some nice enclosure for it. Thank you Max for sharing the project with us! :)

(https://scontent-dus1-1.xx.fbcdn.net/v/t1.15752-9/117014555_290451172053492_344595119118117971_n.jpg?_nc_cat=104&_nc_sid=b96e70&_nc_ohc=JuPrZz81rkIAX90Ixjo&_nc_ht=scontent-dus1-1.xx&oh=c1257bf70b0e5cda8545dd08d1e349b7&oe=5F516AD9)


Did you make a output board yourself? Where you have the two optical emitters sitting.
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: AstRii on August 06, 2020, 12:59:03 PM
Hey Mads,
Yes i quickly designed it in EasyEDA. My previous interrupter was a mess, and i actually even fried it because of it. So i wanted a clean build with minimum wires, hence a PCB was born :)
I added some extra headers to connect some switches for safety and LEDs for indication.
(https://scontent-dus1-1.xx.fbcdn.net/v/t1.15752-9/117304619_242809933367198_8254849614620986566_n.png?_nc_cat=102&_nc_sid=b96e70&_nc_ohc=Kj_tdTUqZ9wAX_SHZ9B&_nc_ht=scontent-dus1-1.xx&oh=e6d4b579500bd9333a8214f482bb69a4&oe=5F507CE4)
Ordered from JLCPCB, it had arrived in a few days :)
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on August 10, 2020, 02:07:26 AM
@AstRii:
Yay, another one working (although not very hard yet  ;D )! How much work was it to synchronize the audio track with the MIDI track? Oh, and since you're using FL Studio, could you have a quick look at the hairless midi logging to confirm that FL Studio actually sends MIDI Realtime messages (and thus that the Syntherrupter is handling them correctly)? Thanks!
Cool idea with the board! If there's a lot of interest, I can try to design one, too. Probably two versions; one like yours with a header only for the interrupter signals, and one that directly connects to the LaunchPad, which would allow for a very compact design.

Last week I found out by chance that I do have all the parts to connect my Syntherrupter to the MIDI Out of my keyboard. Aaaaand it didn't work. I'll have another look at it next weekend.

From now on I'll release the binaries for all the compatible touch screens. This not only includes the more expensive ones that Mads ordered, but also the cheaper ones. What does this mean? Nextion is in fact just rebranding displays from a company called TJC and asking at least 50% more for the same modules. Of course they prevent you from flashing Nextion firmwares to TJC panels and vice versa. But they can't prevent you from using the TJC version of their editor to compile a firmware for TJC panels. Long story short, with release v3.1.0 (non-beta ;) ) I'll provide the firmwares for all of the following displays. You can now buy almost anything that sound like it could do the job ;)
Notes:
With this release I won't include the Nextion source file anymore. It was part of the release because I thought you'd need it to run the Nextion firmware in the simulator or upload it via UART. Turns out you can do this with the compiled firmware, too. Start the Nextion editor, click on "Debug" or "Upload" - depending on what you want to do, and select the .tft file you want to run/upload.

The release will be published soon; I still have to write the release notes.


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: AstRii on August 13, 2020, 02:09:13 AM
Hey,
If you find the correct MIDI tracks, it's not hard to synchronize them, unfortunately majority of downloadable tracks are totally off the correct tempo and sometimes even the notes are all wrong! I usually download a MIDI track from somewhere and the vocals from YouTube, if the MIDI track has correct tempo, then it's a matter of one minute to sync them in FL studio. If the tempo is incorrect, it can be adjusted in MIDI Editor or FL Studio itself, so it takes a couple of more minutes. Sometimes the tempo is correct yet the notes are played at the wrong time anyway, in that case i adjust the timing of each note individually and that can take few hours.
I will check the hairless MIDI as you asked, when i will run the coil again. In a few days probably (I cannot run it anytime i'd like thanks to my neighbors).
The interrupter board as a shield for the LaunchPad is such a cool idea, it's a shame that i didn't think about it when i was designing the board, it would make it so much more compact and robust.
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on August 13, 2020, 07:02:24 PM
Binaries for v3.1.0 are finally released! (https://github.com/MMMZZZZ/Syntherrupter/releases/tag/v3.1.0) I tried to put a bit of structure in the ton of changes that I made during the last weeks. I hope its understandable or helpful (best case: both!). In any case, it's worth reading IMHO.
Edit: Idiot. Forgot to mention the most important change since the last beta release: MIDI In finally works. I had yet another stupid copy paste error, that's now fixed.

@AstRii
Interesting that some MIDI files are "out of the box" synchronized with the audio version, or almost synchronized. I expected that you'd always have to adjust it note by note. This actually motivates me to try it one day...

Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: AstRii on August 14, 2020, 01:04:06 AM
It's definitely worth the try, for example Uptown Funk by Bruno Mars i downloaded online was perfectly synced. Today i also downloaded Imagine Dragons - Monster, which needed only about 10 minutes of adjusting. I'm planning to release the songs, when i will have more of them :)
Also i noticed some strange behavior of the Syntherrupter:
On this video i scoped the interrupter signal for the coil.
You can see at the start i set it up to maximum ontime of 20us (Those blue cursors on the scope are 20us apart). Which seems to be working fine, but at about 20 seconds into the video, i changed the duty cycle.
And as you can see, the ontime of 20us is no longer applied. Seems weird to me, i thought the maximum ontime there is to set the maximum limit that the coil will never exceed, even if the maximum duty cycle is high.
I thought, that when the coil has the chance(allowed duty cycle) to use the maximum ontime, it will use it, otherwise it will restrict the ontime to keep the duty cycle limited.
Yet here it seems like it totally ignores the maximum ontime and it's only focused to keep up with the duty cycle.
Am i missing something?
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on August 14, 2020, 02:12:16 AM
Good idea with the MIDIs. Actually, TMaxElectronics and I are working on a collection, too.

Considering your video: you’re not on the latest firmware; I changed the naming of the values in your video because they’re quite misleading. What you set on the MIDI Live page is the value a single note will have if it’s velocity and the channel volume, etc are at 100% (that’s why I called it „max ...“ first). But since ADSR parameters allow volumes of more than 100% those values can be exceeded. In newer firmware versions those values are called „Note Ontime“ and „Note Duty“. I‘d have to check the release notes to see in which beta I changed it. Somewhere in the last two weeks.
Why do you have two sliders? Well, the Syntherrupter will use whatever value will result in the highest ontime. Why would you want that? Explanations below.

What you thought it was is what you specify under „Settings->Coil limits“. The values on this page are the ones that wont be exceeded under any conditions. You might want to read the first post of this topic again; I rewrote it a couple weeks ago, aiming to explain this a little more. It‘s not complete, though. If you did read it and misunderstood it, I‘ll happily take suggestions on how to make it more clear.

(Here come the more in-depth explanations about what the settings and the Syntherrupter does)

Finally, let me talk about the note duty setting on the MIDI Live page (NOT the duty limit under Settings->Coil Limits!). The idea was that if you have a pulse skipping driver like UD2.9, UD+, SimpleDriver, etc, low notes could use this. High notes easily sit at around 1000Hz, where 100us already equal 10% duty. But for low notes, in the 100Hz range, 100us is nothing (1% duty). For this reason I thought it might be useful to let them play at a constant duty instead, f.ex. 5%, which would give 500us ontime at 100Hz. This will give a lot more intense streamers.
On the other side, you don‘t want high notes playing at the same duty as low notes; it makes more sense to play them at a constant ontime, especially since the ontime determines the note volume.
Combining these two things together gives us the following: low notes should play at constant duty, because constant ontime doesn‘t give intense streamers. High notes should play at constant ontime, because constant duty wouldn‘t allow intense streamers and the volume would change too much from note to note*. When should it change between both modes? Quite simple: at the point where constant ontime and constant duty would lead to the same settings. Let‘s take your example of 20us and 2.8%. We want the frequency at which 20us would give 2.8% duty. Since f * t_on = d => f = d / t_on = 2.8e-2 / 2e-5s = 1400Hz. This means that notes above 1400Hz will play with 20us ontime (leading to duties higher than 2.8%), and notes below 1400us will play at 2.8% duty (leading to ontimes higher than 20us). If you change the volume mode from Auto (what i just described) to „relative“, all notes will play at constant duty, and in „absolute“ mode all notes will play at constant ontime. Note that this button will disappear in future versions. If you look again at the math above, you might see that a duty setting of 0 implies that all notes are played at constant ontime (the crossover frequency would be 0Hz which is lower than any note), and a ontime setting of 0 implies that all notes play at the given duty value (crossover would be at infinity, which is slightly higher than most tones). Therefore a additional mode button is not required and you can leave it on auto.

Just as a reminder: everything I described in the last paragraph, about constant duties, ontimes etc happens within the range of the coil limits mentionned above. The coil limits are independent and applied at the very end of the „chain“**. The values discussed here are the starting point. Then they are multiplied with the note velocity, channel volume, channel expression, maybe stereo (all the values ranging from 0 to 1). On top of this are the time critical effects, namely ADSR and modulation. After all these effects are applied the „MIDI stuff“ is done. All commands and settings are applied; we can calculate total duty at this very moment, and, if exceeding the limit, multiply the ontime of every note gets with the same factor so that the total duty equals to the coil limit. After this the „final“ ontimes are checked against the coils max ontime limit.
All of this happens independantly for each coil.

* This is less of an issue with low notes. At higher ontimes the volume doesn‘t really increase anymore; only the sound gets „fatter“.
** I know I should draw a block diagram of the whole thing... and write a manual for it. But time...


Hope this cleared things up!
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on August 15, 2020, 12:28:18 PM
Important! Do not update to v3.1.0. Something went wrong when generating the Nextion release files; they will not work. As of now this means you won't be able to upload a working firmware again over USB. You'll have to do it via the SD card. This will change in the next release. For now, just stay on v3.1.0-beta.6

Edit: Fixed. https://github.com/MMMZZZZ/Syntherrupter/releases/tag/v3.1.1 (https://github.com/MMMZZZZ/Syntherrupter/releases/tag/v3.1.1)
I released it as new version because I changed the Tiva Firmware. As I described above it wouldn't have been possible to recover from the bad Nextion firmware by updating to a new one over USB (only via SD card) because you can't enter the update mode. With this release the microcontroller automatically enters update mode if the nextion firmware doesn't respond within 3 seconds.

Sorry for the inconvenience.
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on August 16, 2020, 05:13:19 PM
The thing that never ever should occur has occured. AstRii found a critical bug in Simple Mode that causes WAY too long output pulses. It is almost the exact same issue I had with v1.0, and that I fixed after lots of work in v1.1. Although I'm sure it was gone, it's back for some reason. Probably since v2.0.
If you drastically reduce the BPS, e.g. from 1000Hz to 100Hz, the output can go high for a whole period, meaning for miliseconds (!). Since it is a hardware bug* none of the safety measures can prevent it.

Until I get it fixed, don't use Simple Mode. MIDI Live mode generates signals in a completely different way. Therefore it can't have this bug.

* Some timer registers don't synchronize the way they should. That causes glitches when making bigger jumps which happens if you sweep quickly though a frequency range. That's why it took me so much time the first time to "fix" it (rather mitigate it). I'll replace the whole stuff by the same code I use for the MIDI Notes. That's a complete overkill but at least it's been reliable so far.


I'm very sorry for this.
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Mads Barnkob on August 17, 2020, 08:25:24 AM
The thing that never ever should occur has occured. AstRii found a critical bug in Simple Mode that causes WAY too long output pulses. It is almost the exact same issue I had with v1.0, and that I fixed after lots of work in v1.1. Although I'm sure it was gone, it's back for some reason. Probably since v2.0.
If you drastically reduce the BPS, e.g. from 1000Hz to 100Hz, the output can go high for a whole period, meaning for miliseconds (!). Since it is a hardware bug* none of the safety measures can prevent it.

Until I get it fixed, don't use Simple Mode. MIDI Live mode generates signals in a completely different way. Therefore it can't have this bug.

* Some timer registers don't synchronize the way they should. That causes glitches when making bigger jumps which happens if you sweep quickly though a frequency range. That's why it took me so much time the first time to "fix" it (rather mitigate it). I'll replace the whole stuff by the same code I use for the MIDI Notes. That's a complete overkill but at least it's been reliable so far.


I'm very sorry for this.
Max

There will always be errors in software, especially when you have such a wide range of user inputs available.

Good job keeping the development going at this pace, but always give your self some time to let it all settle. I do not know how much about software development you know, but using sprints and iterations is a great way to implement one function at a time or fix one bug at a time. The idea is to work on very small scopes, but take breaks in between to allow for bug finding/tracking

I received all my parts for the syntherupter and last night I ordered a enclosure for it, it will be pretty epic :)
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: AstRii on August 20, 2020, 01:06:00 PM
Hey guys!
I filmed a video about how to create playable MIDI files for a (DR)SSTC. Of course, i'm no musician, this is probably not a correct way of doing it, but it has worked for me to edit almost any song i wanted to be playable on an SSTC.
Max's Syntherrupter handles MIDI very well, so perhaps this can help some of you to edit songs which you wanted to play :)


 

Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on August 20, 2020, 02:02:06 PM
Thanks for the compliment!

I don‘t agree with your statement that usual DRSSTCs aren‘t able to handle multiple voices. 4 voices should be easily possible on most coils. I can only recommend you to play around. At least in MIDI Mode the safety measures are working, so there‘s no risk in playing 8 or more voices on your coil.
The reason you hear most tesla coils playing only a single voice is because there haven‘t been many polyphonic interrupters available.
Edit: The video embedded in my first post here (I Want It All) has multiple voices (around 6 I think), and the duty limit was ~10%. The ontime might not have been high enough for actual streamers, but still.

Another note considering MuseScore: it is a great source for sheets music but not so much for high quality MIDIs. The reason is that they‘re  computer generated based on the sheets and often lack nuances (every channel plays at the same, constant volume). Additionally they had to put the download function behind a paywall.
My top sources for quality MIDI files are:Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: AstRii on August 20, 2020, 04:18:31 PM
You're right, that was an understatement from me, DRSSTCs are and definitely should be able to play polyphony. That was a mistake from me. For now i only do not do polyphony since my coil can only handle low ontimes, and i don't want to push it too hard.
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: davekni on August 21, 2020, 03:25:17 AM
I ran 3-note polyphonic on my DRSSTC for a neighborhood July 4th (Independence Day) show, with one song at 4-notes.  I haven't figured out the transfer function of pulse-width to sound-impulse well enough, especially how it varies by time-proximity of pulses.  Most of the songs I tried sounded worse with 4 notes than 3.  Some were best with 2.  One item on my long list of projects is to measure sound vs. pulse width and spacing to design better polyphonic algorithms.  Probably depends heavily on coil details and ground target(s).  One-note-at-a-time always sounds good, so is the safe bet besides being simplest.
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Zipdox on August 22, 2020, 10:21:42 PM
I recommend LMMS for composing, it's free and open source: https://lmms.io/
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on August 22, 2020, 10:59:55 PM
Warning: I'm prbobaly* too tired for writing a readable, structured post.  *typos not intneded ofc.  ;D

@Mads: I completely forgot to reply to your answer, sorry. I don't follow a particular developpement strategy. When I start working I usually have a list of features I want to implement which I do one by one. When I've finished "enough" features I start with testing them. This usually means that I use them with a couple different MIDI files, and try to verify the edge cases, too. After debugging them the cycle begins with the remaining features of my todo list. If I have enough verified features together which I think you should/want to have, I create a release.
Yes there will always be bugs that I haven't noticed or things that are missing. The idea is that I get the "core" extensively tested so that I (and you) can have confidence to it. This allows me to work on more complex features that are more likely to have bugs without having to fear I'll kill someones coil. It also means that I don't have to verify each release for hours with my scope attached to it, doing all kinds of duty, pulse with, ... measurements.
And it means that it's no risk for you to try any new (beta) release; worst case: unusable, but not dangerous.
So IMO it's no big deal if there's a bug in the UI, the MIDI processing, etc. Happens. But the core really shouldn't have had one - not such a severe, frequent and known(!) one. I can't remember enough details about the verification of v2.0 to find the reason how it happened. The only thing I can say is that I didn't test Simple Mode afterwards anymore since there weren't any changes (thus no chance for me to notice it after failing to notice it in first place). With v3.0.0 MIDI Live Mode got its own, new "core" that allowed polyphony, which again was heavily tested before releasing. And at least in that case it seems like I've done my job right. No critical bugs so far, only a minor issue with the duty limiter which reduced the ontime too much.

@davekni: That's something I wanted to do, too. Please keep us updated if you have any data about the sound impulse!

What I started in the meantime is by far the biggest change to the microcontroller code I've done so far. Basically I reordered and modified everything. GitHub says: 43 files modified, 2250 new lines, 1522 lines removed (https://github.com/MMMZZZZ/Syntherrupter/compare/master...dev) so far. The funny thing: pretty much all of this happens "under the hood"; nothing you'd notice. Maybe performance will even be a little bit worse.
And why then? Well the previous structure was somewhat limited, especially not capable of running different modes at the same time (more about that below). Quite a few parts had grown to the point where they really should've been rewritten.*
Sooo what will you notice once I get this done? The critical bug in Simple Mode will be gone forever. Aaaand you can keep modes running in background by holding the Return button on the touch screen. Why would you want to keep Simple Mode running when switching to MIDI Live mode? No reason. But I have ideas for new modes that would be interesting to run in parallel f.ex. with MIDI Live Mode:
And just for the very curious people: How is this archieved? Previously each mode ran its own loop that kept the output signals for every coil up to date. While the actualy configuration of the hardware was encapsulated in a separated class, each mode had to call this class on its own and feed it with meaningful data. Since this loop is specific for each mode - and because it's a loop - it's not possible to have two modes generate output signals at the same time.
However now there's a common "core" for all modes which basically contains the polyphonic signal generation from the MIDI Live mode. Instead of being tied to MIDI Live Mode and its MIDI notes, the core presents a uniformed interface for all modes. Every mode can add or remove a tone. This separation allows that all modes can independantly of each other add tones to the common core and thus run "in parallel". Additionally this "core" runs for each coil independantly. That's most of the explanation why so much of the code base changed: migrating from "one loop per mode that handles every output" to "one loop per output that handles every mode" is like transposing a matrix. Same data but pretty much everything got a new place.

* Footnote to make this post even more unreadable: Remember when I said that you can't use direct MIDI In and MIDI over USB at the same time? That was because both UARTs ("Serials" for the Arduino fans) wrote to the same buffer. Why? because it was easier. Another "easy" thing that was not good: the whole UART hardware interfacing (interrupt handling, ...) was part of the MIDI class. All of this got replaced by a clean UART class, where each UART object has its own buffer. The MIDI class has a list of all buffers that could receive MIDI data and handles each of them independantly. No more mixing of data that doesn't belong together.


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on August 25, 2020, 01:47:53 PM
Long story short: New code is working. And I have a question.

And here's the story:
Finally my question: What radio transmitters can you recommend for the lightsabers?
So far my candidates are RFM69 and Si446x, but not sure about either one. Looking forward to hear your thoughts!

Btw. I'm seriously thinking about how I could make the Syntherrupter more affordable. The plan would be to get the cheap chinese version of the display and order only the TI microcontroller instead of the whole developpment board. The downsides: you have to order the display over a third pary firm because they're available in china itself. This makes much more sense if you order a couple of them. They'd probably be <20$ each, possibly getting the BOM costs for 1 Syntherrupter below 50$.
Programming the microcontroller wouldn't be a huge issue since it comes with its own bootloader (looks easy to integrate).
Oh, and ofc this would require the design of a custom PCB for the microcontroller... So nothing for the next weeks, but possibly for the future.


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Hydron on August 25, 2020, 03:18:21 PM
As for cheap transceivers, I would look into the ESP8266/ESP32 wifi based controllers. They are surprisingly cheap and wifi has no tesla coil issues - i've run a wifi link to a scope sitting ontop of the toroid of a running coil :)
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on August 30, 2020, 10:21:38 PM
Good evening,


@Hydron: Thank you for the suggestion! I never really considered them but they do look quite powerful! Immediately ordered a couple.

Now considering my progress over the last days... I'm getting somewhere but I still do not like it. I have the feeling that I'm very far away from "KISS" and it hasn't got easier to debug. At the moment I have some kind of overflow issue when the Syntherrupter receives A LOT of MIDI data. Haven't found the reason yet.
I thought I'd create a more powerful code base but at least for now the "new possibilities" vs "complexity, efficiency" tradeoff does not look right to me. Considering efficiency: It bugs me that I can't do more in hardware; I feel like I'm not using the full potential of my microcontroller. At the moment I'm thinking about how I could use the tons of RAM this microcontroller has (256kB)... Does anyone know some good sources about synthesizer? There must be better ways to do it than what I'm currently doing...

Long story short it will be quite a while til the next update. Therefore I updated the first post in this topic, the GitHub Readme, and the v3.1.1 release notes with a big warning at the beginning. Maybe there will be a v3.1.2 disabling simple mode - just in case. What do you think?


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on September 01, 2020, 03:56:20 PM
Admitted, that didn't take nearly as long as I thought.

What's the easies way to get rid of a bug? Rewrite from scratch. In this case I replaced the array of MIDI notes by a doubly-linked list. Note-array-related bug gone  8) (And efficiency inceased)

More interesting: I pretty much solved the issue with the audio quality. I thought I'd generate the tones in a smart way, but actually it didn't have any advantages over the most basic way to do it. Only the disadvantage of worse audio quality. Long story short: tone generation got simpler, faster, better  ;D
As TMaxElectronics commented: "now it sounds more like mine". Although you'd need at least six of those...

Since the code is stable enough to pass my MIDI torture tests, I'll verify the output signals with my scope in the next days; the final step before the next release. At least that's what I hope.

(The sceptical thoughts of the last post remain; I think quite a few things could be done better, just don't know how. But for now, we're back to "good enough" ;) )


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on September 03, 2020, 08:35:29 PM
There's that stupid forum game, "how many posts can you write without someone else posting inbetween"...  ;D Just kidding, everything is fine. Before anyone feels criticized, I really appreciate the resonance I got here! I don't know if anyone remembers v1 but look how far we've come since then. That wouldn't have happened without your input, tank you!

But wait, there's more. The actual reason for my tripple post is the release of v4.0.0 (https://github.com/MMMZZZZ/Syntherrupter/releases/tag/v4.0.0). Yes I do feel confident enough to release it. While I haven't found any new bugs, there might be a ton of them hidden in some dark corner... This code simply has not the tens of hours of testing and evolution behind itself as the old one but we'll get there.
Additionally, there's the issue with my scope... I wanted to verify the duty limiter and all I got was this. Long story short, I verified it via the average voltage function which looked like it worked correctly and actually with the brightness of the LED which is a pretty good indicator whether the duty changed or not. However I don't consider either one as truly reliable test. It looks like it works - no more, no less.

As always, the release notes contain all the changes I could remember, you should read them  :)

Edit: It helps to attach the scope pictures... Look what happens with the duty displayed in the bottom left corner. The signal is only slightly shifted such that the pulse at the left leaves the screen.

... the forum gives me an error because the pictures are ".jpeg" instead of ".jpg"? Really...? ??? Oh and, yes, when you get an error like this, anything you've written (or modified) is gone. If I'm already on this tangent, it would be nice if the forum was capable to upload pictures before posting instead of displaying "Invalid attachment" in the preview. Aaand the "(Insert Attachment x)" only inserts the text "[ attachment=x ]" without the "[ /attachment ]". After hitting "preview" it will be added at the end of your post instead (you might have seen this with some posts here, which have  or other bbcodes at the end).


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Hydron on September 04, 2020, 01:30:41 PM
I'll help break it up then :P

I wonder if the scope is looking at the duty cycle over a single period (as if it were a PWM signal) rather than the full screen, in this case probably the first full period from the left of the screen.
In the 4.7% case there is a big gap from the first pulse to the next, whereas in the 18.2% case the gap is pretty small in comparison. If the scope is looking at the width of the first pulse from the left then comparing it to the width of the following low period then you'd get wild variation in "duty cycle".
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on September 04, 2020, 03:36:02 PM
@Hydron: That makes a lot of sense! Thank you.

(Rather) quick note about ADSR: there are still two features missing (a useful editor aside). First it is not possible to define a meaningful release datapoint if the previous datapoint has already a target of 0 (that's because the calculations base on the differences between two data points). For any other datapoint this is not a big deal; its target value has already been reached with the previous point (effectively will be skipped). However a release can occur at any time. Not a big issue, just letting you know I know it's there :) The other missing thing is defining whether a datapoint is affected by the note velocity or not. Currently the velocity is handled like volume and scales the whole curve, but that's not right. Will be an easy fix though.

I thought it would be helpful to create a diagram about what n-tau actually does. Here it is. You can see how it affects the curve and clearly you can see where the datapoints are ;)
Edit: This is btw real data from Syntherrupter, read with the debugger. "None of that CGI rubbish!"


Best regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on September 07, 2020, 01:10:01 AM
Good evening,


I got my ESP8266s convinced to organize themselves in a meaningful way such that the whole lightsaber thing will be pretty much plug&play. If you want x lightsabers you buy x+1 ESP8266s and flash them with the same firmware. One of them will be connected to Syntherrupter and act as receiver, the others will be sitting in the lightsabers and send data to the receiving ESP.
You'll have to assign a number to each of the sending ESPs so that Syntherrupter can distinguish the lightsabers and that you can select which lightsaber plays on which output. To do this you connect them to Syntherrupter instead of the receiving ESP, and set the number you want. The ESP will save the value in its flash.
After this initial setup it is as easy to use them as possible. Simply power them up; order doesn't matter. They'll find each other and connect. They'll also determine themselvers whether they are sender or receiver (since only senders are connected to an IMU).

So far so good I think. There's only one "issue" I'm not sure how to solve. I'd like you to be able to flash those ESPs without downloading the Arduino IDE and the whole Arduino ESP stuff. It's not difficult but I think it's a complete overkill for flashing binaries once (bugfixes aside, those things won't need any updates since the whole data processing happens on the Tiva microcontroller).
The Arduino IDE has the option to export the binary file so I thought there must be a way to flash this binary?

In case anyone is interested, here's the Arduino source. (https://github.com/MMMZZZZ/Syntherrupter/blob/841fa3f76d02139eb81441e94bf4f4545f053a55/Syntherrupter_Lightsaber/Syntherrupter_Lightsaber.ino)
It's been a loooong time since I did Arduino stuff the last time so there're likelythings that could be done better.

Edit: Ok I found out that there‘s a Python script from Espressif (https://github.com/espressif/esptool). This is already better than the whole Arduino IDE. If someone has a better option, please tell me. Oh and if a user already has to have Python installed, I could as well write a Python script for the Nextion firmware update. Then you wouldn‘t need the Nextion Editor.


Curious to hear your thoughts!
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Mads Barnkob on September 07, 2020, 09:13:15 PM
Hey Mads,
Yes i quickly designed it in EasyEDA. My previous interrupter was a mess, and i actually even fried it because of it. So i wanted a clean build with minimum wires, hence a PCB was born :)
I added some extra headers to connect some switches for safety and LEDs for indication.
(https://scontent-dus1-1.xx.fbcdn.net/v/t1.15752-9/117304619_242809933367198_8254849614620986566_n.png?_nc_cat=102&_nc_sid=b96e70&_nc_ohc=Kj_tdTUqZ9wAX_SHZ9B&_nc_ht=scontent-dus1-1.xx&oh=e6d4b579500bd9333a8214f482bb69a4&oe=5F507CE4)
Ordered from JLCPCB, it had arrived in a few days :)

I liked this idea so much that I wanted to use it on my own controller, with some more switches between regular analog interrupters and the syntherrupter and I also added the option to turn on a buzzer for no-tesla-coil-plugged-in-testing instead of just looking at LEDs.

Any apparent errors before I etch it?

 [ Invalid Attachment ]

I will go for fiber, despite the fine work Max is doing on bringing in a ESP8266 wifi module based solution, I want to keep this controller as failure proof as possible. Which is why it will also have analogue interrupters built in.
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on September 08, 2020, 02:14:32 AM
@Mads:
For <100mA a TO220 MOSFET seems like an overkill to me...? Or are they cheaper than standard TO92 BJTs? I somewhat doubt that since you’d need the logic level version of the MOSFETs.
I don‘t really get how the SW7-12 will be wired. Jumpers on the board...?
The buzzer header is connected via resistors to 3.3V. How/where do you connect the other end of the buzzers?

The ESPs were never intended for replacing the optical outputs. The idea was that you 3D-print yourself a nice Star Wars lightsaber, put a battery, IMU, ESP8266 in it and get the well known lightsaber sound from your tesla coil(s) when moving the lightsaber.

Here‘s a first „proof of concept“ video. Sound effect isn‘t great but that aside the new mode is already well integrated and works as expected. It is possible to connect up to 4 lightsabers to Syntherrutpter.
If anyone knows a reasonable „IMU to lightsaber effect“ code, I‘d love to hear about it! Code shown in the video cam be found here (https://github.com/MMMZZZZ/Syntherrupter/blob/eeb57178cd68f227399a1c213637c8f7ce8a5142/Syntherrupter_Tiva/LSData.h#L48). It is pretty basic (ignore the stuff commented out).


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Mads Barnkob on September 08, 2020, 08:27:32 PM
@Mads:
For <100mA a TO220 MOSFET seems like an overkill to me...? Or are they cheaper than standard TO92 BJTs? I somewhat doubt that since you’d need the logic level version of the MOSFETs.
I don‘t really get how the SW7-12 will be wired. Jumpers on the board...?
The buzzer header is connected via resistors to 3.3V. How/where do you connect the other end of the buzzers?

The ESPs were never intended for replacing the optical outputs. The idea was that you 3D-print yourself a nice Star Wars lightsaber, put a battery, IMU, ESP8266 in it and get the well known lightsaber sound from your tesla coil(s) when moving the lightsaber.

Here‘s a first „proof of concept“ video. Sound effect isn‘t great but that aside the new mode is already well integrated and works as expected. It is possible to connect up to 4 lightsabers to Syntherrutpter.

I just use the same foot print for TO-220 and TO-92, they got plenty long legs to fit that width and its also to give myself some more room since I etch the boards myself, so there is no reason to go for thin as possible for me :)

The idea with SW7-12 headers is that this board just routes between the syntherrupter, the normal interrupter and the switches, so I can have it all put together with pin header plugs (to avoid that large spider web of soldered together boards). The switch would just be a NO-C-NO so the signal back to the optical board is on C and each interrupter on a NO.

The buzzer/speaker is driven along with the optical transmitter, the SW marking near it is the other end for the buzzer/speaker.

The light saber idea is brilliant! I mistook it for being a call-name for a wireless connection due to Hydron mentioning that :) 
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on September 08, 2020, 11:20:43 PM
Quote
I just use the same foot print for TO-220 and TO-92, they got plenty long legs to fit that width and its also to give myself some more room since I etch the boards myself, so there is no reason to go for thin as possible for me :)
Assumed something like that. The main reason for brining it up was that usually TO-92 pinout is CBE (SGD for MOSFET) instead of BCE/GDS for TO220.
Okay if the plugs make sense it's fine. I guess I'll have a better idea of it once you've build it.

Quote
The light saber idea is brilliant!
Remember, it's not from me but from Netzpfuscher :) But I agree 100%. I thought the same thing when he showed me his prototype.

Speaking of prototype, as my video in the last post showed, the Lightsaber feature already works. After a little bit more tweaking I thought you might want to play with it, too.
Here you go, a new beta (https://github.com/MMMZZZZ/Syntherrupter/releases/tag/v4.1.0-beta.1) to play with. Beside the lightsaber mode I also started to document (https://github.com/MMMZZZZ/Syntherrupter/tree/dev/Documentation) the whole thing. While at the beginning Syntherrupter was made of two parts plus transmitters it is getting more and more complex.  For now the documentation contains schematics, lightsaber wiring diagram, lightsaber how-to and data sheets. I'll fill it more and more and in the end it will hopefully become a useful wiki.


Best regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Mads Barnkob on September 10, 2020, 03:07:25 PM
Quote
I just use the same foot print for TO-220 and TO-92, they got plenty long legs to fit that width and its also to give myself some more room since I etch the boards myself, so there is no reason to go for thin as possible for me :)
Assumed something like that. The main reason for brining it up was that usually TO-92 pinout is CBE (SGD for MOSFET) instead of BCE/GDS for TO220.
Okay if the plugs make sense it's fine. I guess I'll have a better idea of it once you've build it.

Thanks for reminding me, I could have fooled myself in the hurry there!
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on September 21, 2020, 02:59:47 PM
Hello everyone!


Finally I created an ADSR Editor. It is not the most user friendly but it does the job. Additionnally the new ADSR structure introduced with v4.0.0 allowed an easy yet powerful extension: loops! A random example of ADSR loops can be seen here (at 08:50): https://www.youtube.com/watch?v=1p675bxQwFg&t=8m50s (https://www.youtube.com/watch?v=1p675bxQwFg&t=8m50s)
Edit: As a starting point for playing around, here are the values that (more or less) reproduce the sound from the video linked above. Note how step 3 links back to step 2, creating a loop.
Step  |  Next Step  |  Amplitude  |  Duration [ms]  |  n-tau
1
2
1.0
500
2.0
2
3
0.0
200
2.0
3
2
1.0
100
-2.0
8
8
0.0
100
2.0

Since editing envelopes with this editor is already hard enough, it would be good if you could save the curves, right? While programs 0-19 will always be the same at startup, programs 20-39 are stored in EEPROM. So you can create and save 20 custom programs. You can also edit the programs 40-63, but the changes will be gone after a reset or power cycle.

Third, minor change: increased ADSR step count to 8. Allows more complex envelopes

All of this has been released as v4.1.0-beta.2 (https://github.com/MMMZZZZ/Syntherrupter/releases/tag/v4.1.0-beta.2)

Edit 2: Just a quick reminder: you can keep MIDI Live mode running in background while you have the ADSR Editor opened. This means you can listen to your modifications without leaving the ADSR editor 8)


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Mads Barnkob on September 25, 2020, 08:26:52 PM
Forgive me for not knowing enough about MIDI or ADSR.

Is the purpose here that you can take any "simple" MIDI file with just plain notes and then these loops are added on each note or how does it really work?

I wish I had more free time on my hands, you get out revisions of the software faster than I can even get the hardware out of the box ;) (making videos out of projects does however slow down things a bit)

Keep up the great work!
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on September 26, 2020, 01:14:47 AM
Hi Mads,

I guess a simple google search would give you a faster and better answer but since you asked here I feel like I should try to explain. So MIDI is a digital format. It does not contain any analog information like waveforms. If you press a key on a keyboard it sends a "Note on" command, which contains thee informations: the channel, a number indicating what key you pressed, and a velocity that says how hard you pressed the key. That's it. If you release the key, same thing. "Note off" command, containing the note number that's turned off and how fast you released the key. So basically all the synthesizer gets during playback is when a note starts and when it ends. That's what i would call the "core" of MIDI. Almost all the other stuff is about giving the syntheziser more information about how it should form a meaningful sound. F.ex. the "Program" command tells the synth what instrument it should sound like. Program 0 is "Accoustic Grand Piano", Program 12 is "Vibraphone" etc. Again, this is just a number, not more. The actual sound still has to be generated by the synthesizer itself.
Now what are those MIDI "channels". Imagine you have not only one instrument, but 2, 3 or more. The guy with the drums doesn't want to sound like a vibraphone, right? So you have to distinguish them and that's what the "channel" indicates. Each instrument will be set to a different channel and the synthesizer will know what data belongs together and what not. So usually 1 channel is 1 independant instrument. MIDI supports up to 16 channels.

Now let's talk about ADSR. We know that the synth has to generate the sound from scratch since MIDI doesn't contain any actual sound. What characterises a sound is its amplitude and its frequencies. On an analog synth you would mix multiple waveforms together to get different harmonic content. This is what makes a piano sound different than a flute - even if both play the same note. Additionally there's the amplitude. If you look at an audio sample in a program like audacity you'll see a certain shape. Rising at the beginning, falling at the end - in very basic terms. If you zoom in closer you can see the actual sine wave(s). If you zoom out, you can see the overall "outline", called envelope. This envelope can have any form, but a very good approximation is to distinguish 4 parts: attack, decay, sustain, release. If you have no picture in your head, google is really the best option. A pic or even a short video really say more than a thousand words.
Here's an example: Think of a violin. You can play it in many different ways. If you play it with the bow, you start and stop rather slow. It is soft. However if you pick it, you get a sharper, short sound. In ADSR terms: the bow has a slow attack, that is not much higher than the sustain level, and a slow release. However the picking sound has a very fast attack, and it always drops back to 0 - rather quick, too.

Since we can't really control the harmonic content of a regular DRSSTC (the interrupter signal will always be a low duty, digital square wave), the envelope is the best option to change how the music sounds. Usually an interrupter plays a note at a constant ontime a "note on" command turns the output on, a "note off" command turns it of, no more. But as I just explained, the envelope of normal instruments is nowhere near of being constant. And that's what the ADSR feature allows you to do. Change the run of the amplitude after a "note on" or a "note off" command. You want a bit of an echo (not quite but something similar), increase the release time. The note won't stop right at the moment you release the key, but drop slowly back to 0. There're endless possibilities what shapes and patterns you can generate with this. And as I said before, I'm sure pretty much any youtube video about ADSR gives you a better idea than this ;)

Talking about fast revisions? Okay, here's another one  ;D But this time no really big news. Check out the release notes for more details: https://github.com/MMMZZZZ/Syntherrupter/releases/tag/v4.1.0-beta.3 (https://github.com/MMMZZZZ/Syntherrupter/releases/tag/v4.1.0-beta.3)
What I can reveal is that it finally allows a more realistic piano ADSR curve. Try the following if you want:
Step  |  Next Step  |  Amplitude  |  Duration [ms]  |  n-tau
1
2
2.0
15
2.0
2
3
1.0
100
2.0
3
3
0.0
8000
7.0
8
8
0.0
200
4.0


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on September 27, 2020, 12:52:36 AM
Bugfix release. Details in the notes. https://github.com/MMMZZZZ/Syntherrupter/releases/tag/v4.1.0-beta.4 (https://github.com/MMMZZZZ/Syntherrupter/releases/tag/v4.1.0-beta.4)

Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: futurist on September 27, 2020, 12:24:20 PM
Hi Max

I couldn't test the coils during summer because of the neighbors >:(, then I found a suitable place in abandoned industrial complex and I borrowed power from a guy who has a workshop there
I'm only at home at weekends, however last 4 weekends it was either rainy or windy. Yesterday I finally managed to test the interrupter on my bigger coil and I ran into a few problems

I set coil limits to 300 us and 10% PWM
I'm still not familiar with volume setting on MIDI live and I couldn't figure out what each of the option does. I changed only on-time, didn't touch note PWM setting. However changing on-time didn't behave like changing on-time on my onetesla interrupter for some reason. I didn't have enough time to bring the oscilloscope and to examine what is exactly happening

Most of the midis played sound very nice, I couldn't record all of them so here are two short clips


Some songs sound bad because of (I presume) PWM limiter, it sounded like the note is "chipped". In super mario theme it's not that bad, but it can be noticed if you listen closely

At one point the coil made loud "pop" sound and it blew the 16A fuse. I quickly tried to shut down the midi playout but I then saw that the interrupter has crashed
 [ Invalid Attachment ]

I was sure that IGBT died because of how the coil sounded when it blew the fuse, but luckily it didn't. OCD or UD+ pulse limiter probably saved the coil
Sorry for sparse write-up, ask if I forgot something  :)
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on September 27, 2020, 02:02:53 PM
Hi futurist,


Abandoned industrial complex sounds like a great testsite! Congrats!
Edit: The MIDIs do indeed sound good. They seem to be rather "simple" MIDIs, right? Tipp: Repetitive notes (without delay inbetween) are very hard to distinguish from each other when you do not use ADSR. This is especially audible at the beginning of the first video. For a start you could try program 1. Very basic, no surprises, except for that it is less loud. It also reduces the issue with the duty limiter a bit.

With 300us ontime you reach the 10% duty limit very fast - in many cases with already 1 note. That explains why the duty limiter has been active so often.
I‘m very curious to hear what you mean with „changing on-time didn‘t behave like [expected]“!
I gave my best to explain the „Note duty“ slider and what it does compared to the „Note ontime“ slider in the following post: https://highvoltageforum.net/index.php?topic=1020.msg8564#msg8564 (https://highvoltageforum.net/index.php?topic=1020.msg8564#msg8564)
hope it helps you!

I‘m very sorry for the crash you had to experience. And even more relieved that your coil survived!
Since you write you wanted to turn off the outputs - was that a reflex action or was it actually still generating an interrupt signal?
The bad news is: I’ve never seen that error code on a Nextion display nor could I find anything about it. But that might not be important, because I don’t think the Nextion display is the origin: the loud bang indicates that the Tiva microcontroller crashed. It‘s unlikely that the nextion screen caused a a true crash of the microcontroller and any „normal“ fault condition would not cause the output to stay high.

tl;dr
1. I won‘t be able to investigate the issue because I still have no test place for my tesla coil.
2. since the crash seems to have happened on the Tiva microcontroller, I suspect the external powersupply and/or the USB cable to have picked up EMI from the tesla coil.
3. Just a random thought: If your USB cable has too high resistance, it could cause the voltage to be much lower than 5V. 4x60mA for the transmitters plus 500mA for the touch screen is a decent amount of current. You should check that with you scope.

Out of curiosity: what firmware were you using?


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: futurist on September 27, 2020, 07:49:49 PM
Sorry I completely missed your post about note duty limit, makes sense now

Quote
I‘m very curious to hear what you mean with „changing on-time didn‘t behave like [expected]“!
It seems that spark length is not changing as linearly with on-time like on my old interrupter, but it could just be my personal view

Quote
Since you write you wanted to turn off the outputs - was that a reflex action or was it actually still generating an interrupt signal?
The coil continued to buzz, I panicked a little after I saw that the interrupter has crashed. I don't know why UD+ UVLO didn't trigger. All LEDs turned on, a pity I didn't record it.. very strange

I doubt it had anything to do with EMI, laptop and interrupter were far away and USB cable is short and shielded. Also I'm only using one output, so current shouldn't be a problem
I was using latest firmware

Do you think I can set duty limiter to 15-20%?

Next time I'll test two coils at once, does someone have MIDI files for playing on two coils simultaneously?
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: Max on September 27, 2020, 10:44:43 PM
Quote
Since you write you wanted to turn off the outputs - was that a reflex action or was it actually still generating an interrupt signal?
The coil continued to buzz, I panicked a little after I saw that the interrupter has crashed. I don't know why UD+ UVLO didn't trigger. All LEDs turned on, a pity I didn't record it.. very strange

I doubt it had anything to do with EMI, laptop and interrupter were far away and USB cable is short and shielded. Also I'm only using one output, so current shouldn't be a problem
I guess you're using a SMPS for the UD+? At least my Meanwell SMPS is able to maintain it's output for a few seconds even with two relais and the UD+ drawing current.
What LEDs do you mean? I can't see LEDs on your Syntherrutper so I guess you talk about those connected to the UD+? Which wouldn't be that surprising; although it's no real help either.

That's very strange indeed. Since it continued to buzz the Tiva microcontroller did obviously not crash* but then remains the question what happened.
A word about the error screen you saw. It is not part of my firmware. Its part of the Nextion bootloader, which runs my firmware. Usually you see a bootloader message only when there's no firmware, a corrupted firmware, or during a firmware update. But if the firmware has been compiled successfully and uploaded successfully, it shouldn't appear. Hence I've never seen that error, and I haven't found anything about it. I assumed that when the Tiva microcontroller crashed it sent a ton of gargabe to the Nextion, causing that one to crash, too. But since you say the microcontroller continued to operate, that makes not much sence anymore. Like the rest.

So here's the only other thing I can imagine to have happened. For some reason the Nextion screen crashed, and sent garbage to the Tiva which caused unexpected behavior. I don't see how but it's at least something I can test quite simply: send total garbage to the microcontroller and see if the output glitches or not ("fuzzing").

* Why do I think it did? The ontimes themselves are generated in hardware, meaning a timer is started that runs for the exact amount of microseconds we want. It's configured as oneshot, meaning it does this once and then stops. Additionally it's configured to set the output pin to high when it starts, and back to low when it stops. So as long as the timer module is still provided with a clock signal the ontime should definitely end after the specified amount of microseconds, not later. Once the program enables the timer, it runs completely independant. Interrupts, faults, etc they do not affect the timer in any way. Hence I thought the microcontroller crashed, because that's the only explanation I found that would stop the timer from running.
A single ontime is just a "pop" sound, but since you say it "buzzed", the microcontroller must have been actively generating new ontimes (remember, it's a oneshot timer, it has to be started by the program for every single ontime). This does not happen after a reset. This does not happen after any kind of fault condition. This only happens when it continues to run the code.

Do you think I can set duty limiter to 15-20%?
Probably yes. Here's what I'd suggest. Increase duty step by step (5 percentage point steps sounds reasonable) and keep an eye on the temperatures, maybe on the current consumption, too. As long as nothing gets too hot or fries something like the input rectifiers (or the fuses) it should be no problem to increase the duty.

Next time I'll test two coils at once, does someone have MIDI files for playing on two coils simultaneously?
Well... I posted a Popcorn MIDI (click (https://highvoltageforum.net/index.php?topic=1020.msg8493#msg8493)) in this thread and a Thunderstruck MIDI (click again (https://highvoltageforum.net/index.php?topic=1020.msg8343#msg8343)). Both have multiple channels that are suited for playing on tesla coils. I'd suggest to play around with the channels; which go better together (same coil) and which are better separated (different coils). Additionally you can even play a single track on two coils using the stereo features. F.ex. you could assign the channels with the bass line to one tesla coil, fully using the low frequencies for some pulse skipping, and the melody on the other coil, producing intense, high BPS streamers.
Just as a reminder: almost every MIDI file I have in my collections, any files I ever used for a demonstation are unmodified MIDI files from the internet. Except if you consider a change of the instrument as a modification. Nothing else is needed in 99% of the cases. Additionally I linked to a couple pages with really good MIDI files a few posts ago (click. you're welcome (https://highvoltageforum.net/index.php?topic=1020.msg8661#msg8661)). Look for anything that appeals to you and try it out. Since you don't have to modify anything, downloading and testing costs at most a few minutes. I do think that Syntherrupter makes it easy to try random MIDIs.
Admitted, the stereo features mentionned above do need a few extra commands which you have to enter with the MIDI Editor on the touch screen (proudly presented by me over here (https://highvoltageforum.net/index.php?topic=1020.msg8437#msg8437)). But even that becomes a matter of a minute at most once you've done it 2-3 times. And if you found the settings you like, you can include them at the beginning of the MIDI file for future playbacks. No idea what I'm talking about? No worries, the ACDC Thunderstruck MIDI already includes them. Just remember to enable stereo playback for both of your coils ;)


Kind regards,
Max
Title: Re: Easy to build Polyphonic MIDI Interrupter
Post by: futurist on September 28, 2020, 09:52:47 PM
I guess you're using a SMPS for the UD+? At least my Meanwell SMPS is able to maintain it's output for a few seconds even with two relais and the UD+ drawing current.
What LEDs do you mean? I can't see LEDs on your Syntherrutper so I guess you talk about those connected to the UD+? Which wouldn't be that surprising; although it's no real help either.
LEDs on UD+ and precharge controller, really strange. It all happened in a few seconds in the dark, so I didn't catch every detail. Next time I'll setup camera to record the whole test

That's very strange indeed. Since it continued to buzz the Tiva microcontroller did obviously not crash* but then remains the question what happened.
A word about the error screen you saw. It is not part of my firmware. Its part of the Nextion bootloader, which runs my firmware. Usually you see a bootloader message only when there's no firmware, a corrupted firmware, or during a firmware update. But if the firmware has been compiled successfully and uploaded successfully, it shouldn't appear. Hence I've never seen that error, and I haven't found anything about it. I assumed that when the Tiva microcontroller crashed it sent a ton of gargabe to the Nextion, causing that one to crash, too. But since you say the microcontroller continued to operate, that makes not much sence anymore. Like the rest.
I think we have to pretend it didn't happen until I test the coils again, with oscilloscope and camera to catch any problems

Do you think I can set duty limiter to 15-20%?
Probably yes. Here's what I'd suggest. Increase duty step by step (5 percentage point steps sounds reasonable) and keep an eye on the temperatures, maybe on the current consumption, too. As long as nothing gets too hot or fries something like the input rectifiers (or the fuses) it should be no problem to increase the duty.
I'm curious what was max. duty cycle with my onetesla interrupter turned to 300us max. on-time. I think I'll hook it on the oscilloscope and measure, I wouldn't be surprised that it's around 20% for MIDIs like popcorn. SKM400 halfbridge was barely warm with onetesla interrupter on max., MMC is overkill for this coil and is always stone cold. I blew few 16A fuses with the final countdown song solo part


Can't wait to test the stereo feature!
Title: Re: Syntherrupter - A Feature-rich, Polyphonic Interrupter
Post by: Max on October 12, 2020, 03:47:24 PM
As requested, Mads split this thread in two, removing AstRiis latest posts about his build. I'd ask you all to keep this thread focused on the development of Syntherrupter. Bugs, questions, features, etc.

Part of my response to AstRiis build was development related so I moved it back to here where it belongs:
I had (and have) not much time and most of it went into the wiki. However I did extend the Firmware Update Mode a bit. It is now a general purpose serial bridge. If you enter that mode, the Nextions RX/TX pins are connected straight to the USB serial port (through software though). So you can send anything you want, or debug it - whatever. Additionally the same thing can be done for the ESP. So you don‘t need a programmer for the ESP and can do it through Syntherrupter, too. Only downside: it won‘t reset automatically after a Nextion firmware update anymore. You have to do it manually but that‘s not a big issue I think. The passthrough mode works for any baud rate up to ~512kbaud/s.

The new wiki can be found here (https://github.com/MMMZZZZ/Syntherrupter/tree/dev/Documentation/Wiki). Feedback is highly welcome as always!



Kind regards,
Max
Title: Re: Syntherrupter - A Feature-rich, Polyphonic Interrupter
Post by: futurist on October 12, 2020, 08:53:51 PM
Short polyphony test - everything works great! Bad weather here for the second weekend so I can only play with small coil
It actually sounds much nicer in person, phone isn't suitable for recording such high volumes



< my new favorite DRSSTC midi






Sorry for vertical recording, this was a quick test. After 10 minutes of playing at full power secondary got pretty hot and I had to stop. Inverter and MMC barely warm, bus caps pretty hot
If I didn't mention before coil is powered with chinese 40N60 double half-bridge. It still needs tuning, otherwise my OCD LED will burn out. Settings are duty-limiter 15%, max. on-time 280 us
Title: Re: Syntherrupter - A Feature-rich, Polyphonic Interrupter
Post by: davekni on October 12, 2020, 11:11:15 PM
Sounds great!  Concerning sound recording quality, yes, in-person is always better.  For my video camera, the biggest issue isn't the high peak volume, but rather electric fields.  The build-in microphones are electret and poorly shielded.  Putting grounded aluminum-foil in front of the camera (with a hole for the lens) made a big improvement.
Title: Re: Syntherrupter - A Feature-rich, Polyphonic Interrupter
Post by: AstRii on October 12, 2020, 11:24:53 PM
Here is some low power polyphony which sounds great in my opinion.

Title: Re: Syntherrupter - A Feature-rich, Polyphonic Interrupter
Post by: Max on October 14, 2020, 04:34:43 AM
@futurist, @AstRii: Thank you for the videos! Nothing special but I liked how in AstRiis video at 02:12 the two voices sound completely independantly, as if they came from two individual coils.

New release (https://github.com/MMMZZZZ/Syntherrupter/releases/tag/v4.1.0-beta.5)! Among other things it includes dark mode! Remember to update the Nextion firmware before updating the Tiva firmware. This time it is particularly important.


Kind regards,
Max

Title: Re: Syntherrupter - A Feature-rich, Polyphonic Interrupter
Post by: Max on November 05, 2020, 01:31:56 AM
Good evening,


I spend some time to get that wiki filled. It's still nowhere near being complete but at least there's a new Getting Started Guide (https://github.com/MMMZZZZ/Syntherrupter/blob/dev/Documentation/Wiki/Getting%20Started.md#readme) among other things. I'd love to hear your feedback!

Since most of the information from the starting post is now available in the wiki I shortened that post. Much better now.

Edit 07.11.20: Documentation of the threee modes, Simple (https://github.com/MMMZZZZ/Syntherrupter/blob/dev/Documentation/Wiki/UI/Simple.md#readme), MIDI Live (https://github.com/MMMZZZZ/Syntherrupter/blob/dev/Documentation/Wiki/UI/MIDI%20Live.md#readme) and Lightsaber (https://github.com/MMMZZZZ/Syntherrupter/blob/dev/Documentation/Wiki/UI/Lightsaber.md#readme) is done. What's missing are the various settings, although they're partially documented in the Getting Started article. Hardware is mostly documented, too. All in all I'd say 50% done. If anyone reads this and finds a broken link or another issue, please open an issue on GitHub. Doesn't need to be fancy, just quickly point out what's wrong and I'll fix it asap.


Kind regards,
Max
Title: Re: Syntherrupter - A Feature-rich, Polyphonic Interrupter
Post by: Max on November 06, 2020, 07:23:42 PM
New feature!

I had a look at some videos where I tested the stereo mapping feature. The original idea was that you can visually separate the instruments/voices of a piece (= MIDI channels). However, because you're facing chords pretty often, you have not a single note moving around, but a group of notes. Hence you don't have 1 sharp position for this instrument but it's spread around. Add some more instruments and all you get is a mess. Take this video as an example:


At the very beginning you can see how the single note moves around. But as soon as the second instrument (with two notes, one at the left, one at the right) joins, nothing is clear anymore. And it only gets worse.

That's where the new stereo modes come in. They allow you to map an entire channel to the same position, instead of mapping each of its notes individually. This can be done based on the lowest, the highest, the average or the loudest note of this channel. Now that all notes of a channel land on the exact same spot you should get a clearer "image" in many cases.

I have no breadboard with LEDs at the moment (and for sure not a bunch of tesla coils) to test this feature. If anyone is interested I'll create a new beta release. FYI the NRPs needed to activate this stuff are documented here: Custom MIDI Commands (https://github.com/MMMZZZZ/Syntherrupter/blob/dev/Documentation/Wiki/Custom MIDI Commands.md#readme)

To make this feature possible I had to change the way the channels and notes are pocessed. Should be a bit more efficient now but as I said, untested.


Kind regards,
Max
Title: Re: Syntherrupter - A Feature-rich, Polyphonic Interrupter
Post by: Max on November 08, 2020, 09:05:29 PM
Since there's a decent amoun of information in the wiki I integrated a new feature: a QR code that brings you immediately to the right wiki article for the page you're currently seeing. Even better: you can get a QR code for every component on the page, linking directly to the explanation about this component. This unfortunately doesn't seem to work with every browser. Apples mobile Safari removes the link to the section and always shows the beginning of the page. There's nothing I can do about this afaik.
The QR code can be (de)activated on the Help and Info page.

Since there's not much space for a QR code, it's rather small and you may have to use the zoom of your camera (this is the case for my iPhone 8) . With zoom it works flawlessly though.

While the QR code is implemented on every page, the wiki is still not done, so the QR Code will link to more or less empty pages in some cases. The three modes (Simple, MIDI, Lightsaber) are pretty much completely documented, the settings however are still missing.

New release available: v4.1.0-beta.6 (https://github.com/MMMZZZZ/Syntherrupter/releases/tag/v4.1.0-beta.6)

Edit: Attached example screenshot


Kind regards,
Max

Title: Re: Syntherrupter - A Feature-rich, Polyphonic Interrupter
Post by: Max on November 11, 2020, 11:15:25 PM
*Keeping my thread at the top*   ;D

So I thought I‘d share this graphic I made the other day. It shows the different „layers“ of Syntheruppter and what sits on top of what. Hope it gives you a better idea about how it‘s structured under the hood.
In case someone wonders what tool I used to create that graphic: Solidworks. And no, this is not what it was made for   ::)

Kind regards,
Max

(https://raw.githubusercontent.com/MMMZZZZ/Syntherrupter/dev/Documentation/Pictures/Syntherrupter%20Structure.png)
Title: Re: Syntherrupter - A Feature-rich, Polyphonic Interrupter
Post by: Mads Barnkob on November 13, 2020, 09:53:53 PM
Nice graphics and the wiki is great, what a wealth of information you have put into that!

I flashed the Tiva without any problems, drivers and all that, just worked out of the box, literally.

However, it turns out its the "intelligence" version of the display that I have. NX8048P070-011R to be specific. So I assume that I can not use the very specific model files in the release? I also tried downloading the Nextion editor (v1.61.2) to just choose another model in the TFT file, but its not a project file and trying to run the TFT file in debug mode I just get this message "TFT file version is not supported" and another popup "invalid tft file".

Title: Re: Syntherrupter - A Feature-rich, Polyphonic Interrupter
Post by: Max on November 13, 2020, 11:29:49 PM
Thank you very much!

I flashed the Tiva without any problems, drivers and all that, just worked out of the box, literally.
Glad to hear that!

However, it turns out its the "intelligence" version of the display that I have. NX8048P070-011R to be specific. So I assume that I can not use the very specific model files in the release?
That‘s unfortunately true. Edit: Originally I thought the follwoing wouldn’t be feasible. However a quick check showed that it can be done. You can modify the source file such that it works. Some components have an additional property on the Intelligent series displays that doesn’t get a correct value automatically. Since I never expected anyone to pay the completely unecessary premium for the intelligent series I couldn‘t be bothered to do this for every series by hand.
I also tried downloading the Nextion editor (v1.61.2) to just choose another model in the TFT file, but its not a project file and trying to run the TFT file in debug mode I just get this message "TFT file version is not supported" and another popup "invalid tft file".
TFT files are like binaries, they‘ve been compiled for that specific target. You can run them (on real or virtual hardware) but you can‘t modify them.
The TFT file version error likely means that you tried to open one of the TJC... files. Any of the NX... files should at least run in the debugger (https://github.com/MMMZZZZ/Syntherrupter/blob/dev/Documentation/Wiki/Minimum%20Viable%20Setup.md#without-a-display). The thing is, while Nextion and TJC are the same hardware, all of their files are checksummed such that they are not interchangeable. TJC files can only be opened with the chinese version of the exact same editor. I can create releases for all of the displays because smart people found ways to f*ck this checksum rubbish.

Quote
*Keeping my thread at the top*   ;D
guess I can do the same :P So just a quick update:
  8)


Kind regards,
Max
Title: Re: Syntherrupter - A Feature-rich, Polyphonic Interrupter
Post by: Mads Barnkob on November 14, 2020, 12:12:31 AM
What a bummer. I should have paid closed attention to the part numbers on digikey, because they have listed them all as Enhanced series, even the Intelligence series displays. I wrote them in hope of getting a free return and get the right part due to those errors in their listings. Else im stuck with a expensive door stopper. While it is more expensive, its not by more than 15% over the enhanced series of the 7" version.

I tried opening both NX and TJC files in debug mode, same message on all the files.

Title: Re: Syntherrupter - A Feature-rich, Polyphonic Interrupter
Post by: Max on November 14, 2020, 12:14:49 AM
Aaah shit. Sorry I was too late with my edit. Turns out it is possible because unlike i thought it‘s only one component type that needs to be modified. See my edit above. Still, I think you should get a Basic or Enhanced series screen if possible.

I‘ll investigate the TFT file issue tomorrow. Maybe its a problem because I‘m still on Nextion Editor v1.61.1.


Kind regards,
Max
Title: Re: Syntherrupter - A Feature-rich, Polyphonic Interrupter
Post by: Max on November 14, 2020, 12:10:31 PM
As promised I checked the TFT file issue. Unfortunately it seems like their editor updates completely break compatibility of the simulator/debugger. You'll need the previous version v.1.61.1 which I used to create the files. The wiki article (https://github.com/MMMZZZZ/Syntherrupter/blob/dev/Documentation/Wiki/Minimum%20Viable%20Setup.md#without-a-display) is already updated with this info and the necessary download links.

Sorry for this. I didn't know about that issue and it makes my life more complicated, too.


Kind regards,
Max
Title: Re: Syntherrupter - A Feature-rich, Polyphonic Interrupter
Post by: Mads Barnkob on November 14, 2020, 01:07:47 PM
Aaah shit. Sorry I was too late with my edit. Turns out it is possible because unlike i thought it‘s only one component type that needs to be modified. See my edit above. Still, I think you should get a Basic or Enhanced series screen if possible.

I‘ll investigate the TFT file issue tomorrow. Maybe its a problem because I‘m still on Nextion Editor v1.61.1.


Kind regards,
Max

I did not find source HMI files at first glance and only thought I had the TFT files available, so panicked a bit there ;)

I changed device, compiled and updated all pic to pic1 values that turned up errors and I could compile, create TFT file, download to display and start using it. No problems! Only need to do it again for darkmode, as that now has a white front image showing up :) Looking through the code to change to darkmode, its just 4 values, but where does the slider read "Settings.colorMode.val=1"



Do not worry about making special versions for me, I guess I could upload a branch to your releases that is updated for the intelligence displays.

I am properly not going to return this, since it works, I foresee that the basic/enhanced versions is less in stock than the intelligence is, at least judging from digikey stock numbers.

I could set up all settings, change users, browse around and overall its a very nice GUI you have made. Now I just need to test my optical PCB and it should be good to go for a first test.
Title: Re: Syntherrupter - A Feature-rich, Polyphonic Interrupter
Post by: Max on November 14, 2020, 01:48:42 PM
I completely forgot about dark mode. Crap.

First of all, a separate branch is useless because Nextion is a binary format. Meaning Pull Requests/Merges won't work.

Now dark mode is a little bit hacky, because it hits a few limitations of the Nextion environment. So the way how dark mode works is that when the page loads, it checks the current color mode and sets the colors and graphics of all components. This happens by calling the fLoadColors Touch Press Event. Nextion does not know true functions but you can call press/release events of any component.
Next issue is that Nextion doesn't know "global" components (well it does, but not this way), meaning that this fLoadColors component is present on all pages and every change needs to be copied to every single page.

Since the slider on your screen has an additional property, we need to change that in the fLoadColors code, too. To do this you select the fLoadComponent somewhere in the top right corner, then in its Touch Press Event scroll down to the bottom and add the following line
Code: [Select]
b[sys0].pic1=b[sys0].pic
at the end of the last else if section:
Code: [Select]
  ...
  }else if(sys1==1)
  {
    // Types that have pic, pic2:
    // slider
    b[sys0].pic=b[sys0].pic%Settings.picCount.val
    b[sys0].pic+=sys2
    b[sys0].pic2=b[sys0].pic2%Settings.picCount.val
    b[sys0].pic2+=sys2
    b[sys0].pic1=b[sys0].pic // <= NEW LINE
  }
}

Aaaand of course repeat for all pages...

Sure you want to keep your "intelligent" screen...?

Quote
I could set up all settings, change users, browse around and overall its a very nice GUI you have made. Now I just need to test my optical PCB and it should be good to go for a first test.
Wohoo!


Kind Regards,
Max
Title: Re: Syntherrupter - A Feature-rich, Polyphonic Interrupter
Post by: Mads Barnkob on November 14, 2020, 04:31:43 PM
I just tried adding in "b[sys0].pic1=b[sys0].pic" in the latest HMI project file from you with a NX4048K070 device selected, that does not generate any compile errors. Maybe you can just leave it inthere as dead code on the basic/enhanced models and to fix dark mode for the intelligent. Perhaps you could even just do the same for the slider pic1 ID reference? I got no basic display to test it on, if that illbehaves.

Its a terrible fix settings variables that does not exist, but then again its a terrible IDE/editor that doesn't even have search and replace :D
Title: Re: Syntherrupter - A Feature-rich, Polyphonic Interrupter
Post by: Max on November 14, 2020, 05:15:46 PM
I just tried adding in "b[sys0].pic1=b[sys0].pic" in the latest HMI project file from you with a NX4048K070 device selected, that does not generate any compile errors. Maybe you can just leave it inthere as dead code on the basic/enhanced models and to fix dark mode for the intelligent. Perhaps you could even just do the same for the slider pic1 ID reference? I got no basic display to test it on, if that illbehaves.
The reason it doesn't give errors is because the array based addressing of components doesn't contain any checks whether that attribute even exists or not. However, during runtime it will generate an error message over serial (which you can see it in the debugger, too). The Tiva firmware ignores those errors, making it in theory possible to go for this "solution". However, I am by no means a fan of deliberately introducing errors into my firmware. And there are some reports that runtime error handling costs quite a bit of processing time on Nextion, so it might even slow down the page loading times (which wouldn't be noticeable in the debugger).
The "proper" way to do it would be to set pic1 only if the device is an intelligent screen, but this requires modifications on the Tiva side, too. The reason is that there's no command or system variable that would allow the Nextion firmware to find out the model it's running on. It can only be requested over serial as part of the firmware update protocol (without having to initiate an update though). So the Tiva would have to send the command, parse the return data for the version, and then set a variable on Nextion to allow or disallow the assignment. Sounds funny, right? ;D

Its a terrible fix settings variables that does not exist, but then again its a terrible IDE/editor that doesn't even have search and replace :D
You don't even want to know what's necessary to get a decent UI on these things...  ::) If you look through some of the code and it hurts your eyes, it's not because I'm an idiot (well, not always) but because there's no elegant way to do it. It's somewhat similar to Arduino. Very easy to start and get basic things done. Even some advanced stuff works right out of the box. But if you want something custom and/or more performant it gets messy. quickly. One significant difference though: with arduino you're not forced to use the Arduino Methods, you can use your own functions, access registers, etc. Here you can't.

Syntherrupter is hitting Nextions limits on multiple occasions but there are no ready-to-use alternatives I'm aware of. Hence the plan (for the far, far future) is to leave the Tiva dev board and the Nextion screen behind and switch to an STM32F7 + normal touch display. Has a lot of advantages but will be much harder to get started and definetly require a custom PCB with SMD stuff.
The Nextion Intelligent screens are no alternative for me because they still have all of the limitations of the Nextion language. Additionally this would make the minimum viable setup of Syntherrupter even more expensive than it already is or than it would be with the STM32F7.


Kind regards,
Max
Title: Re: Syntherrupter - A Feature-rich, Polyphonic Interrupter
Post by: Mads Barnkob on November 14, 2020, 08:32:44 PM
It was just a quick thought and only just tried to compile it. I know its a shitty solution :) But as you clearly states, there is more to it than that, so just scrap getting it compatible with a expensive and erroneous bought display.

While a STM32F7 platform might be "better", there is still a good deal of greener grass to that tale. I have worked with the STM32F746G-DISCO, the Discovery devkit that was a great bargain for a devkit with a touch screen piggybacked on it. But the software is complex to set up as you say and the HMI editor is somewhat better but still in a league of FAR FROM where other GUI building tools are in "modern" age. I have built displays on unix systems from the 90s that was more intuitive, user friendly and easier to start out on.

Enough with the ranting! I will keep the intelligent display as long as it works and changing 10 sliders and 16 pages is not a big deal, I can just jump some of the beta versions ;)
Title: Re: Syntherrupter - A Feature-rich, Polyphonic Interrupter
Post by: Max on November 17, 2020, 03:22:38 PM
@Mads: Urks - more bad news... Do you know by chance whether lvgl is a viable alternative?

Since I have currently no new features that I'm working on, I made a very small update that fixes a bug introduced with the last release. Details as always in the notes. https://github.com/MMMZZZZ/Syntherrupter/releases/tag/v4.1.0-beta.7
TBH I hadn't much time for extensive testing. So there may still be other MIDI bugs. Let me know if you find any!


Kind regards,
Max
Title: Re: Syntherrupter - A Feature-rich, Polyphonic Interrupter
Post by: Mads Barnkob on November 17, 2020, 08:43:47 PM
@Mads: Urks - more bad news... Do you know by chance whether lvgl is a viable alternative?

I did not know about that one, so I got nothing to say about that :)

Since I have currently no new features that I'm working on, I made a very small update that fixes a bug introduced with the last release. Details as always in the notes. https://github.com/MMMZZZZ/Syntherrupter/releases/tag/v4.1.0-beta.7
TBH I hadn't much time for extensive testing. So there may still be other MIDI bugs. Let me know if you find any!

Kind regards,
Max

I ran upon that in simple mode, with standard settings of 200us, 1000Hz and 10% dc limit, I can play with the us/Hz sliders in a way so that dc says 10% on the display, but only 7.3% on the oscilloscope measuring the output. I am not sure if this has to do with the settings for minimum off time?

This does however only seem to happen if changes are done fast, properly too fast for TIVA and Nextion to communicate properly?
Title: Re: Syntherrupter - A Feature-rich, Polyphonic Interrupter
Post by: Max on November 17, 2020, 10:50:21 PM
Interesting issue. I have not been able to reproduce this on my own. I should probably say that I didn‘t verify he output signal with a scope. I looked at the data with the debugger - at core level (see my graphic above). Highly unlikely that those values don‘t match what‘s actually on the ouput.
Even when I move the slider very fast for a couple seconds, everything is fine; the tones send to the core match the values on the screen. For 1 coil as well as for 6 coils.
There‘s one crucial difference between your setup and mine: your Nextion display has a 200MHz CPU, mine has a 48MHz CPU. Yours likely fires those serial commands much faster than mine - possibly too fast as you suspected. To test this hypothesis I attached a modified Tiva firmware with a bigger receive buffer size.

While testing this I noticed another bug related to dark mode. Actually not a bug of mine but one of Nextion. When switching to dark mode, hiding components doesn‘t work anymore because it always overdraws the component with the original background color - white. So I have to manually draw a rectangle in the correct color every time I hide a component... Even this is only half of the problem; the flickering remains, because Nextion draws a white rectangle before I can overdraw it with the righ color. I have to check whether I‘ll find a workaround for this, too.

Finally, while I investigated Nextions issues I found a couple minor oopsies of mine, too. The QR code was supposed to have a lighter color in dark mode for better contrast and the position of the Manual/Apply buttons in Lightsaber mode didn‘t match the positions in the other two modes. Both things are now fixed and will be available soon.

Edit: Attachment fixed. somehow it shrunk to 0kb during the upload..


Kind regards,
Max
SimplePortal 2.3.6 © 2008-2014, SimplePortal