Author Topic: Easy to build Polyphonic MIDI Interrupter  (Read 1112 times)

Offline Max

  • High Voltage Enthusiast
  • *
  • Posts: 41
  • Karma: +3/-0
    • View Profile
Easy to build Polyphonic MIDI Interrupter
« on: April 04, 2020, 09:35:28 PM »
Good evening everyone,


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.

I would like to introduce you to my polyphonic MIDI interrupter, which I gave the fabulous name "Syntherrupter". You can hear it here, demonstrating pretty much all of its MIDI features:
(Pics of the interrupter itself are below)

Motivation
Netzpfuscher's UD3 has awesome functions, but is still in intensive development, lacks some documentation, and would make my existing driver (UD+) obsolete. In the long run I will surely switch to it, but until then I wanted to have a proper MIDI interrupter instead of my previous tinkering solution. There are not so many clever MIDI interrupters out there; the most common is probably from Onetesla, but it is rather basic. I wanted to end up with something that is closer to the features of the UD3, works with any normal DRSSTC driver and is easy to build.
For this one you'll need a PC and 20€ (or more if wanted ;) ).  It is almost a single board solution.

Key features
  • A unique and truly awesome name: Syntherrupter. ;D
  • Up to 8 voice polyphony including effects like pitch bend, modulation and different "instruments". Yes, you can - within limits - change how your coil sounds.
  • Control up to 6 independant tesla coils with only one interrupter. And yes, each output can play different notes. Simply select which output should listen to which MIDI channel
  • Set and change hard limits for each coil. They will be stored even when powered off
  • Different users with different limits. This is useful if you want to rent the coil to someone else who does not know the coils (thermal?) limits as well as you do.
  • Sounds boring, but for me it belongs to an interrupter as well: Normal interrupter mode where you can control the ontime, BPS and duty. Your settings
Material, costs, build your own
I provide the complete source code and ready to use binaries including the user interface and am happy if someone can use it. The core of the interrupter is the 20€ TI Tiva TM4C1294XL Connected Launchpad.
The graphical user interface runs either on a Nextion touch display or on the PC. In both cases the communication with the Tiva microcontroller is done via a serial interface.
  • Replica with touch display (=standalone interrupter):
    Material:Procedure:
    • Flashing the microcontroller: Read the notes, then download and unzip the latest binaries from the GitHub Release Page. Download the Tiva drivers and flash tool. On the Tiva LaunchPad, set the "Power Select" jumper to ICDI and the two CAN/UART jumpers to UART. Connect Tiva LaunchPad to the PC via its DEBUG USB port. One or more unknown "ICDI" devices appear in the Device Manager. Right click on one of them, choose update the drivers, search on the PC, and select "stellaris_icdi_drivers" from the previously downloaded folder. Repeat for all other unknown "ICDI" devices. Then install and open LM Flash Programmer (also from the downloaded folder). In the tab "Configuration" under "Quick Set" select the LaunchPad ("TM4C1294XL LaunchPad"). In the tab "Program" select the .bin file from the unzipped folder and check the following under options: "Erase Entire Flash", "Verify After Program", "Reset MCU After Program". Then click on "Program" below to download the program to the microcontroller.
    • First time flashing of the Nextion touch display: Copy the compiled .tft file from the "Nextion_GUI" folder of the git to a micro-SD card, insert it into the display, switch on, wait, switch off, remove card, done. For later updates you can do the update over USB (see GitHub release notes for details).
    • Connecting Nextion and Tiva: Blue on PA4, yellow on PA5, red on +5V, black on GND (all 4 pins are in the pin header of the Ethernet connection).
    • Output signal is active high, 3.3V, 2mA max. Output pins are:
          Coil 1: PD0
          Coil 2: PD2
          Coil 3: PM0
          Coil 4: PM2
          Coil 5: PM4
          Coil 6: PM6
  • Replica without touch display:
    Material:Procedure:
    • Flashing the microcontroller: see previous point, replica with touch display.
    • For the user interface: Instead of the touch display, the Nextion program can also run in the corresponding development environment "Nextion Editor" (Download). Download the HMI file from the "Nextion_GUI" folder of the git repository, open it with the Nextion Editor and click on "Debug". The user interface starts and can be operated by mouse. At the bottom of the debugger window you can select the COM port (of the serial-to-USB converter) after switching to "MCU Input". Set the baud rate to 115200. PA4 and PA5 are the corresponding RX and TX connectors on the microcontroller (pin header close to the Ethernet connection).
    • Output signal: see previous point, replica with touch display.
