vuori / linux-minidisc

Free software for accessing MiniDisc devices (fork with NetMD fixes—use upstream for HiMD devices)
GNU General Public License v2.0
44 stars 9 forks source link

Transfer ATRAC1 in .aea container format #6

Closed Invictaz closed 3 years ago

Invictaz commented 4 years ago

Can there be support for https://github.com/dcherednik/atracdenc

So that we can transfer the encoded .aea files (ATRAC1) to Minidisc devices?

vuori commented 4 years ago

As far as I can tell, Sonicstage doesn't support transferring ATRAC1 as-is. If a feature is not in Sonicstage, it's unlikely to be supported by device firmware.

Invictaz commented 4 years ago

@vuori That is weird, since the recently started project https://github.com/gavinbenda/platinum-md/ for Mac supports it (even though only LP2 mode and not LP4) by use of the same encoder.

How does SonicStage now transfer ATRAC1 files to a normal 80 min Minidisc?

vuori commented 4 years ago

The LP modes are ATRAC3. Transferring those already works, though they need to be put into a WAV container because that's the only format that netmdcli currently understands.

If Sonicstage supports ATRAC1 (SP) files at all, they'll be decoded to PCM and re-encoded on the device.

Invictaz commented 4 years ago

Ah so LP2 is ATRAC3.

However, according to this scheme (see point 9), tracks can be downloaded to the MZ-RH1 in SP mode when originally formatted MD media is placed. So technically it should be possible?

https://www.minidisc.org/hi-md_faq.html#r_q95

vuori commented 4 years ago

The MZ-RH1 is a very special device that can do things that are impossible on other devices. If you have one (or any HiMD device), you should use the HiMD tools in this project to operate it instead of the NetMD tools. My fork is only concerned with the NetMD code, so it's better to use code from the official repeo with HiMD devices.

Invictaz commented 4 years ago

I certainly have one, bought it just before the insane price inflation. The thing is that I don't want to use the HiMD tools as I have another Sharp MD device that I use on the road (unfortunately no NetMD). So I would like to transfer the SP files to the RH1 and then take the disc out and put it into the Sharp.

Recording stuff via line-in or toslink in realtime takes an absolute age.

vuori commented 4 years ago

Interesting use case, but I can't really help since even if SP "download" (computer-to-device transfer) is possible with the RH1, it's unlikely to be possible with anything I have and there's no indication how such capability might be activated in the existing NetMD code.

If you're interested in figuring this out, the best bet would be to fire up Sonicstage, try to get it to transfer SP files, sniff the USB traffic and figure out whether it's transferring PCM or something else. In the function netmd_secure_send_track, just before the encrypted song transfer starts you can see an initialization command is sent telling the device what the incoming data format is (wireformat). If you can catch that command when sent by Sonicstage, you can compare the wire format it sends to the NETMD_WIREFORMAT_* constants; if it's a value that's not currently sent by libnetmd, it might be that SP download is happening.

Invictaz commented 4 years ago

Taking the MZ-RH1 on the road is just way too risky. That's why I would like to make such files. The other Pioneer Deck I have is just a normal deck, no MDLP.

Is it possible with the HiMD code to transfer SP files? If so, the problem is partially solved.

How to sniff the USB traffic?

vuori commented 4 years ago

Sorry, I don't know anything about the HiMD code or protocol so I can't say.

I think Wireshark can sniff USB packets on Windows (the installer asks about installing a USB capture driver), but I haven't had to resort to that yet myself.

Invictaz commented 4 years ago

image

If we look at this scheme (6th column, 2nd row), ATRAC-SP to NetMD mode is possible with the current linux-minidisc on RH1 and other NetMD devices. Although maybe in a WAV container? If that matrix is correct I don't have to sniff the USB traffic.

Atrac3Denc does not currently support WAV containers, but maybe I can ask the developer for it.

vuori commented 4 years ago

There's no support for SP download in the code. See the netmd_wireformat enum in secure.h for implemented transfer formats.

Invictaz commented 4 years ago

@vuori So that matrix is incorrect? It's been there for years.

vuori commented 4 years ago

I'm not aware of code for such support existing anywhere.

Invictaz commented 4 years ago

That's weird because there is the upload.py script here (or downloadhack.py)

https://wiki.physik.fu-berlin.de/linux-minidisc/doku.php?id=netmdpython

And described here there is https://www.minidisc.org/NetMD_faq.html#_q83

That the track is converted from the format into PCM, then encrypted and then transfered.

vuori commented 4 years ago

"Upload" is Sony-speak for transfer from MD to PC. What you're asking for in Sony-speak is "download", i.e. transfer from PC to MD.

Obviously PCM download is possible and is probably what most people use. The device performs the SP encoding in this case. This is of course quite a bit slower than transferring compressed data, which is what happens in LP2/LP4 transfer.

Invictaz commented 4 years ago

PCM download is the 12x speed that is mentioned in the NetMD reverse engineering spec. However that is referring to USB 1.1 when the RH1 is USB 2.0 (so 480mbit). Having not to re-encode (would be useless if you can do it now on PC even in the Windows build) would save a lot of time.

I'm waiting for the LP4 to come to ATRAC3DENC so I can try LP4 downloads.

vuori commented 3 years ago

Closing this as ATRAC1 transfer does not appear to be supported by hardware and ATRAC3 improvements depend on another project.

Invictaz commented 3 years ago

@vuori well @deenine added-this to Platinum-MD. So maybe you want to look there. He transfers .aea FROM the minidisc. Not to unfortunately.

deenine commented 3 years ago

@Invictaz I didn't do anything smart with that patch, just used the existing functionality in the himdcli code.