MidiLink 2.0 looking for testers. (no MIDI devices required)

https://github.com/MiSTer-devel/Main_MiSTer/wiki

Moderators: Mug UK, Zorro 2, spiny, Greenious, Sorgelig, Moderator Team

Locked
BBond007
Captain Atari
Captain Atari
Posts: 466
Joined: Wed Feb 28, 2018 3:23 am

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by BBond007 »

Sorgelig wrote:Something weird with aplay i think. I hear a lot of missed samples. But when i simply issue cat my.wav >/dev/MrAudio then i hear good sound
have you tried aplaymidi with MUNT or FSynth with MIDI or mpg123 with MP3 files? Fsynth and Munt do really small transfers very frequently. 280 and 512

if you have installed the ROMS, then munt is just

#mt32d

#fluidsynth -is -a alsa -m alsa_seq %s

where %s is .sf2 soundfont.

aplaymidi --port 128 FILENAME.MID
Last edited by BBond007 on Mon Jan 14, 2019 5:08 am, edited 1 time in total.
Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by Sorgelig »

mpg123 doesn't like the playback device. (you can try yourself to see the error)

i didn't try midi playback yet as it looks too complicated.

I've changed pcm playback to file and then opened the raw file in CoolEdit and to my i heard exactly the same wrong sound i hear on MiSTer. So the problem is in asound.conf or alsa itself.
So you can test it yourself - just change the output from device to file in asound.conf
BBond007
Captain Atari
Captain Atari
Posts: 466
Joined: Wed Feb 28, 2018 3:23 am

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by BBond007 »

Sorgelig wrote:mpg123 doesn't like the playback device. (you can try yourself to see the error)

i didn't try midi playback yet as it looks too complicated.

I've changed pcm playback to file and then opened the raw file in CoolEdit and to my i heard exactly the same wrong sound i hear on MiSTer. So the problem is in asound.conf or alsa itself.
So you can test it yourself - just change the output from device to file in asound.conf
I'll see if I can figure it out. Thanks!
User avatar
Paradroyd
Captain Atari
Captain Atari
Posts: 300
Joined: Tue Sep 10, 2013 10:50 pm
Contact:

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by Paradroyd »

BBond007 wrote:Did you ever have you had any luck with the Atari ST core and terminal programs?

The demo version of STalker seemed to work. Some of the ones I tried wanted to write to the disk and would not let me proceed. I'm not sure of the best terminal program to use.

Ijor mentioned that he did not connect the CTS/RTS flow control lines as they are not used for MIDI.

Thanks :)
Yes..I did get the ST core to work with it. I used the (fully functional) demo version of "Freeze Dried Terminal". Although it complains about not being able to write to a configuration file on startup, you can get past it and use a default configuration. It has fairly good ANSI support too. I've used it to log on to a few BBSs and it works well. It can be a bit tricky to initialize the modem, but that has more to do with the ST, the terminal program, and the fact that you can't save to configuration than MIDIlink.
20190113_224922.jpg
20190113_225441.jpg
On an unrelated note, the TCP modem gives an error for unqualified host names and says they're invalid. For example, "comserver" as opposed to "comserver.paradroyd.com". It would be helpful if it would accept short host names. Some BBSs have horribly convoluted FQDNs, and I like to make DNS aliases for those to make them shorter. This would also help them to fit into terminal program dialing directories. Probably not worth a build on it's own, but if you could add support for that in a later release, it would be great.

Thanks!
You do not have the required permissions to view the files attached to this post.
- Paradroyd
@paradroyd on Twitter, @paradroyd@mastodon.sdf.org on Mastodon
Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by Sorgelig »

midi (mt32d) basically works. I hear good sound.
But the rhythm is totally messed. Any midi music becomes improvisation - hard to recognize the melody :) DISCO.MID plays like jazz :mrgreen:
Something wrong with timer i think. With the absence of real sound card it looks like sound has nothing to sync to. I've added PCM timer interface to kernel, but it seems need to do something to use it.

i'm going to push my commits, so you will be able to play with the code - may be you will get some ideas.
Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by Sorgelig »

BBond007 wrote:I'll see if I can figure it out.
I've updated the kernel repo. MiSTer_defconfig reflects my latest changes.

Test version of menu supporting pcm output:
menu.zip
I didn't make neither ao486 nor Minimig yet as both cores are quite unstable and require many hours to find the working build with every small changes in the code.
So Menu core is the only core supporting pcm audio for now.

My main suspect is audio timer. Probably aplay has problem because of this as well.
You do not have the required permissions to view the files attached to this post.
Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by Sorgelig »

FPGA may provide IRQ with specified rate if it can help.
Actually it would be good if alsa would sync to such IRQ which will be bound somehow to sample rate. There will be a common clock preventing buffer underrun/overrun due to rate difference.
BBond007
Captain Atari
Captain Atari
Posts: 466
Joined: Wed Feb 28, 2018 3:23 am

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by BBond007 »

@Sorgelig

"modprobe snd-dummy model=uda1341"

this makes asound and mpg123 work pretty well.

So now I'm studying the (snd-dummy) dummy.c to see what difference that setting makes in the driver.

thanks
Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by Sorgelig »

Thanks for finding! Together will will make it work reliably.
Still if you think IRQ from FPGA with precise rate would be better than semi-software hrtimer, then it's not a problem to make. FPGA has 64xIRQs :)
There is only one quirk - IRQ will be generated by cores knowing about it. Non-updated cores won't generate obviously.
BBond007
Captain Atari
Captain Atari
Posts: 466
Joined: Wed Feb 28, 2018 3:23 am

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by BBond007 »

Paradroyd wrote: On an unrelated note, the TCP modem gives an error for unqualified host names and says they're invalid. For example, "comserver" as opposed to "comserver.paradroyd.com". It would be helpful if it would accept short host names. Some BBSs have horribly convoluted FQDNs, and I like to make DNS aliases for those to make them shorter. This would also help them to fit into terminal program dialing directories. Probably not worth a build on it's own, but if you could add support for that in a later release, it would be great.
what if you edit
/etc/resolv.conf

and add the line
domain paradroyd.com

Does it work then?
Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by Sorgelig »

with uda1341 aplay start to work correct.
But as i start mt32d, aplay switched to the old behavior. It seems mt32d reset the settings.
Also midi still plays in improvisation mode.
User avatar
Paradroyd
Captain Atari
Captain Atari
Posts: 300
Joined: Tue Sep 10, 2013 10:50 pm
Contact:

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by Paradroyd »

BBond007 wrote:
Paradroyd wrote: On an unrelated note, the TCP modem gives an error for unqualified host names and says they're invalid. For example, "comserver" as opposed to "comserver.paradroyd.com". It would be helpful if it would accept short host names. Some BBSs have horribly convoluted FQDNs, and I like to make DNS aliases for those to make them shorter. This would also help them to fit into terminal program dialing directories. Probably not worth a build on it's own, but if you could add support for that in a later release, it would be great.
what if you edit
/etc/resolv.conf

and add the line
domain paradroyd.com

Does it work then?
No.. that was actually already in there (probably via DHCP), and the OS itself knows that the host is valid. I can ping it and it resolves fine:
resolv.PNG
..but when I try to ATDT the unqualified host, I get this:
20190114_215615.jpg
If I atdt the FQDN, it works:
20190114_220446.jpg
Again..not a big deal. Just letting you know.
You do not have the required permissions to view the files attached to this post.
- Paradroyd
@paradroyd on Twitter, @paradroyd@mastodon.sdf.org on Mastodon
BBond007
Captain Atari
Captain Atari
Posts: 466
Joined: Wed Feb 28, 2018 3:23 am

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by BBond007 »

Sorgelig wrote:with uda1341 aplay start to work correct.
But as i start mt32d, aplay switched to the old behavior. It seems mt32d reset the settings.
Also midi still plays in improvisation mode.
did you killall MT32d before trying aplay?

I think that is because once MUNT loads, it writes data continuously to the output buffer even if it is producing no sound. FluidSynth exhibits the same behavior.

So anyway, what you may hearing is asound and MUNT playing nulls interleaved.

I would test with FluidSynth for now. I did recompile MUNT with what I thought were better optimizations, but I think it sound more wonky which is probably what you are calling improvisation mode.

The only real difference I notice between the USB sound and this is there seems to be an artifact played when sound stops.

Thanks
BBond007
Captain Atari
Captain Atari
Posts: 466
Joined: Wed Feb 28, 2018 3:23 am

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by BBond007 »

Paradroyd wrote: Again..not a big deal. Just letting you know.
My router is not sending the domain name, and I'm not sure how to make it do that.

if you type

#domainname

does it give the correct result?
User avatar
Paradroyd
Captain Atari
Captain Atari
Posts: 300
Joined: Tue Sep 10, 2013 10:50 pm
Contact:

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by Paradroyd »

BBond007 wrote:
Paradroyd wrote: Again..not a big deal. Just letting you know.
My router is not sending the domain name, and I'm not sure how to make it do that.

