JavaScript, Python, Java, C# API for manipulating, and writing MIDI [Modified]

Started by chikitin, January 23, 2019, 12:53:24 AM

Previous topic - Next topic

SeaGtGruff

That isn't a hex dump, it's just plain ASCII text. You may have used a hex editor— I don't know— but if you did, you need to display it in hex mode. I use a free hex editor called "Free Hex Editor Neo" from HHD Software.

Roger Brenizer

"Music Is My Life"
My best regards,
Roger

Got questions about the PSR Tutorial Forum? Reach out to us!

Tyros5Mad

Yes I used a hex editor. I just displayed the data in text mode.

I have come to the conclusion I am wasting time being a stubborn old (expletive). Midi Maker works just fine to produce playable style control midi files from my computer. including lyrics is very easy as well.

It takes a few seconds to load that midi file into Peter Weirsba's PRODUCER software and create an XF file that will load on the keyboard and can be expanded on the keyboard into a full song file (backing track with lyrics).

So That's what I will do for now. Back to the music.

RL

SeaGtGruff

If you can create a file that works, you might consider posting it for someone to look at. The reason I pointed out that the image you posted was just ASCII text is because we need to be able to see the actual hex code. And it's best if we can see the entire file, in case there's some special data chunk that needs to be added.

Tyros5Mad

Definitely requires a special chunk to be added. Here's the info from a document called xfspec.pdf (from Jorgens web site). And here's a working XF file. My problem is how to write the chunk. So far I have not been successful from my software. Peter Weirsba's Producer software can do it so I have been using that to load my file and save it as an XF file.

XF format data file structure
MThd......... Header Chunk (SMF)
MTrk......................... Track Chunk (SMF)
..(information header).......
....(karaoke)................
.......(karaoke).............
..............(karaoke)......
.............................
XFIH....(information header). XF Information Header Chunk
.............................
XFKM....(karaoke)............ XF Karaoke Message Chunk
.....(karaoke)...............
..............(karaoke)......
.............................

[attachment deleted by admin]

Jørgen

The Unofficial YAMAHA Keyboard Resource Site at http://www.jososoft.dk/yamaha
- since 1999


SeaGtGruff

As far as reading and writing MIDI song files, XF karaoke files, and SFF style files, I think sometimes it's better to just write your own program routines, rather than relying on a library of routines that other people wrote. You'll certainly learn a lot about MIDI messages and MIDI data that way-- and it's not really that difficult to read a MIDI file, parse the data chunks and messages in it, manipulate the data as desired, and write it to a MIDI file. Sure, it's "easier said that done," like everything else in life; but you'll need to learn about each type of message-- if only about its general format and length-- in order to parse it.

The situation is quite different if you want to handle streaming MIDI messages, either as input or output. If you want to transmit or stream MIDI data then you almost have to have a library of routines to use. Obviously, you could write your own higher-level routines if you want; but unless you have the technical know-how to write the lower-level routines that can accept data received over MIDI ports, or transmit data over MIDI ports, you'll definitely need an existing library for that.

Tyros5Mad

Hi Guys,

I think I have this figured out now. After comparing SMF and XF files I found what I had been missing all the time. The SMF data ends with a particular end of file character (0x2F). Then the extra data starts (XF chords tempo etc). That is why we cannot see this data with midi file player programs such as PSRUTI. PSRUTI knows there is extra data in the file but ignores it because it comes after the end of file character.

I wrote my MidiMaker software to create a style control midi file from a plain text song file. This works fine. I have a player that streams the data from the PC to the keyboard over USB.
Then I put the XF data inside this file before the EOF character and that data was ignored by the keyboard. That's why it did not work.

So theoretically I should be able to write a separate XF file, which just contains XF data and that should work at the keyboard or add the XF data after the track data in the SMF part of the file.

We will see. Back to Visual Studio.

Regards, Richard

[attachment deleted by admin]