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

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

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

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

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

Postby Sorgelig » Sun Jan 13, 2019 3:00 am

BBond007 wrote:In order to get ALSA to write to the device, asound.conf needs to be put in /etc

how i can run some simple test to output some periodic sound to this driver so i could try to catch the sound on fpga side?
I need something simple without the midilink. Like play some wav or anything else which will output constantly something.

User avatar
Paradroyd
Captain Atari
Captain Atari
Posts: 293
Joined: Tue Sep 10, 2013 10:50 pm
Contact:

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

Postby Paradroyd » Sun Jan 13, 2019 4:30 am

Sorgelig wrote:New MiSTer binary includes changes from BBond007, but i didn't announce it because other parts outside the binary aren't integrated yet.


Thank you!
- Paradroyd
@paradroyd on Twitter, @paradroyd@mastodon.sdf.org on Mastodon

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

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

Postby BBond007 » Sun Jan 13, 2019 6:24 am

Sorgelig wrote:
BBond007 wrote:In order to get ALSA to write to the device, asound.conf needs to be put in /etc

how i can run some simple test to output some periodic sound to this driver so i could try to catch the sound on fpga side?
I need something simple without the midilink. Like play some wav or anything else which will output constantly something.


I think maybe a predictable pattern like a sine wave would be best?

aplay /media/fat/sine.wav

You'll still need the supporting user-space stuff in the MidiLink.tar.gz
You do not have the required permissions to view the files attached to this post.
Last edited by BBond007 on Sun Jan 13, 2019 6:53 am, edited 1 time in total.

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

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

Postby BBond007 » Sun Jan 13, 2019 6:36 am

Paradroyd wrote:
Sorgelig wrote:New MiSTer binary includes changes from BBond007, but i didn't announce it because other parts outside the binary aren't integrated yet.


Thank you!


I have updated the MidiLink TCP option to include sending receiving stuff using from the linux space using Zmodem and also playing mp3 audio files.

I had to add "PCM timer interface" kernel option for mpg123 to work.

http://y2u.be/rFDFNRR7ObQ

User avatar
Paradroyd
Captain Atari
Captain Atari
Posts: 293
Joined: Tue Sep 10, 2013 10:50 pm
Contact:

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

Postby Paradroyd » Sun Jan 13, 2019 7:54 am

BBond007 wrote:
I have updated the MidiLink TCP option to include sending receiving stuff using from the linux space using Zmodem and also playing mp3 audio files.

I had to add "PCM timer interface" kernel option for mpg123 to work.

http://y2u.be/rFDFNRR7ObQ


Very cool ideas!

I ran the Midilink installer script again and I see the new options, but when I try to play an MP3, I get the following errors...
20190113_014251.jpg

20190113_014310.jpg


I thought I saw the script replace the kernel, so I'm not sure where the problem is.
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: 414
Joined: Wed Feb 28, 2018 3:23 am

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

Postby BBond007 » Sun Jan 13, 2019 8:04 am

Paradroyd wrote:
BBond007 wrote:I thought I saw the script replace the kernel, so I'm not sure where the problem is.


You have a USB sound device?

User avatar
Paradroyd
Captain Atari
Captain Atari
Posts: 293
Joined: Tue Sep 10, 2013 10:50 pm
Contact:

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

Postby Paradroyd » Sun Jan 13, 2019 8:19 am

BBond007 wrote:
Paradroyd wrote:
BBond007 wrote:I thought I saw the script replace the kernel, so I'm not sure where the problem is.


You have a USB sound device?


Ah..that was the part I was missing. It works well with a USB device plugged in. Thanks!
20190113_021559.jpg
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: 414
Joined: Wed Feb 28, 2018 3:23 am

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

Postby BBond007 » Sun Jan 13, 2019 8:27 am

Paradroyd wrote:Ah..that was the part I was missing. It works well with a USB device plugged in. Thanks!


That is good news :)

Sorgelig is working on getting rid of the USB DAC requirement :)