if you type

#domainname

does it give the correct result?
Yes..it responds, "paradroyd.com"
- Paradroyd
@paradroyd on Twitter, @paradroyd@mastodon.sdf.org on Mastodon
Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by Sorgelig »

I've played MP3 with mpg123 - it works well. I've expected to hear the crackle due to output 48KHz playback has no connection with alsa, so it should either starve or overflow. But i didn't hear any crackles! This is promising. I even moved spi buffer transfer directly to device_write function. 16KB of BRAM buffer in FPGA is enough. Will try later smaller buffers to find the lower limit.

Killing the mt32d restores normal work of aplay. So, it's impossible to stop mt32d playing the silence?
Regardless the silence playback, mt32d plays incorrect non-linear tempo. May be it depends on sound font (your installer downloaded it). Also i see "Output buffer underrun" message. Not sure who exactly shows it - alsa or mt32d. mp3 playback doesn't produce any warnings/errors.
BBond007
Captain Atari
Captain Atari
Posts: 466
Joined: Wed Feb 28, 2018 3:23 am

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by BBond007 »

Sorgelig wrote: Killing the mt32d restores normal work of aplay. So, it's impossible to stop mt32d playing the silence?
Regardless the silence playback, mt32d plays incorrect non-linear tempo. May be it depends on sound font (your installer downloaded it). Also i see "Output buffer underrun" message. Not sure who exactly shows it - alsa or mt32d. mp3 playback doesn't produce any warnings/errors.
Obviously not impossible as they are open source, but looking at the code of FluidSynth and MUNT there is no easy option - and they both exhibit that behavior.

I think it would be best to kill MUNT and Fsynth in the uartmode script for the NONE/PPP/Console options.

Also MUNT has no soundfont. That is for FluidSynth.

MT-32 works like an analog synth with PCM samples only for the attack portion of the waveform. The closest thing it has to sound font is the ability to upload new PCM samples via MIDI sysex messages, which is what a lot of games (especially Sierra) do.

I think the tempo of MUNT got messed up when I recompiled it with what I thought were better optimizations. I am going to recompile it and then we'll see if the tempo is any better.

Ideally you should be using MT-32 specific MID files for testing with MUNT. or at least the --port 128:1 which will tell it to use a semi quasi GM sound bank mapping.

I did get the "output buffer underrun" (with MUNT) but that was when I was trying to write a a sound file on /media/fat and never with the /dev/MrAudio
Last edited by BBond007 on Tue Jan 15, 2019 8:51 am, edited 1 time in total.
BBond007
Captain Atari
Captain Atari
Posts: 466
Joined: Wed Feb 28, 2018 3:23 am

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by BBond007 »

Paradroyd wrote: Yes..it responds, "paradroyd.com"
very strange while testing the telnet negotiations it seemed to work for me.

I typed "ATDTCOMMODORE80" probably 20+ times :) (which is my RPi in a C=64c case with C-16 keyboard which is why its called C=80)

I did figure out how to get my router to add a domain name.

Anyway, I added some logic that adds the domain name (provided you have one) if the host name does not contain any '.' characters.

Let me know if that is a good solution.

I think it will allow your config to work, without breaking people like me were it are working fine even without a domain name.

Thanks for testing!
BBond007
Captain Atari
Captain Atari
Posts: 466
Joined: Wed Feb 28, 2018 3:23 am

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by BBond007 »

Sorgelig wrote: 16KB of BRAM buffer in FPGA is enough. Will try later smaller buffers to find the lower limit.
here is a possible way to limit it:

static struct dummy_model model_uda1341 = {
.name = "uda1341",
.buffer_bytes_max = 16380,
.formats = SNDRV_PCM_FMTBIT_S16_LE,

# cat /dev/MrAudio
MrBuffer Write Count --> 44066
MrBuffer Max Write Length --> 16380

Also, the problem we were having with the distorted sound also happens with USB audio devices I have tried that do that do > 16bit samples, such as my fiio e10k makes that same choppy missing sample sound, so I'm guessing the ALSA in the kernel is broken for 32 samples at some other level and the problem its not with snd-dummy itself.

Thanks for doing this :)
Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by Sorgelig »

