Need help making a plugin, have no Nyquist knowledge...

Hi, I’m trying to make a simple plugin that will let me drag-and-drop .PCM files with a non-standard header into Audacity, rather than having to “import raw data” every time. The problem is I don’t know anything about Nyquist, and have no programming skills…

It was suggested I get help here when I opened an issue on the Audacity GitHiub:

What the plugin would need to do is when a .PCM file is dropped into audacity, it would check the first 4 bytes of the file for the header “MSU1” (Hex: “4D 53 55 31”), and if it has that header it imports the file with the following settings:

Encoding: Signed 16-bit PCM
Byte Order: Little-endian
Channels: 2-Channels (Stereo)
Start Offset: 8 bytes
Amount to Import: 100%
Sample Rate: 44100 Hz

On the GitHub it was suggested this would be possible with the “S-READ” command.

Any help with this would be appreciated, I don’t even know where to start…

Nyquist plug-ins do not support drag-and-drop, but I think it should be possible to create a plug-in that allows you to select a MSU1 file (via a file browser window) and import it (similar to using the normal “Import” from the File menu).

Could you post a short MSU1 file (less than 1MB) for me to try?
You may need to add “.wav” to the file name for the forum to allow it. See:

Here’s a little 3 MB MSU1 format PCM that I provided in the GitHub issue:
If that’s not suitable, I can whip up a shorter clip of something, I think I have some short SFX tracks I’ve used in some MSU projects…

I have a bit more technical info about the format (such as a screenshot of the header in a hex editor) in the GitHub issue: Native support of MSU1 format PCM files · Issue #702 · audacity/audacity · GitHub

Do any of Audacity’s supported plugin types support drag-and-drop?

Not as far as I’m aware.

Super - I’ll have a play and get back to you.

I assume from your description that MSU1 files are always stereo, so I’ve written this for stereo MSU1 files only.
I also assume that the sample rate is always 44100.

Unfortunately there’s a few limitations that I had to workaround, but hopefully this is still useful for you.

  • You must select a stereo audio track to import into.
    “Tracks menu > Add New > Stereo Track” to create a new stereo track.
    If you are doing this frequently, you could set up a keyboard shortcut - see:
  • The audio is always imported as 44100 Hz sample rate, so the track must be 44100 Hz sample rate.
    Audacity’s default sample rate is 44100 Hz, so you would not normally need to do anything about this.
  • The maximum length that can be imported is about 2.7 hours.
    I assume that this is plenty long enough.
  • Drag and drop is not possible.

Here’s the Nyquist plug-in:
MSU1-Importer.ny (972 Bytes)
Instructions for installing on Windows:

When installed and enabled, it will appear in the “Tools” menu (requires Audacity 2.4.2 or later).

Anyone care to post feedback? Does it work for you?

Sorry, the site’s been a bit unstable (whole site, not just the forum), and I kept getting 404 error messages while trying to check things. Seems to be working normally for now though.

Had some fun times getting Windows to let me copy the plugin into Audacity (they’ve really locked down the program files folder in Win10, lol), but with the file in place, the plugin installed, and things tested…

It seems to work as advertised.
It imports the MSU1 format .PCMs.
It cuts off the leading 8-bytes, so the header doesn’t get interpreted as audio data.
Bit rate and sample rate are both correct, so everything plays back at the proper speed and pitch.

It’s not an ideal solution. When working edits to just one or two files it may still be quicker to import raw data, thanks to the extra step of creating a blank stereo track to import into. However, this seems to be more a limitation of the plugin system, rather than a design flaw in the plugin.

That said, when I’m doing work on a large number of tracks, and I can import one track, edit it, save the changes (and run it through the not-related-to-audacity tool that converts it from WAV into MSU1 PCM), then delete it and import the next one, rinse-repeat… In that case it should give me a pretty decent time-save (since I’d only need to create the blank track once, and I’m usually doing that with batches of dozens of files).

All in all, I’d say this will be helpful to me, but falls slightly short of what I was hoping for due to the limitations of the plugin system.

May I have your permission to share this plugin on the Zeldix forums (pretty much the central hub for MSU-1 mods and development, despite nominally being a Zelda-centric forum)?

Yes, there’s recently been some changes to the web server. It should be much better now.

I hoping that eventually it will be possible for Nyquist plug-ins to do that part, but for now it has to be done manually. You can however create a keyboard shortcut to create a stereo track which may be just a little bit more convenient (see: Shortcuts Preferences - Audacity Manual)

Certainly. The plug-in is under terms of the open source “GNU General Public License version 2”

Still always polite to ask. :smiley: