Emulating MT-32 on an RPi2

General information and assistance with Munt.

Re: Emulating MT-32 on an RPi2

Postby McCarthy » 2017-3-27 @ 14:58

Oh, no no, I've recently bought a cheap usb to midi converter also mentioned here. I've soldered an optocoupler on it, removed the resistor R11 and added a 270ohm one. Then I took a pcb and soldered a connector for gnd, Midi out and 5V onto it. I added a hex inverter and another 270 ohm resistor to the 5V line which both do into the cheap usb adapter which also sits on the pcb. The usb cable of the adapter then goes into the Rpi2 with fluidsynth on it.
I've added a brief sketch. Don't expect correct wiring, it's only for visualisation purposes. My sources were: http://www.arvydas.co.uk/2013/07/cheap- ... -required/ as well as posts from the vogons forum.
I have no idea what's wrong, because some type of connection is being made, but the wrong notes appear I guess.
Thanks in advance.
Daniel
Attachments
Emulator.png
McCarthy
Newbie
 
Posts: 6
Joined: 2017-3-27 @ 07:07

Re: Emulating MT-32 on an RPi2

Postby blougaville » 2017-4-12 @ 16:05

I'm experimenting with gdjacobs prebuilt images. I've tested both on a RPi2 and Rpi3 and when sending MIDI from my retro PC to Munt via the UM-ONE, Munt throws an underrun message every minute or two:

snd_pcm_writei failed: Broken pipe -> recovering...
ALSA lib pcm.c:7843:(snd_pcm_recover) underrun occurred

I am sending MIDI info from my retro PC via the UM-ONE. I tried different CPU speeds and I seem to get about the same amount of underruns whether I'm running games at 550mhz or 200mhz. If I simply play a MIDI file through Munt, I will also get an occasional underrun, but not as often as when sending MIDI data through the UM-ONE. In my testing, the RPi2 seemed to do this a bit more than the RPi3 is. Are there any settings I can try tweaking to minimize these underruns?
blougaville
Newbie
 
Posts: 14
Joined: 2017-2-18 @ 03:52

Re: Emulating MT-32 on an RPi2

Postby gdjacobs » 2017-4-12 @ 22:22

Buffer underruns are an indication that Munt is being CPU starved. What are you using the the power supply on your Pi? It might be undervolting and the Pi downclocking in response.
User avatar
gdjacobs
l33t++
 
Posts: 5155
Joined: 2015-11-03 @ 05:51
Location: The Great White North

Re: Emulating MT-32 on an RPi2

Postby blougaville » 2017-4-12 @ 22:54

I've tried two different power supplies and am getting the same results. The second is one I just bought for the Pi3 that is 5V 2.5A.

I'll try to monitor the CPU activity when the underruns occur.
blougaville
Newbie
 
Posts: 14
Joined: 2017-2-18 @ 03:52

Re: Emulating MT-32 on an RPi2

Postby gdjacobs » 2017-4-12 @ 22:59

Use htop as it's more revealing. Also, I recommend double checking the supply voltage with a DMM.
User avatar
gdjacobs
l33t++
 
Posts: 5155
Joined: 2015-11-03 @ 05:51
Location: The Great White North

Re: Emulating MT-32 on an RPi2

Postby blougaville » 2017-4-13 @ 02:09

My multimeter is reading 5.2V from the power supply. I used htop and watched for 30 minutes and never saw the mt32emu-qt process go over 80% cpu utilization and didn't see any of the cores max out at any time. I also watched the current cpu frequency (with: watch -n 0.1 cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq) and never saw it change from 900000. Over 30 minutes I had 12 buffer underruns (mixture of playing a MIDI file in Munt and sending Dark Forces from retro PC through UM-ONE). When the underruns occurred, the mt32emu-qt process was sometimes reporting fairly low cpu utilization in htop.
blougaville
Newbie
 
Posts: 14
Joined: 2017-2-18 @ 03:52

