Reply 40 of 57, by mcobit
Thanks for the hint with the multithreading. Will definately try that when I get some time.
Thanks for the hint with the multithreading. Will definately try that when I get some time.
wrote:This is great! Been thinking for a long time that it would be awesome to see Munt's simulated LCD output on a real LCD (which is why I made this: https://youtu.be/ExRFasoLT7o ).
I'm curious why this project only shows SysEx text and not the full MT-32 LCD output though?
I'm also impressed that the rPi CPU is up to the task.
I could show the full output of course, but there is not much more info than what the leds already show.
Edit: also would be a bit more work as I think only the qt munt frontend renders that out. I am using commandline only and did not find anything in the munt code that would show the channels blinking.
The MT-32 LCD shows instrument changes and such, but it's mostly useless information I suppose.
Regarding Qt: I guess you're right - it looks like I did piggyback on the Qt stuff for my Logitech G15 mod: https://github.com/HunterZ/munt/commit/fdf463 … 6c992fd4e3bbe66
Someone should probably split that functionality out so that it supports non-Qt frontends without the Qt dependency.
I'll have a look at that.
wrote:I'll have a look at that.
I want to display info about the current bank and channel assignments for fluidsynth and munt too. I'm working on the basic functionality of my interface right now (I'm way behind where you are!), but my current plan is just to scan all of the incoming midi messages for program changes and the mt-32 sysex. That way I don't have to figure out how to get that information from munt or fluidsynth (for program changes).
The python mido library makes it super easy. Here's a sample script where I just print stuff to the console. If you can't get what you want from munt directly, you could fake the mt-32 display using the same idea.
import rtmidi
import mido
import time
MIDI_DATA_UPDATE_TIME = 0.1
#load a list of the mt32 instruments from a text file
with open('./defaultMT32.txt') as f:
mt_inst_list = f.read().splitlines()
#check the list of input ports
n = mido.get_input_names()
for x in n:
print(x)
#this just opens the port with the incoming sysex
#you can make everything go through port 14 with aconnect I think
#and then we can watch port 14
port=mido.open_input(n[0])
print n[0]
print('We\'re listening to the port now...')
#This is how the MT32 LCD SysEx starts. 20 ASCII characters come after this
LCDSYSEX = tuple([65,16,22,18,32,0,0])
while(1):
#port.iter_pending() has all of the midi messages since the last time you looked
for msg in port.iter_pending():
#get program change information for instrument changes
if msg.type == 'program_change':
c = msg.channel
p = msg.program
print 'Channel',c,'is set to', mt_inst_list[p]
#if msg.type == 'sysex' and is an LCD message update...
if msg.type == 'sysex' and msg.data[0:7] == LCDSYSEX:
LCDbytes = msg.data[7:27]
LCDstring = "".join([chr(c) for c in LCDbytes])
print 'LCD Message:', LCDstring
time.sleep(MIDI_DATA_UPDATE_TIME)
That is basically what I do to control the leds. I get the midi messages dirctly from the interface and translate them into light.
I tried it though and you are right, If I ever wanted to get the messages, it would be this way without munt.
I modified the script from @ghogan42 and added some stuff. Now the info is displayed on a 128x32 oled via i2c on the rpi:
wrote:I modified the script from @ghogan42 and added some stuff. Now the info is displayed on a 128x32 oled via i2c on the rpi:
Neat! I hope to get most of my LCD stuff working this weekend. My LCD seems to be a little bit defective, but it works well enough to do the programming I need to do. Another thing I'm doing in my scripts is using grep to pull out the ports that my midi devices are at so I can "aconnect" them exactly where they need to go. When I started out, I noticed that sometimes fluidsynth ended up on port 129 and then my script would hang because it was looking for port 128 before continuing. So now I do this in my bash script:
echo "Now wait for FluidSynth to be in aconnect -o"
until aconnect -o | grep FLUID ; do
sleep 0.1
done
echo "Now wait for RTMIDI to be in aconnect -i"
until aconnect -i | grep RtMidiOut ; do
sleep 0.1
done
F=$(aconnect -o | grep -Eo '[0-9]{3}.*FLUID' | grep -Eo '[0-9]{3}')
R=$(aconnect -i | grep -Eo '[0-9]{3}.*RtMidi' | grep -Eo '[0-9]{3}')
L=$(aconnect -i | grep -Eo '[0-9]{2}.*The Laboratory' | grep -Eo '[0-9]{2}')
U=$(aconnect -i | grep -Eo '[0-9]{2}.*CH345' | grep -Eo '[0-9]{2}')
echo "FluidSynth found at $F"
echo "RtMidi found at $R"
echo "Aruria - The Laboratory found at $L"
echo "CH345 USB Interface found at $U"
aconnect -x
aconnect "$R" 14
aconnect "$L" 14
aconnect "$U" 14
aconnect 14 "$F"
The "grep magic" isn't perfect because at the moment I have to know if the port will be a 3 digit or 2 digit number, but I guess I do know that so it's fine for now.
Sorry again for posting my own nonsense in your thread, mcobit. I'll make my own thread when I get enough stuff together to make a thread.
You can't tell in the video because all of the functions that handle synth/bank/channel/program changes aren't hooked up to buttons yet. And a lot of the status isn't currently displayed on the LCD. So I'm further along than it looks like I am here. But here's a video of the first thing I got up and running on my rpi + lcd: https://www.youtube.com/watch?v=Hn883Z-2nGY Video quality is crap and I really need to get a better font for the text I'm displaying, but it's something!
So thanks again for your scripts and videos!
Looks really good. Looks more like a SC-55 or 88 than a mt-32.
And no problem posting here. We could make a new thread for general recreation of roland synths or something. Maybe even for others like yamahas.
So we can get a collection of python scripts for various synths.
wrote:Looks really good. Looks more like a SC-55 or 88 than a mt-32.
And no problem posting here. We could make a new thread for general recreation of roland synths or something. Maybe even for others like yamahas.
So we can get a collection of python scripts for various synths.
Oh for sure it looks more like a SC-55 or SC-88. I looked at those along with some yamaha synths and tried to make a mockup of something that I could fit in the 128x64 res. I need to make a completely different layout for when munt is running. I want something for mt-32 that displays the LCD text prominently and doesn't have activity meters for unused midi channels. I'll see what I can do.
Awesome work mcobit and ghogan42! Would it make sense to use two LCDs? A 128x64 to display in SC-55 style and a 128x32 to display in MT-32 style? Maybe overkill since you could just make the 128x64 display MT-32 I guess.
I think I would rather build two devices with different screens instead. Connecting and updating two lcds with a raspberry, while possible, might take away precious computing power. A raspberry 3 can barely cope with mt 32 emulation.
wrote:I think I would rather build two devices with different screens instead. Connecting and updating two lcds with a raspberry, while possible, might take away precious computing power. A raspberry 3 can barely cope with mt 32 emulation.
Yep I agree. Depending on how often I try to update my 128x64 display, I can suck up 40% of a cpu core just doing that! I think the way to do it is just to use a 128x64 lcd (or larger!) and then find something to fill up the unused space when running munt. Channel meters, spectrum analyzer, jukebox controls, etc. Or just a nice Roland MT-32 logo that takes half of the screen 😀
@mcobit
I've been lurking these forums on and off for the last few months as I've been restoring an old 486 computer. While perusing YouTube I came across your project, and found a link to this thread, and had to create an account just to say that this project is just awesome! I'd love to make one of my own in fact. Is there any chance of getting a step-by-step build-guide some point in the future?
Keep up the fantastic work, I look forward to watching it progress! 😀
Also, sorry in advance for bumping this older thread, but this project just excites me to no end!
Edit:
By the way, has anyone attempted to fit a Pi Synth-emulator into a 5.25 drive bay, by chance?
@mcobit Awesome work. I was looking for info to make something similar to yours, but apparently everything is done.
I’ve been watching your YouTube’s videos and I have to admit that you did a fantastic work integrating everything in that white box. It looks so professional
Would you mind sharing more pictures and explain what hardware you are using . And the most important, can we get an image of your installation, or the scripts and software you’ve used.
Hello Mcobit
I started a similar project the other day without knowing that this was was already around. If it's alright with you I'd like to take some of the code you've posted and incorporate it in my project. I will be licensing mine under GPL and wanted your permission before I moved forward with it.
The goal of mine is to have it internally mounted through the wavetable header, but 99% of the software would be the same.
Here's my project if your curious... WavePi: Use Raspberry pi (2/3/4) as a AIO MIDI synth
My Youtube Channel: https://www.kor.ninja/
My Soundfont Project: K.O.R. Soundfont Project V.5.0
My Soundcloud Page: https://soundcloud.com/clint-theriault
This is amazing! Would love to see a step-by-step tutorial and parts list sometime.