npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

networkwm-js

v0.1.0

Published

A library which lets you manage tracks and metadata on Sony Network Walkmen.

Downloads

13

Readme

Work In Progress!!

JS library for accessing Sony Network Walkmen

This library aims to provide support for managing audio content on Sony Network Walkman devices. It supports the same functionality as SonicStage - the original Sony application required to communicate with them.

For now, it is impossible to use this library as a standalone application - there's no CLI available.

What features are available?

  • [x] Track upload (ATRAC3 / ATRAC3+)
  • [x] DRM reimplementation
  • [X] Fetching contents' list
  • [ ] Track upload (MP3)
  • [X] Track metadata editing (Title / Album / Artist / Genre)
  • [X] Track moving
  • [X] Track deletion
  • [ ] OMA file decryption

How to incorporate it into your project?

The library piggybacks on himd-js to provide low-level filesystem and SCSI functionality. Because of how the DRM requires vendor SCSI commands to be sent to the Network Walkman, it is impossible to upload a track and have it play on the device without SCSI access, but similarly to himd-js, it provides a way to edit the player's metadata.

1 - Metadata access only

In this mode, it's only possible to read and write tracks' metadata (titles, track play order, etc.)

It is not possible to upload ATRAC3/3+/PCM with this mode.

Example:

async function example(){
    // When using Node.JS:
    const fs = new NativeHiMDFilesystem("/path/to/HiMD/root");

    const database = await DatabaseAbstraction.create(fs);
}

2 - Direct mode (USB Mass Storage Controller mode)

Because this mode takes full control over the Network Walkman, and can issue direct SCSI commands, it's possible to upload ATRAC3/3+ audio.

All the examples from mode 1 which utilize the DatabaseManager object still work.

Example:

async function example(){
    await initCrypto();
    importKeys(...);
    const _dev = await openNewDeviceNode();
    if(!_dev) {
        console.log("Could not connect!");
        return;
    }
    const { dev, name } = _dev;
    console.log(`Connected to ${name}`);
    const fs = await createNWJSFS(dev, false);
    // Open a writing session
    const session = new UMSCNWJSSession(fs.driver as SonyVendorNWJSUSMCDriver, fs);
    await session.performAuthorization();

    const database = await DatabaseAbstraction.create(fs);

    // Read the track
    const trackContents = new Uint8Array(nodeFs.readFileSync("/path/to/raw/atrac.wav")).slice(0x60);
    const codec = generateCodecInfo("A3+", HiMDKBPSToFrameSize.atrac3plus[352]);
    database.uploadTrack({
        album: "Foobar - The Greatest Hits",
        artist: "Foobaz",
        genre: "Bar",
        title: "Foobar",
        trackDuration: -1,
        trackNumber: -1, // Guess the track number
    }, codec, trackContents, session);

    await database.flushUpdates();
    await session.finalizeSession();
}

It is also possible to use this library to simply sign the device, so that it plays audio which could have been copied across from a different Network Walkman. To do that, it's simply enough to perform the authorization, and then finalize the session straightaway.

async function example(){
    await initCrypto();
    importKeys(...);
    const _dev = await openNewDeviceNode();
    if(!_dev) {
        console.log("Could not connect!");
        return;
    }
    const { dev, name } = _dev;
    console.log(`Connected to ${name}`);
    const fs = await createNWJSFS(dev, false);

    // Start a new session...
    const session = new UMSCNWJSSession(fs.driver as SonyVendorNWJSUSMCDriver, fs);
    await session.performAuthorization();
    // ...and terminate it
    await session.finalizeSession();
    // At this point, the Walkman should play the audio.
}

Credits

  • Thank you to M Karcher over at the MiniDisc.wiki Discord server for explaining how the OpenMG keys deriving and SCSI authentication works
  • The rustystage project provided excellent documentation of the database format.