Re: Emulating MT-32 on an RPi2

Postby gdjacobs » 2017-4-13 @ 04:36

Alrighty. What is your current audio output device?
User avatar
gdjacobs
l33t++
 
Posts: 5155
Joined: 2015-11-03 @ 05:51
Location: The Great White North

Re: Emulating MT-32 on an RPi2

Postby blougaville » 2017-4-13 @ 14:44

gdjacobs wrote:Alrighty. What is your current audio output device?


It's the onboard audio (headphone jack). I enabled it in the config.txt with the line: dtparam=audio=on
Then I changed audio output from HDMI to headphone jack in raspi-config
I was planning to test with the headphone jack audio before purchasing another sound card for the RPi3.
blougaville
Newbie
 
Posts: 14
Joined: 2017-2-18 @ 03:52

Re: Emulating MT-32 on an RPi2

Postby gdjacobs » 2017-4-13 @ 18:02

Could you please update via raspi-config and post your .asoundrc file? Let me know what you're testing with and I will try to duplicate the problem.

I don't have a UM-One, but I have two other MIDI input devices to try with.
User avatar
gdjacobs
l33t++
 
Posts: 5155
Joined: 2015-11-03 @ 05:51
Location: The Great White North

Re: Emulating MT-32 on an RPi2

Postby blougaville » 2017-4-13 @ 18:29

gdjacobs wrote:Could you please update via raspi-config and post your .asoundrc file? Let me know what you're testing with and I will try to duplicate the problem.

Sure, thanks for your help with this! I updated, but I can't find the .asoundrc file. I looked all over, including the /home/pi/ folder.

I have been testing with Dark Forces, Loom, and Monkey Island from my retro PC, but I also experience occasional underruns when playing the monkey island sound track .mid file found in the MIDI folder of your RPi3 image.
blougaville
Newbie
 
Posts: 14
Joined: 2017-2-18 @ 03:52

Re: Emulating MT-32 on an RPi2

Postby gdjacobs » 2017-4-13 @ 18:38

Okey doke. I'll first try Monkey Island -> DOSBox -> LInux MIDI out -> USB MIDI -> USB MIDI -> Pi 3 MIDI in -> Munt -> ALSA -> USB DAC and see what happens.

Edit:
I had an issue with cord length that I had to address, but my voltages are back in spec. So far everything seems perfect, although at present I'm using my standard setup with jackd as the mixing sound server. I'll do a full run through of the Monkey Island MIDI file played from a DOSBox session on another machine and see if anything shows up. Can you identify any particular passages or game locations which seemed to be problematic so I can test them directly?

Edit:
The full length of the Monkey Island MIDI file played through without issue. Just to confirm, was 5.2V the open circuit voltage or load voltage measured directly from the back of the Pi? Have you tried a robust, minimal length USB cable?

Edit:
The Pi 2 seems fine with the USB DAC. Approximately 60% CPU load and there doesn't appear to be USB bus contention. I have also set smsc95xx.turbo_mode=N in cmdline.txt for my Pi 2 which is a recommended fix for some USB bus contention issues.
User avatar
gdjacobs
l33t++
 
Posts: 5155
Joined: 2015-11-03 @ 05:51
Location: The Great White North

Re: Emulating MT-32 on an RPi2

Postby blougaville » 2017-4-14 @ 22:34

Thanks for trying that. I did not know how to measure the load right from the pi so I'll look into how to do that. The 5.2V is what was coming right off of the supply. Like I said before, I'm getting this issue with the Pi2 and 3 and have tried two different power supplies (both had a longish cord, I'll try a short one).

I did some more tests so hopefully this can give you a better idea of when I'm seeing this issue:

1) Monkey Island Complete Soundtrack MIDI file - The first time I powered up the Pi3 and played through it in Munt, I got two underruns when playing it all the way through. I then immediately played it twice more and got no underruns. On the fourth complete playthrough I got two more underruns. Not bad when compared with #2.

2) Monkey Island from retro PC via UM-ONE - I've started this game a heck of a lot and I usually get 4-6 underruns before the opening theme song concludes. I don't think the opening theme has ever played all the way through without getting at least a couple underruns.

Thanks again for all your help with this!
blougaville
Newbie
 
Posts: 14
Joined: 2017-2-18 @ 03:52

Re: Emulating MT-32 on an RPi2

Postby gdjacobs » 2017-4-15 @ 01:07

Okay. The Monkey Island intro plays clean for me.

You can test input voltage on the GPIO pins or on the reverse of the Pi, near the USB power input.
User avatar
gdjacobs
l33t++
 
Posts: 5155
Joined: 2015-11-03 @ 05:51
Location: The Great White North

Re: Emulating MT-32 on an RPi2

Postby DieKatzchen » 2017-5-29 @ 19:53

So, if I wanted to put this in a box, with a midi in socket and a 16 column display, what do I need? I'm pretty sure I need an optocoupler in there, but that's the extent of my knowledge. I'm using a raspberry pi 3.

[Edit]make that 20 column. Just counted. [/Edit]
DieKatzchen
Newbie
 
Posts: 7
Joined: 2017-5-29 @ 19:29

Re: Emulating MT-32 on an RPi2

Postby gdjacobs » 2017-5-30 @ 00:08

I'm currently working on integrating a Pi 3 with the X3M from Serdaco along with breakouts for control switches and an LCD module. I want everything to fit together in roughly the size of a 3.5" drive bay, either internal to a PC or in an external enclosure.

sandwich.png
User avatar
gdjacobs
l33t++
 
Posts: 5155
Joined: 2015-11-03 @ 05:51
Location: The Great White North

Re: Emulating MT-32 on an RPi2

Postby DieKatzchen » 2017-5-31 @ 02:43

I don't know if I'd go that far. If it costs anywhere near the X3M, I might as well buy a real MT-32. I just want to hook up the usb to midi cable I bought and the 20x2 display I already have, maybe with some pushbuttons and a rotary encoder for menus. If the cable has the proper optoisolator in it, do I need another between the uart and the socket, or would that be bad, or would it be an optional safety precaution? I have only vague understanding of the circuit. Somebody mentioned using a hex inverter? what is that for?
DieKatzchen
Newbie
 
Posts: 7
Joined: 2017-5-29 @ 19:29

Re: Emulating MT-32 on an RPi2

Postby gdjacobs » 2017-5-31 @ 03:57

Hex inverters are used for driving MIDI outputs and MIDI through ports (two inverters back to back). You can also use Schmitt triggers (74xxx14) for a somewhat cleaner build.

Edit: My apologies to Dr. Otto Schmitt.
Last edited by gdjacobs on 2017-5-31 @ 15:55, edited 1 time in total.
User avatar
gdjacobs
l33t++
 
Posts: 5155
Joined: 2015-11-03 @ 05:51
Location: The Great White North

Re: Emulating MT-32 on an RPi2

Postby DieKatzchen » 2017-5-31 @ 06:22

So if I just want an input it's unnecessary?
DieKatzchen
Newbie
 
Posts: 7
Joined: 2017-5-29 @ 19:29

Re: Emulating MT-32 on an RPi2

Postby gdjacobs » 2017-5-31 @ 15:51

Yes, that's correct.
User avatar
gdjacobs
l33t++
 
Posts: 5155
Joined: 2015-11-03 @ 05:51
Location: The Great White North

Re: Emulating MT-32 on an RPi2

Postby DieKatzchen » 2017-6-02 @ 21:09

So I just hook up the rx and tx lines to the din connector? That seems too simple.
DieKatzchen
Newbie
 
Posts: 7
Joined: 2017-5-29 @ 19:29

PreviousNext

Return to MT-32 General

Who is online

Users browsing this forum: No registered users and 1 guest

cron