Author Topic: Transfer PSR 340 User Songs  (Read 200 times)

0 Members and 1 Guest are viewing this topic.

Offline nadir

Transfer PSR 340 User Songs
« on: November 03, 2017, 07:00:13 AM »

I have dozens of user songs created on my old PSR 340 (with built in floppy disk), saved in its native format (extension .340)

Is there any way I can transfer them into the PSR s770 ?


Online SeaGtGruff

Re: Transfer PSR 340 User Songs
« Reply #1 on: November 03, 2017, 01:19:55 PM »
You might be able to extract the MIDI data for the songs. I don't know what format the PSR-340 stored its User Songs in, but the following might be helpful:

That page deals with Bulk Dump files, but the portion that applies to the User Songs may be relevant. The newer PSR-E models use a format that's similar to the one described on that page, although there are differences depending on the particular model and its capabilities. You'll need to use a hex editor to examine the files to see what they look like, which might be tricky if you have no prior familiarity with hex editors or hexadecimal data in general.

The PSR-E models store their User Songs in one of two file types-- User Files (with extension .USR) and Backup Files (extension .BUP)-- but fortunately the User Song data format is the same in both types of files, although there are other things that are different about them. I know you're talking about an older model-- the PSR-340, not the PSR-E343/YPT-340-- but the reason I mention the PSR-E User Files and Backup Files is because both contain additional information besides the User Songs, so before you can examine and extract the User Song data from them it's necessary to first determine the location of the User Song data section within the file. I don't know if your PSR-340 song files also contain additional information, but it's very likely that you'll need to figure out where the User Song data begins. The actual MIDI data is stored in "MTrk" data chunks, so that should help in finding it.

Aside from learning your way around a hex editor and hexadecimal data-- unless you're already familiar with those things, which would be a help-- there are two main issues you'll have to deal with in trying to extract the User Song data yourself.

The first issue is that the "MTrk" data for each User Song isn't necessarily contiguous inside the file, but is most likely split up into 512-byte blocks which might be arranged in any order, even with data blocks from other User Songs between them. There are two tables in the file, located before the actual "MTrk" data, which are briefly described on the above page as "Beginning blocks" and "Next blocks." So for each User Song you'll need to make a note of which block each track begins in, as well as which blocks (if any) it continues in. Then you'll need to extract each sequence of blocks in the correct order and remove any extra data from the last block (i.e., since each block contains 512 bytes, it's very likely that the last block will contain a number of unused bytes). The exact format of these two tables may differ somewhat from the tables used by the PSR-225-- e.g., the PSR-E files that I've looked at don't have a "Time track"-- so you'll need to examine them carefully to determine what their exact format is.

The second issue is that the User Songs are not stored in the Standard MIDI File format, because they consist of only the "MTrk" chunks; there are no "MThd" chunks. What this means is that-- in addition to extracting the appropriate blocks for each track and putting them in the correct order, stripping off any unused bytes from each reassembled "MTrk" chunk, and collecting all of the "MTrk" chunks for a given User Song together-- you'll also need to create a suitable "MThd" chunk and insert it in front of the first "MTrk" chunk. That's not too difficult, but the problem is that there's no way to be sure about the correct PPQN (Pulses Per Quarter Note), so you'll probably need to choose a value, see how the song sounds, and adjust the PPQN as needed until the song sounds okay. Basically, the PPQN determines how fast or slow the song will play back, because it tells the keyboard how long each "tick" of the MIDI clock is, and the keyboard will interpret the Delta-Time values of each Note event accordingly. If I remember correctly, the PSR-E models use a PPQN of 128 for their User Songs, so you might start out with that and adjust it as needed-- increasing the PPQN will make the song play back faster, and decreasing the PPQN will make it play back slower.

Those two issues are related to simply extracting the User Song data and saving it as Standard MIDI Files. But if you get past those two issues and successfully extract the data, there is another issue which will need to be addressed-- namely, the differences between the two keyboards as far as their Voices, Styles, and the specific MIDI messages they use. It should be easy enough to replace the Voices as appropriate by editing the Bank Select and Program Change values, but you'll also need to check the XG SysEx messages for the Reverb Type, Chorus Type, and other things (e.g., DSP insertion effects, variations, etc.). And if you'd used a Style when recording a User Song then it will be even more tricky, because on the models I'm familiar with the Style parts aren't recorded as Note data, but are instead recorded as Sequencer-Specific Meta Events which select the desired Style Number and initial Style Section, then record the Chord Changes and Section Changes. If you extract a User Song and play back the resulting Standard MIDI File on the same model of keyboard it was extracted from, it will sound okay; but if you play it back on a different model, it's almost certain that the wrong Style will be selected, and the Style might not play back at all, depending on what differences there are between the Sequencer-Specific Meta Events of the two models.

So, the short answer is "Yes," there is (possibly) a way that you can transfer your old PSR-340 User Songs into your PSR-S770, but the process might be fraught with numerous difficulties and pitfalls. And if you have no prior familiarity with the use of hex editors, or with viewing and understanding hexadecimal data in general-- or, for that matter, MIDI data in general and the Standard MIDI File format in particular-- then you might want to reconsider whether this is something you'd like to tackle. It could be a fun and rewarding effort, or it could be a frustrating and maddening experience.
Michael Rideout
YPT-400, PSR-E433, PSR-E443
The following users thanked this post: nadir

Offline nadir

Re: Transfer PSR 340 User Songs
« Reply #2 on: November 03, 2017, 02:05:33 PM »
Thank you so much for the response.
I really appreciate you taking the time to answer is such detail.

As it happens, I do have some familiarity with the hexadecimal data, so perhaps I'll give it a go.
It's just that I was hoping there was an easier way -perhaps some kind of sofware to convert those old user songs.

Again, thanks.


Online SeaGtGruff

Re: Transfer PSR 340 User Songs
« Reply #3 on: November 03, 2017, 06:00:01 PM »
If you want to post one of the files here, I'd be interested in seeing what the file format looks like.
Michael Rideout
YPT-400, PSR-E433, PSR-E443