dwhinham / mt32-pi

🎹🎶 A baremetal kernel that turns your Raspberry Pi 3 or later into a Roland MT-32 emulator and SoundFont synthesizer based on Circle, Munt, and FluidSynth.
https://twitter.com/d0pefish
GNU General Public License v3.0
1.29k stars 81 forks source link

Wrong instruments #20

Closed loskaa closed 4 years ago

loskaa commented 4 years ago

I am currently having small issue with MT32-pi. It’s playing music but all the instruments are wrong and they are different every time when I boot the raspberry. The MT32-pi is connected to old dos pc using game port midi cable and m-audio midisport uno. I tried windows 10 laptop with munt instead MT32-pi and it is playing instruments correctly.

I am probably missing something pretty obvious here but cannot figure out what :)

dwhinham commented 4 years ago

Hi!

That's interesting - which game(s) are you trying, and are they definitely set up in MT-32 mode (and not, e.g. General MIDI mode)?

Most games will send a burst of SysEx to the MT-32 when in the correct mode to set up the instrument assignments before playing the actual music - and so the MT-32 (or in this case the emulator) needs to be up and running before the game starts so that it's ready to receive this, so you can't hotplug/start up the synth halfway through a song or the instruments will definitely be wrong.

Sorry if this is obvious - just need to rule some stuff out! 😄

loskaa commented 4 years ago

I have tried Monkey Island 1/2 (using r parameter), Space Quest 3/4 and The Legend of Kyrandia. Softmpu is running and the lcd display connected to pi is showing “Lucasarts presents” and other messages.

MT32-pi is running before loading any games.

Don’t worry. I am fairly certain it’s something obvious on my side 😄

dwhinham commented 4 years ago

Ahhh, now SoftMPU isn't something I've actually tried yet on my 486 as I use an intelligent mode MIDI interface, so that could be the difference.

I noticed this from the troubleshooting section of SoftMPU's docs:

Problem: My Rev.0 MT-32 displays “EXC. BUFFER OVERFLOW”. Music playback sounds incorrect. Solution: Run SoftMPU with the /DELAYSYSEX switch.

Could you give that a try?

If there's no joy, I'll have to dig out a gameport cable and try to reproduce this on my 486 with AWE 32. What's the CPU in your DOS PC by the way?

Thanks 😄

loskaa commented 4 years ago

No difference with /delaysysex switch. Should the games which doesn’t require intelligent mode work without midi interface card or softmpu with MT32-pi? When softmpu isn’t running, all the games I’ve tried still have wrong instruments.

I have 233 mmx in this pc.

dwhinham commented 4 years ago

Honestly, I'm not sure! I haven't really dealt with these kinds of compatibility issues before - sorry! 😞

What kind of sound card do you use? I know some certain version of Sound Blaster have MIDI bugs... The CTxxxxx number if it's a Sound Blaster will be useful here. Did you also say that connecting this PC to your modern PC running MUNT using the same USB cables works fine?

The LCD messages working is promising, at least - that means some SysEx is getting through fine. I should test using a USB interface on the Raspberry Pi again because it's been a while since I last tried (I now use GPIO and it's entirely possible that I broke something for USB without noticing!).

loskaa commented 4 years ago

The soundcard is Yamaha audician 32. Yes, if I change pi to pc with munt (same cable and same usb midi interface) all sound just as they should.

dwhinham commented 4 years ago

I just tested SoftMPU (no special switches, just /MPU:330) with my Sound Blaster AWE32's joystick port, going into my Pi 3 B+ both via GPIO and via USB interface (M-Audio USB Uno) - everything working fine with Monkey Island 1 and 2 with the r option.

I'm running out of ideas - something's probably getting corrupted along the way.

What kind of Raspberry Pi are you using, and what kind of power supply are you using to power it? If it's too weak that could explain bad behaviour.

Do you have any other sound cards you could try in the Pentium?

When I get some time I could do a special build for you that logs all incoming MIDI data to a file on the SD card. That way we could try to get a better idea of what's happening.

loskaa commented 4 years ago

It’s raspberry pi 3b and the power supply is 2.5A model with raspberry logo on it. I tried another power supply, another pi and few different sd cards to rule them out but the results are the same. I did also try another pc with sound blaster 32 but also the same problem.

I had to do an adapter to connect two male midi cables (from game port cable to uno) which you can call a hack job but it’s working with the windows laptop with munt.

But thank you for confirming It’s working perfectly with similar setup. I’ll try to find what stupid mistake I have done 😄

dwhinham commented 4 years ago

The adapter/coupler should be fine, really - I know someone else using the same idea - but who knows, there could be some electrical incompatibility.

I've done a special build here: https://github.com/dwhinham/mt32-pi/actions/runs/203033264

This build will append everything it receives via midi to a file called midi-log.txt on the SD card - it will look a bit like this:

93 34 24
91 28 30
93 3B 20
93 40 1B
93 42 1E
94 58 34
94 53 28
94 4F 30
94 4E 30
94 4A 12
...

When you get some time:

I can then compare it to what it should contain, and we can see if there's any pattern to what's getting lost.

Cheers!

loskaa commented 4 years ago

midi-log.txt

Ok, here we go.

dwhinham commented 4 years ago

Okay, here's the start of a diff, with my "good" log on the left and yours on the right. I noticed yours includes the SoftMPU LCD message SysEx, which looks good (I can "replay" that data on mine and I see the message).

image

Your log is missing so much data - there are huge chunks of CC messages and program changes missing, and also it looks like a lot of the packets that do get through are corrupted/have wrong values.

I think there may be some kind of electrical problem or incompatibility corrupting the data.

A few more ideas:

What's strange is that I have an Uno too that works fine, it looks just like this: image

Mine is very old, have had it since the early 2000s, but reliable - I wonder if there have been any revisions to it that affected compatibility.

Sorry you're having trouble - I really want to help you get this resolved! 😢

loskaa commented 4 years ago

-Tried all USB ports -With dac and without it -I have left those settings to default -Tried with and without LCD -I first hooked it using Roland XV sound module (in/thru)

I cannot try rest of your suggestions right now but I will when get another usb midi adapter (or I make a GPIO midi input). And I can probably try it with Raspbian and munt tomorrow.

Thank you for using so much your time for this. I am beginning to believe that the problem might be in the uno. As it missing so much data. Who knows what have been changed during the years. I bought mine about a month ago.

dwhinham commented 4 years ago

No problem! 😄

It really doesn't sound like you're doing anything wrong, so I agree, I'm suspicious of the Uno.

Did you get it from a reputable seller and does it seem genuine? I haven't heard of fake Unos yet but there are a lot of faulty cheap/nameless interfaces out there so who knows, it wouldn't surprise me if they'd start putting them in cases that look like reputable devices! Either way, your experience with it might be a reason to add a caution to the "recommended list" in the README...

Let me know if you get any further. 👍

loskaa commented 4 years ago

I bought it from gear4music and at least for me it seems genuine 😄 I’ll reply here when I know more.

loskaa commented 4 years ago

Today I got a few octocouplers and rigged a GPIO midi input. And with it the mt32-pi works perfectly. So I think it’s safe to say that the problem in my case was the Uno.

Thanks again for the help!

dwhinham commented 4 years ago

Ahhh great! Thanks for persevering, I'm glad you managed to get it working. Maybe a different USB interface will work if you ever get a chance to borrow another one.

I'll close this issue now - enjoy! 😃