Optional (I used):
In my case it looks like this (still without powerbank). Note: This was firmware v1.0, which lacked many of todays features and was in german. But it is still good enough to get an idea of how it looks ;) Note2: There were very bright lights above the table. In reality the display is bright enough for outdoor use.




MIDI Setup on the notebook:
Open and play MIDI files with SynthFont (for good sound quality: download the SGMv2.01-Sal-Guitar-Bass-v1.3 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).
To send MIDI data with a serial port you need Hairless MIDI<->Serial. Baudrate is 115200.
Since both applications want to communicate with an existing MIDI device we need to create a virtual one that connects them. loopMIDI is perfect for this purpose.


Syntherrupter functions
While I gave my best to design the GUI to be self-explanatory, I think a complete documentation is always a good idea.
  • Startup
    On startup the display stays dark until all settings have been loaded from the EEPROM. This normally takes less than a second. If no settings could be found, a warning is displayed. This is the case when you power it up for the first time, or if a new firmware with incompatible EEPROM usage was installed. If the display gets stuck on that black start screen this indicates a problem with the serial connection between the Nextion display and the Tiva microcontroller.
  • Optional User management
    You can log in to three different users, internally called "user 0", "user 1", "user 2". Privileges increase with the user number; user 2 can do anything the Syntherrupter is capable of.
    • Why...?
      User 2 should be clear: do anything you want. But why would you limit these rights...?
      I "share" my coil with some great people who paid most of the material. Although they are very responsible, they cannot know or remember all details and limits. This explains user 1: a powerful, yet safe user mode (details about the exact rights below).
      Then there's user 0. This was meant for complete strangers (f.ex. on a live show) that have no idea what they are doing. Enter this mode and nothing can go wrong.
    • Features
      Auto login: Since most people do not need user management, you can automatically log in to one of the three users by setting its password to "0". Don't worry, you can switch to another user from the menu.
      Each user has a name, a password, and the limits within which he can operate. All of these can be changed at runtime; most of them only by a higher priviledged user.
      User names can be 1-16 characters long. A (almost) fully features keyboard is included.
      User passwords can be 1-16 characters. While you could enter any character you want, remeber you only have a keypad on the login page. So maybe stick with numbers... If you entered a wrong character you can change it as long as you don't log out.
    • User restrictions
      RightsUser 0User 1User 2
      Enter Firmware Update ModeNoNoYes
      View or change coil limitsNoNoYes
      View user 0 name, password, ontime BPS duty limitsYesYesYes
      Change user 0 name, password, ontime BPS duty limitsNoYesYes
      View user 1 name, password, ontime BPS duty limitsNoYesYes
      Change user 1 name, passwordNoYesYes
      Change user 1 ontime, BPS, duty limitsNoNoYes
      View or change user 2 name, password, BPS limitNoNoYes
      View or change user 2 ontime and duty limitsNoNoAutomatically set to highest coil limit.
      Anything else can be done by all users.
  • General safety features
    To help to reduce the amount of magic smoke necessary to operate the Syntherrupter, the following features were added:
    Hitting the white background turns off all outputs. In case something goes wrong you do not have to select outputs, moves slider and hold your tongue at the right angle.
    Leaving a mode turns off the outputs, too.
    Whatever you entered as settings (User limits, ADSR, etc), your coil limits will never be exceeded.
  • User limits
    The user limits set the range of the sliders in the user interface. In Simple mode those values can't be exceeded, in MIDI Live mode however, things are a bit different. The BPS limit is completely ignored. Notes will be played as high as the MIDI file says, and as many together as possible. The duty limit and the ontime limit only apply to single notes and add up for each additional note, and there are other things that make MIDI mode exceed these settings. More about that below.
  • Coil limits
    Other than the user limits, the coil limits are hard limits, that are never exceeded. No matter how many notes you play. While ontime and duty limit are obvious, maybe a note about the minimum offtime: When playing more than one note together, it is possible that the ontime from one note immediately follows the ontime of the other note (effect can be seen below). In that case your primary current would still be pretty high, and since all DRSSTC drivers switch hard with the rising edge of the interrupt signal, you could blow up your bridge. The minimum offtime assures that after any ontime in Midi Live mode, the output stays low for at least the given value. In Simple mode this is automatically assured because of the duty cycle; it would only become an issue for duty cycles higher than 50%.
  • Other settings
    Setting the standby delay to 0:00 disables standby. More documentation follows, but really, the it is self-explanatory.
  • Applying values
    Settings are applied when leaving the current page. When leaving the Settings completely (returning to Menu) the EEPROM will be updated. Therefore the return button is labeled with "Save".
    In MIDI Live mode and in Simple mode settings are by default applied when releasing one of the sliders. By hitting the "On release" button, you can change this behavior to "Manually" (=only apply when you hit the "Apply now" button), or "Immediately" where it applies the values even when moving the sliders.
    When using a firmware for more than one output, you'll find buttons for each output. These can be used to select which outputs will receive the next values. Just hitting those buttons does not change or apply anything. It will only affect the next applied change.
  • Simple Mode
    Simple Mode can be used for "normal" interrupter operation, e.g. generate ontimes at a given frequency. When adjusting the sliders, it checks on the fly if you exceed any user limit (coil limits are always checked just before generating the actual signal; don't worry about them). This means that your user limits could be max ontime = 500us, max duty = 10%, max BPS = 1000Hz. At 1000Hz you can't increase the ontime slider higher than to 100us, because it would exceed your duty limit otherwise. If on the other side you have the ontime set to 400us, you can't go higher than 250BPS. And finally, at 100Hz you can't go higher than 5% duty since your ontime has to stay below 500us.
    Independant of the apply-mode (see "Applying values" above) the settings are smoothed out. Meaning you don't get BPS or ontime jumps, but a continuous transition.
  • MIDI Live Mode
    In MIDI Live Mode the Syntherrupter listens to its USB port for incoming serial MIDI commands. This is the most powerful mode, and needs a LOT more documentation. I'll update this part in the future. For now you'll find most informations in the posts below, the GitHub Readme, and the release notes.

Kind regards,
Max
« Last Edit: May 22, 2020, 04:34:26 PM by Max »

Offline Max

  • High Voltage Enthusiast
  • *
  • Posts: 41
  • Karma: +3/-0
    • View Profile
Re: Powerful easy to build MIDI Interrupter
« Reply #1 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

Offline Mads Barnkob

  • Administrator
  • High Voltage Expert
  • *****
  • Posts: 1387
  • Karma: +23/-0
  • Denmark
    • View Profile
    • Kaizer Power Electronics
Re: Powerful easy to build MIDI Interrupter
« Reply #2 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.
http://www.kaizerpowerelectronics.dk - Tesla coils, high voltage, pulse power, audio and general electronics

Offline Max

  • High Voltage Enthusiast
  • *
  • Posts: 41
  • Karma: +3/-0
    • View Profile
Re: Powerful easy to build MIDI Interrupter
« Reply #3 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

Offline Max

  • High Voltage Enthusiast
  • *
  • Posts: 41
  • Karma: +3/-0
    • View Profile
Re: Powerful easy to build MIDI Interrupter
« Reply #4 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
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.


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
« Last Edit: April 23, 2020, 09:28:12 PM by Max »

Offline futurist

  • Global Moderator
  • High Voltage Technician
  • *****
  • Posts: 134
  • Karma: +1/-0
    • View Profile
Re: Powerful easy to build MIDI Interrupter
« Reply #5 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?

Offline Max

  • High Voltage Enthusiast
  • *
  • Posts: 41
  • Karma: +3/-0
    • View Profile
Re: Powerful easy to build MIDI Interrupter
« Reply #6 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
« Last Edit: April 24, 2020, 02:21:47 PM by Max »

Offline Netzpfuscher

  • High Voltage Technician
  • ***
  • Posts: 103
  • Karma: +5/-0
    • View Profile
Re: Powerful easy to build MIDI Interrupter
« Reply #7 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.
« Last Edit: April 24, 2020, 04:57:58 PM by Netzpfuscher »

Offline Uspring

  • High Voltage Technician
  • ***
  • Posts: 160
  • Karma: +10/-0
  • Physicist
    • View Profile
Re: Powerful easy to build MIDI Interrupter
« Reply #8 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.

Offline futurist

  • Global Moderator
  • High Voltage Technician
  • *****
  • Posts: 134
  • Karma: +1/-0
    • View Profile
Re: Powerful easy to build MIDI Interrupter
« Reply #9 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



Offline Max

  • High Voltage Enthusiast
  • *
  • Posts: 41
  • Karma: +3/-0
    • View Profile
Re: Powerful easy to build MIDI Interrupter
« Reply #10 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.

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
« Last Edit: April 26, 2020, 04:56:22 PM by Max »

Offline Max

  • High Voltage Enthusiast
  • *
  • Posts: 41
  • Karma: +3/-0
    • View Profile
Re: Powerful easy to build MIDI Interrupter
« Reply #11 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:


Page for the user settings:


A new keyboard...


And brightness control


MIDI Live Mode when configured to three coils only:

Offline Max

  • High Voltage Enthusiast
  • *
  • Posts: 41
  • Karma: +3/-0
    • View Profile
Re: Powerful easy to build MIDI Interrupter
« Reply #12 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.
  • 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...

Kind regards,
Max

Offline Mads Barnkob

  • Administrator
  • High Voltage Expert
  • *****
  • Posts: 1387
  • Karma: +23/-0
  • Denmark
    • View Profile
    • Kaizer Power Electronics
Re: Powerful easy to build MIDI Interrupter
« Reply #13 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.
http://www.kaizerpowerelectronics.dk - Tesla coils, high voltage, pulse power, audio and general electronics

Offline Max

  • High Voltage Enthusiast
  • *
  • Posts: 41
  • Karma: +3/-0
    • View Profile
Re: Powerful easy to build MIDI Interrupter
« Reply #14 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 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

Offline futurist

  • Global Moderator
  • High Voltage Technician
  • *****
  • Posts: 134
  • Karma: +1/-0
    • View Profile
Re: Powerful easy to build MIDI Interrupter
« Reply #15 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?


Offline Max

  • High Voltage Enthusiast
  • *
  • Posts: 41
  • Karma: +3/-0
    • View Profile
Re: Powerful easy to build MIDI Interrupter
« Reply #16 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
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
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  :)


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
« Last Edit: May 18, 2020, 05:23:12 PM by Max »