I have updated the error to be better in the meantime.

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

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

Postby Sorgelig » Sun Jan 13, 2019 9:01 am

BBond007 wrote:I think maybe a predictable pattern like a sine wave would be best?

aplay /media/fat/sine.wav

You'll still need the supporting user-space stuff in the MidiLink.tar.gz


yeah, the first obvious thing i've tried was aplay. Unfortunately it doesn't find any card.
aplay -l says there is no audio card installed.
aplay -L shouws one pcm device according to your config file.

Did you try aplay without any sound card plugged in?

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

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

Postby BBond007 » Sun Jan 13, 2019 9:04 am

Sorgelig wrote:
BBond007 wrote:I think maybe a predictable pattern like a sine wave would be best?

aplay /media/fat/sine.wav

You'll still need the supporting user-space stuff in the MidiLink.tar.gz


yeah, the first obvious thing i've tried was aplay. Unfortunately it doesn't find any card.
aplay -l says there is no audio card installed.
aplay -L shouws one pcm device according to your config file.

Did you try aplay without any sound card plugged in?


did you insmod or modprobe snd-dummy.ko?

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

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

Postby BBond007 » Sun Jan 13, 2019 9:12 am

this is what i get:

# modprobe snd-dummy
# ls /dev/MrAudioBuffer
/dev/MrAudioBuffer
# cat /dev/MrAudioBuffer
0xc0bfa1f0|512000|0|0|0
MrBuffer Address --> 0xc0bfa1f0
MrBuffer Size --> 512000
MrBuffer Index --> 0
MrBuffer Write Count --> 0
MrBuffer Max Write Length --> 0
Version .7a BBond007
# aplay /media/fat/sine.wav
Playing WAVE '/media/fat/sine.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
# cat /dev/MrAudioBuffer
0xc0bfa1f0|512000|204000|18|36010
MrBuffer Address --> 0xc0bfa1f0
MrBuffer Size --> 512000
MrBuffer Index --> 204000
MrBuffer Write Count --> 18
MrBuffer Max Write Length --> 36010
Version .7a BBond007
#

this is strange with aplay --> MrBuffer Max Write Length --> 36010

Fsynth and Munt are only send 300 - 500 bytes.

will test with MP3s.

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

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

Postby Sorgelig » Sun Jan 13, 2019 10:12 am

ah, i didn't insmod dummy driver.
I've thought it's not required if MiSTer audio is compiled in.

Now it looks like working.

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

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

Postby Sorgelig » Sun Jan 13, 2019 10:24 am

How non-48K rates will be handled? Will Alsa convert any rate to 48K before sending the data to the MiSTerBuffer?

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

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

Postby BBond007 » Sun Jan 13, 2019 10:34 am

Sorgelig wrote:How non-48K rates will be handled? Will Alsa convert any rate to 48K before sending the data to the MiSTerBuffer?


YES :)

ALSA is outputting to the fie specified in asound.conf which in our case is the audio buffer.

The audio buffer is just a character device in place of the file that moves that data into kernel space.

For whatever reason ALSA still requires a sound board to do this. snd-dummy is a virtual sound device for that purpose.

The benefits to this is that its should only output at the rate specified in asound.conf which is 48kHz so you won't need to support all sorts of bit-rates. The MidiLink only loads snd-dummy if no PCM is already present.

Good luck :)
Last edited by BBond007 on Sun Jan 13, 2019 10:37 am, edited 4 times in total.

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

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

Postby Sorgelig » Sun Jan 13, 2019 10:45 am

BBond007 wrote:The MidiLink only loads snd-dummy if no PCM is already present.

if i compile built-in snd-dummy will it preventwork of Midilink?
I want to find some common configuration where every utility will be happy.

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

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

Postby BBond007 » Sun Jan 13, 2019 10:46 am

Sorgelig

Do you think it would also be theoretically possible for me write an AHI driver to let the Minimig core use the buffer as an audio device? AHI is for sound what the Picasso/CGFX is for video.