BBond007 wrote:here is a possible way to limit it:
i know it. But you can't write any size as it will affect the continuity when buffer will be too small.
I have a new idea for buffer. It looks much better and will allow to use very small buffer on FPGA side.
BBond007 wrote:Also, the problem we were having with the distorted sound also happens with USB audio devices I have tried that do that do > 16bit samples, such as my fiio e10k makes that same choppy missing sample sound, so I'm guessing the ALSA in the kernel is broken for 32 samples at some other level and the problem its not with snd-dummy itself.
not sure why you are talking about 32bit samples. MiSTer-audio uses 16bits. Actually now we have only one unknown problem: non constant midi tempo.
BBond007
Captain Atari
Captain Atari
Posts: 466
Joined: Wed Feb 28, 2018 3:23 am

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by BBond007 »

Sorgelig wrote: not sure why you are talking about 32bit samples. MiSTer-audio uses 16bits. Actually now we have only one unknown problem: non constant midi tempo.
I believe that is why 'model=uda1341' fixes our issue. I can't get a > USB 16bit device to work with this kernel. Same result. It's not important, as the goal is 16bits.

by 'non constant midi tempo', do mean MUNT, FluidSynth or both?

I am looking into the tempo problem with MUNT, however I not am having tempo problems with FluidSynth.

MUNTs tempo problems are not unique to MiSTer-audio, I get the same thing with USB, but it seems worse with 'aplaymidi' then the player I use the Minimig core.
Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 6348
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by Sorgelig »

BBond007 wrote:by 'non constant midi tempo', do mean MUNT, FluidSynth or both?
I am looking into the tempo problem with MUNT, however I not am having tempo problems with FluidSynth.
I'm talking about mt32d - is it MUNT?
Can you give more clear command line how to start FluidSynth? The one you posted above is unclear for me with that %
Your install script downloaded some ROMs - are they enough to start FluidSynth?

I've updated the kernel repo with new audio driver which is much better now. MiSTer_defconfig is also updated.
This menu version is compatible with new driver:
menu.zip
With this driver no BRAM is used in FPGA at all.
You do not have the required permissions to view the files attached to this post.
BBond007
Captain Atari
Captain Atari
Posts: 466
Joined: Wed Feb 28, 2018 3:23 am

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by BBond007 »

Sorgelig wrote: Can you give more clear command line how to start FluidSynth? The one you posted above is unclear for me with that %
Your install script downloaded some ROMs - are they enough to start FluidSynth?

I've updated the kernel repo with new audio driver which is much better now. MiSTer_defconfig is also updated.
This menu version is compatible with new driver:
menu.zip
With this driver no BRAM is used in FPGA at all.
#fluidsynth -is -a alsa -m alsa_seq /media/fat/soundfonts/SC-55.sf2

ROMS are only necessary for MUNT and SoundFont ".sf2" file is required for FluidSynth.

Thanks, I'll check out the new driver...
User avatar
Paradroyd
Captain Atari
Captain Atari
Posts: 300
Joined: Tue Sep 10, 2013 10:50 pm
Contact:

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by Paradroyd »

BBond007 wrote:
Paradroyd wrote: Yes..it responds, "paradroyd.com"
very strange while testing the telnet negotiations it seemed to work for me.

I typed "ATDTCOMMODORE80" probably 20+ times :) (which is my RPi in a C=64c case with C-16 keyboard which is why its called C=80)

I did figure out how to get my router to add a domain name.

Anyway, I added some logic that adds the domain name (provided you have one) if the host name does not contain any '.' characters.

Let me know if that is a good solution.

I think it will allow your config to work, without breaking people like me were it are working fine even without a domain name.

Thanks for testing!
Interesting. So "atdtcomserver" still fails exactly as it did before. It still says Invalid IP address --> 'COMSERVER'

But now, it seems to be adding my domain, "paradroyd.com" to everything with a dot in it, regardless if it should or not. I'll attach another screenshot...
20190115_231134.jpg
It seems I can't dial out with it like this.

BTW, the reason that there are 2 instances of "atdtcomserver" is that between the first and second instance, I added comserver explicitly to the host file on the MiSTer. It made no difference.
You do not have the required permissions to view the files attached to this post.
- Paradroyd
@paradroyd on Twitter, @paradroyd@mastodon.sdf.org on Mastodon
BBond007
Captain Atari
Captain Atari
Posts: 466
Joined: Wed Feb 28, 2018 3:23 am

Re: MidiLink 2.0 looking for testers. (no MIDI devices required)

Post by BBond007 »

Paradroyd wrote: But now, it seems to be adding my domain, "paradroyd.com" to everything with a dot in it, regardless if it should or not. I'll attach another screenshot...
That is because I was counting the number of 'c' in the string vs '.'

I don't know why as they are not even close on the keyboard.

It should be fixed now...
Locked

Return to “MiSTer”