Offline Max

  • High Voltage Enthusiast
  • *
  • Posts: 41
  • Karma: +3/-0
    • View Profile
Re: Powerful easy to build MIDI Interrupter
« Reply #17 on: May 18, 2020, 04:15:16 PM »
Maybe the most interesting update until now: With release v3.0.0 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
« Last Edit: May 21, 2020, 08:38:18 PM by Max »

Offline Mads Barnkob

  • Administrator
  • High Voltage Expert
  • *****
  • Posts: 1387
  • Karma: +23/-0
  • Denmark
    • View Profile
    • Kaizer Power Electronics
Re: Powerful easy to build MIDI Interrupter
« Reply #18 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
http://www.kaizerpowerelectronics.dk - Tesla coils, high voltage, pulse power, audio and general electronics

Offline Max

  • High Voltage Enthusiast
  • *
  • Posts: 41
  • Karma: +3/-0
    • View Profile
Re: Powerful easy to build MIDI Interrupter
« Reply #19 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

High Voltage Forum

Re: Powerful easy to build MIDI Interrupter
« Reply #19 on: May 19, 2020, 11:49:02 AM »

 


* Recent Topics and Posts

post 315-446MHz 27dbm (0.5w at 446MHz) RF amp
[Radio Frequency]
kilohercas
Today at 06:38:15 AM
post Re: Isn't there a better way to make a custom toroid?
[General Chat]
Twospoons
Today at 03:24:49 AM
post Re: SSTC Micro
[Solid State Tesla Coils (SSTC)]
Magneticitist
Today at 03:24:20 AM
post Re: MMC for a 32kvac load
[Capacitor Banks]
Rowdy
Today at 03:23:33 AM
post Re: MMC for a 32kvac load
[Capacitor Banks]
Weston
Today at 03:06:20 AM
post Re: Isn't there a better way to make a custom toroid?
[General Chat]
johnf
Today at 01:33:47 AM
post MMC for a 32kvac load
[Capacitor Banks]
Rowdy
Today at 01:02:34 AM
post Re: Isn't there a better way to make a custom toroid?
[General Chat]
Rowdy
May 24, 2020, 11:47:26 PM
post Re: GDT cable specs
[Transformer (Ferrite Core)]
costas_p
May 24, 2020, 11:09:44 PM
post Re: Welcome new members, come say hello and tell a little about yourself :)
[General Chat]
Rowdy
May 24, 2020, 10:39:45 PM
post Re: GDT cable specs
[Transformer (Ferrite Core)]
station240
May 24, 2020, 09:55:49 PM
post Re: Working Principle Of Neon Transformer Circuit
[Transformer (Ferrite Core)]
davekni
May 24, 2020, 09:55:48 PM
post Re: Welcome new members, come say hello and tell a little about yourself :)
[General Chat]
Mads Barnkob
May 24, 2020, 08:16:40 PM
post Re: GDT cable specs
[Transformer (Ferrite Core)]
thecyberman
May 24, 2020, 05:38:27 PM
post Re: Welcome new members, come say hello and tell a little about yourself :)
[General Chat]
Rowdy
May 24, 2020, 02:33:55 PM
post Re: Freewheeling diodes are burning (Now other problems)
[Solid State Tesla Coils (SSTC)]
hip424
May 24, 2020, 02:31:39 PM
post Re: Working Principle Of Neon Transformer Circuit
[Transformer (Ferrite Core)]
iraquois
May 24, 2020, 02:08:53 PM
post Re: Easy to build Polyphonic MIDI Interrupter
[Computers, Microcontrollers, Programmable Logic, Interfaces and Displays]
Max
May 24, 2020, 12:12:36 PM
post Re: Working Principle Of Neon Transformer Circuit
[Transformer (Ferrite Core)]
ritaismyconscience
May 24, 2020, 07:56:21 AM
post Re: Freewheeling diodes are burning (Now other problems)
[Solid State Tesla Coils (SSTC)]
ritaismyconscience
May 24, 2020, 03:09:57 AM
post Re: Working Principle Of Neon Transformer Circuit
[Transformer (Ferrite Core)]
davekni
May 23, 2020, 10:24:55 PM
post Re: GDT cable specs
[Transformer (Ferrite Core)]
johnf
May 23, 2020, 09:30:29 PM
post GDT cable specs
[Transformer (Ferrite Core)]
costas_p
May 23, 2020, 09:06:39 PM
post Re: Working Principle Of Neon Transformer Circuit
[Transformer (Ferrite Core)]
Mads Barnkob
May 23, 2020, 08:22:59 PM
post Re: Freewheeling diodes are burning (Now other problems)
[Solid State Tesla Coils (SSTC)]
davekni
May 23, 2020, 07:47:49 PM
post Re: Building a bigger DRSSTC
[Dual Resonant Solid State Tesla coils (DRSSTC)]
davekni
May 23, 2020, 07:41:41 PM
post Working Principle Of Neon Transformer Circuit
[Transformer (Ferrite Core)]
iraquois
May 23, 2020, 02:09:26 PM
post 600 Watt GEL Battery Charger Teardown - Signet Systems HB600-24B
[Electronic Circuits]
Mads Barnkob
May 23, 2020, 12:46:23 PM
post Re: Building a bigger DRSSTC
[Dual Resonant Solid State Tesla coils (DRSSTC)]
ritaismyconscience
May 23, 2020, 04:14:52 AM
post Re: New projet OmegaDR
[Dual Resonant Solid State Tesla coils (DRSSTC)]
ritaismyconscience
May 22, 2020, 01:15:36 AM
post Re: New projet OmegaDR
[Dual Resonant Solid State Tesla coils (DRSSTC)]
Mugi30
May 21, 2020, 11:55:37 PM
post Re: Easy to build Polyphonic MIDI Interrupter
[Computers, Microcontrollers, Programmable Logic, Interfaces and Displays]
Max
May 21, 2020, 07:46:28 PM
post Re: New projet OmegaDR
[Dual Resonant Solid State Tesla coils (DRSSTC)]
Mugi30
May 21, 2020, 09:15:57 AM
post Re: How to get rid of stuff?
[Sell / Buy / Trade]
johnf
May 21, 2020, 06:35:31 AM
post Re: How to get rid of stuff?
[Sell / Buy / Trade]
MRMILSTAR
May 21, 2020, 05:23:40 AM
post Re: Easy to build Polyphonic MIDI Interrupter
[Computers, Microcontrollers, Programmable Logic, Interfaces and Displays]
futurist
May 21, 2020, 12:16:04 AM
post Re: How to get rid of stuff?
[Sell / Buy / Trade]
klugesmith
May 20, 2020, 11:22:34 PM
post Re: Powerful easy to build MIDI Interrupter
[Computers, Microcontrollers, Programmable Logic, Interfaces and Displays]
Max
May 20, 2020, 12:15:43 PM
post Re: Portable Q(uarantine)CW Tesla Coil
[Dual Resonant Solid State Tesla coils (DRSSTC)]
SteveN87
May 19, 2020, 02:08:20 PM
post Re: New projet OmegaDR
[Dual Resonant Solid State Tesla coils (DRSSTC)]
Mugi30
May 19, 2020, 12:05:51 PM
post Re: Powerful easy to build MIDI Interrupter
[Computers, Microcontrollers, Programmable Logic, Interfaces and Displays]
Max
May 19, 2020, 11:49:02 AM
post Re: Powerful easy to build MIDI Interrupter
[Computers, Microcontrollers, Programmable Logic, Interfaces and Displays]
Mads Barnkob
May 19, 2020, 09:26:06 AM
post Re: Portable Q(uarantine)CW Tesla Coil
[Dual Resonant Solid State Tesla coils (DRSSTC)]
Weston
May 19, 2020, 07:55:54 AM
post Re: What's the best way to trigger these things?
[Capacitor Banks]
klugesmith
May 19, 2020, 01:55:11 AM
post Re: New projet OmegaDR
[Dual Resonant Solid State Tesla coils (DRSSTC)]
ritaismyconscience
May 18, 2020, 11:54:27 PM
post Re: New projet OmegaDR
[Dual Resonant Solid State Tesla coils (DRSSTC)]
Mugi30
May 18, 2020, 10:10:09 PM
post Re: New projet OmegaDR
[Dual Resonant Solid State Tesla coils (DRSSTC)]
Mugi30
May 18, 2020, 10:05:14 PM
post Re: What's the best way to trigger these things?
[Capacitor Banks]
johnf
May 18, 2020, 09:03:11 PM
post Re: What's the best way to trigger these things?
[Capacitor Banks]
John123
May 18, 2020, 07:50:08 PM
post Re: Powerful easy to build MIDI Interrupter
[Computers, Microcontrollers, Programmable Logic, Interfaces and Displays]
Max
May 18, 2020, 04:15:16 PM

Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 
SimplePortal 2.3.6 © 2008-2014, SimplePortal