Thanks

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

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

Postby BBond007 » Sun Jan 13, 2019 10:51 am

Sorgelig wrote:
BBond007 wrote:The MidiLink only loads snd-dummy if no PCM is already present.

if i compile built-in snd-dummy will it preventwork of Midilink?
I want to find some common configuration where every utility will be happy.


I have not tried it that way, but it should work just fine.

It does make supporting an external sound device a little more complicated. Right now the logic is simple. no sound device, snd-dummy gets loaded.

If you have more than one sound device, then configuration gets more complicated.

If you leave it modular, for testing purposes you can compare results with USB sound vs the buffer as they will both work simultaneously..

thanks

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

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

Postby Sorgelig » Sun Jan 13, 2019 11:18 am

The target is to output the audio through MiSTer audio outputs. So i don't care of USB audio cards - it's just temporary and not convenient solution.
What i mean is smooth config between midi playback and aplay to output through MiSTerBuffer.

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

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

Postby Sorgelig » Sun Jan 13, 2019 11:29 am

Is there a way to limit the writes to smaller amounts spread evenly? Otherwize FPGA side will need to use large fifo buffer.

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

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

Postby BBond007 » Sun Jan 13, 2019 12:19 pm

Sorgelig wrote:Is there a way to limit the writes to smaller amounts spread evenly? Otherwize FPGA side will need to use large fifo buffer.


I don't know of a way for ALSA to do it, but I guess its possible to have the circular buffer driver chop the data into smaller parts, but I then worry about what happens if you get another large write while you are still processing the previous one.

with MUNT and FSYNTH small packets are written frequently. I actually never tried it with aplay utility until today...
Last edited by BBond007 on Sun Jan 13, 2019 1:12 pm, edited 2 times in total.

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

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

Postby Sorgelig » Sun Jan 13, 2019 1:05 pm

i think i will switch from RAM buffer to SPI. It will be easier to catch the data on FPGA side.
Still if alsa writes buffers up to 32768 (is what i see from your driver statistics) then i will need to use fifo of this size (use BRAM!) in FPGA.
32768 means 8192 samples per channel. Of course need to take in account that buffer should cover all interrupts in audio writes so there won't be audio clicks and pops. In recent MiSTer release the main thread had been moved to another CPU1 leaving CPU0 for OS usage.

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

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

Postby Sorgelig » Sun Jan 13, 2019 4:19 pm

got weird result using SPI. There is a sound but it seems a lot of samples are missing. It looks like ALSA syncs the rate very seldom. It pushes a lot of data before sync occurs. And it's unclear what is the rate of sync points.
So probably i have to return to original idea using DDR3 memory where big buffer can be allocated without using much FPGA resources.

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

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

Postby BBond007 » Mon Jan 14, 2019 1:50 am

Paradroyd wrote:I've been using Term on the Amiga, Procomm Plus and even the Windows 3.1 terminal on AO486 with this with great success. Looking forward to trying The Atari ST core with it later tonight.


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 :)

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

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

Postby BBond007 » Mon Jan 14, 2019 2:26 am

NegSol wrote:I like the current way of handling MidiLink in the menu. It is easy enough. Also I like I can kill off the mt32d threads by simply switching to TCP. Helps whenever a note gets stuck due to unexpected reboots :-) - All in all the sound is amazing - I dare to say that it is much like the original HW and could be better once we get the mixing done internally. It is cheaper in any case... original midi sound modules getting expensive these days.


Yes, I know the situation with the stuck notes when you reboot or crash, and its super annoying...

Anyway, now cycling through the uartmode options (and re selecting MLINK or MLINK-38K) should clear those stuck notes on real your MIDI module as well.

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

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

Postby Sorgelig » Mon Jan 14, 2019 4:10 am

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


Return to “MiSTer”

Who is online

Users browsing this forum: reelbigeddy, reflex and 9 guests