Append Import

Thanks, that was a bug. I think that I’ve fixed it now, but please recheck this in the next version if you can on Windows 8 in case it does something weird.


Sadly no.
Plug-ins can only return one result to Audacity (other than debug text). So you can either return the audio, OR labels, but not both.


Nyquist is unaware of the cursor position or the track start time. The start time for Nyquist is “time = zero” and Audacity puts “time = zero” at the cursor position.
This is part of the wish-list feature that I’ve been discussing with Robert J. H. here: Information passed from Audacity to Nyquist


I’m not sure why it does that… I think that is an Audacity bug, possibly related to http://bugzilla.audacityteam.org/show_bug.cgi?id=425
The sound exists in Nyquist, but Audacity is truncating it to the shortest channel.
I can work around the problem by padding the shorter channel with silence at the end.

“Nyquist” only supports ASCII. In cases where Nyquist does not need to “understand” the characters (if Nyquist can just treat the string as a series of one byte characters), non-ascii characters will often not cause a problem, but in the case of “reading” the file list, Nyquist runs into the Unicode character and produces the “invalid octal digit” error. I don’t think that I can do anything about this. The “fix” is for Nyquist to support Unicode, but I guess that is a long way off.

Thanks for the help screen suggestions. The new version is:

Append Import will look in the ‘Import Folder’ for
‘filelist.txt’. If found, it will try to read each
audio file listed in ‘filelist.txt’ and ignores any
audio files in the Import Folder. If not found, all
supported audio files in the Import Folder will be
loaded in alphanumeric order.

The default Import Folder is:
“/home/steve”.

Supported file types .WAV .AIFF and .AU must have
valid file extensions. If used, ‘filelist.txt’ must
contain only a list of uncompressed audio files.
Each file must be on a new line and must be either:

  1. A file in the ‘Import Folder’
  2. A fully qualified file name.

Import Mode:
‘Sequential’ will append the files end-to-end.
‘Alternate Channels’ will assume that the first file
is intended for the left channel, the next file for
the right, and so on.

To see a list of imported file names, click the
Debug button.


IMO, the biggest limitation is the lack of a file browser for Nyquist plug-ins. I don’t think that the developers ever really expected Nyquist to be used for anything more than simple experimentation. As Nyquist plug-ins are becoming more sophisticated they are running into the limitations of the very basic interface. It’s not only the GUI limitations, but the limited interaction between Audacity and Nyquist. I hope that we can find a developer that is interested in developing Nyquist functionality in Audacity.

List of changes in this version:

  • Bug fix for empty ‘Import Folder’.
  • Debug window indicates if no files found (rather than just an empty debug window).
  • The debug window now shows the import folder path before the list of imported files.
  • If one channel is shorter with Alternate Channel mode, pad the shorter channel with silence.
  • First help screen updated.
    AppendImport.ny (9.67 KB)

Looks OK on Win 7. will check XP and 8/ OS X later unless there is a volunteer on Mac?

I think this is sufficiently unintuitive that it ought to be mentioned in the second help screen.

Could the plug-in write a label.txt file to the import folder when importing the file, then if requested, import the label file, which doesn’t care about the cursor position?

Even it if could write the label file, I guess it would have to be optional, as some people might find it useful, but for others it would be clutter to be cleaned up.

I would still rather give people a bit more help here, given Windows and Mac hide extensions by default.

How about

Supported file types: .WAV .AIFF and .AU. If used,
'filelist.txt' must contain one file per line and 
each line must be either:
1) The name of a file in the Import Folder, 
including the extension - for example, tune2.wav 
2) The fully qualified path to a file in another 
folder - for example, C:\My Music\tune2.wav.n

Gale

Yes I can go for that, but it’s an extra line and we’re already up to the 25 line limit for 800 x 600, so we’ll need to lose a line somewhere - perhaps the blank line between:

loaded in alphanumeric order.

The default Import Folder is:



I’ll have a look tomorrow. Better would be if Nyquist could access “Audacity track time”, but it can’t :frowning:
I agree that it is not intuitive, but at least it is easily discoverable.

It could still be wrong because the imported files are relative to the cursor position.

The limitations are quite frustrating, and the limitations for help screens exacerbate the frustration.

Yes, I had not taken into account the n, only the real line usage in the plug-in.

I think your suggestion is OK, or trim the “alternate channels” text to two lines:

'Alternate Channels' assumes the first file is for
the left channel, the next for the right, and so on.n

53 characters, but some lines already use more than that.

Yes but at least import (of the audio) at the cursor is a feature. :slight_smile:

If doable, it would reduce the limitations. Import at zero, move the cursor to play a bit of it, then import labels (surely a common scenario) would then still have the labels in the correct position.

I agree it would need two labels choices, “Labels at cursor”, “Labels from file” (or some such). That would be useful but then you probably need a choice not to create the label file (or an action to delete it, called from the plug-in).


Gale

Windows 8 and Mac OS X 10.7.4 seem OK with detecting the working directory if the “Import Folder” field is left empty. I still have to check Win XP.

On Windows, I found two more behaviours to note with filelist.txt import.

Windows XP and later uses “natural number sort” that makes “file10.wav” come after “file2.wav” rather than before, but if the file name has a letter preceding a number, this sort makes that file name come before a name that has only numbers.

So the plug-in imports in this order:

S:7_datae00d00e0000005.au
S:7_datae00d00e00002c9.au
S:7_datae00d00e0000317.au
S:7_datae00d00e0000556.au
S:7_datae00d00e000059a.au
S:7_datae00d00e00007ad.au
S:7_datae00d00e0000904.au
S:7_datae00d00e000095c.au
S:7_datae00d00e0000bc5.au
S:7_datae00d00e0000bf2.au
S:7_datae00d00e0000cf0.au
S:7_datae00d00e0000d2a.au
S:7_datae00d00e0000dbe.au

but Windows ascend-sorts the files this way:

S:7_datae00d00e0000bc5.au
S:7_datae00d00e0000bf2.au
S:7_datae00d00e0000cf0.au
S:7_datae00d00e0000d2a.au
S:7_datae00d00e0000dbe.au
S:7_datae00d00e00002c9.au
S:7_datae00d00e0000005.au
S:7_datae00d00e00007ad.au
S:7_datae00d00e000059a.au
S:7_datae00d00e000095c.au
S:7_datae00d00e0000317.au
S:7_datae00d00e0000556.au
S:7_datae00d00e0000904.au

Also I noticed if you change the file names in the directory and reimport the files, the order imported in does not change in that session.



Gale

Unfortunately there is no international standard for alphanumeric order, so inconsistencies can and do occur.
Nyquist uses “character by character” alphanumeric ordering (as does Windows 2000) while Windows XP and later file name sorting considers numbers in strings in file and folder names as numeric content, not text (as does Linux).

We could change:

If not found, all
supported audio files in the Import Folder will be
loaded in alphanumeric order.

to:

If not found, all
supported audio files in the Import Folder will be
loaded in alphanumeric character order.

hallo everyone,

recently i’m using this wonderful plugin and it could be useful to create sample sequences and load them on my Korg ESX-1 as “slice samples” (as in this video http://www.youtube.com/watch?v=lGctUPri1ew )

in order to do that, i could use samples with clear attack and end… otherwhise, after importing appended files, i’d separate the samples one by one in order to create a little silence between them…

but if there were an option to do that during the import… i’d find it more than useful!
do you think it could be possible to implement that? or any tip to save time on this operation?

thanks in advance and my compliments to the writers of this plugin!

You could also try my Plug-in:
https://forum.audacityteam.org/t/arrange-your-tracks-with-chain-it-up-ny/26201/1
You import the files via the import menu.
Select all tracks and start the plug-in.
For a pause of 300 ms just enter 0.3 in the gap control.
Once the tracks are arranged, you can mix them down or simply export which will do the same.

thank you! chainin’ it up! :smiley:

A feature request has been made for Append Import - a way to mark the joins between the imported files.

It was suggested to insert silence at the joins but you could also label the joins or add split lines there (or perhaps only the C++ version could do that)…


Gale

Nyquist plug-ins can currently only return one “result”. Thus a plug-in can return audio (the appended track) OR labels, but not both on the same pass.
The split positions can be saved in RAM between one pass and the next, so it would be possible (though not hugely convenient) to run an effect twice, returning the audio on the first pass and a label track on the second pass.

When Nyquist plug-ins return audio, Audacity always renders the audio as one continuous audio clip. It is not currently possible to return more than one audio clip from a Nyquist plug-in. Thus “split lines” and “white space” are not possible from Nyquist plug-ins.

Perhaps a better option would be a development of the (new) “Align End to End” feature (Tracks menu in Audacity 2.0.4).
Something that I had this mind while developing “Align End to End” was another function that behaves similarly to Align End to End, but moves all of the audio tracks onto the same track (and removes the, then empty, tracks). I’ve been trying to think of a more user friendly name for this function than “Concatenate”. Any suggestions?

I would much prefer to label the joins rather than adding silence.

WC

Perhaps “Align into one Track”?

But would this add Split lines? I’ve been suggesting users do Tracks > Mix and Render to do what you suggest (which doesn’t add Split lines).

I’ve little doubt that a dedicated C++ Append Import with a file browser and customisations for “import first file at the cursor” and “methods to demarcate the joins” is the best way to go.


Gale

That’s the idea (otherwise it’s no better than Align End to End followed by Mix and Render).

Perhaps, though it probably depends on the user case, but I doubt that is going to happen within the next few years.

I sometimes doubt that sufficient improvements to Nyquist will happen within the next few decades.

I would expect Feature Requests for a full Append Import feature will grow as a result of the Align End to End feature (useful as that is in its own right).


Gale

Tell me about it, :sigh: though most of the limitations do not come from Nyquist itself, but from the primitive interface provided by Audacity.

A “full Append Import feature” could certainly be useful.
I’d imagine that much of the demand will come from people wanting to stitch together broken projects (weird that I’ve never needed to do that).

The currently posted Append Import does not work in HEAD (Nyquist did not return audio) :

error: unbound variable - *FILE-SEPARATOR*
if continued: try evaluating symbol again
Function: #<FSubr-SETQ: #4108070>
Arguments:
  *DEFAULT-SF-DIR*
  (STRCAT (STRING-RIGHT-TRIM " \/" *DEFAULT-SF-DIR*) (STRING *FILE-SEPARATOR*))
Function: #<Closure-IMPORT: #4098e20>
Function: #<FSubr-IF: #41071e0>
Arguments:
  (< OUTPUT 2)
  (IMPORT)
  (MAKE-LABELS)
Function: #<FSubr-CASE: #4105480>
Arguments:
  VIEWHELP
  (1 (HELP))
  (2 (LABEL-HELP))
  (3 (LIMITATIONS))
  (T (IF (< OUTPUT 2) (IMPORT) (MAKE-LABELS)))
1>

It does work in 2.0.6 Release.

Gale

FILE-SEPARATOR is a predefined Nyquist variable (global). It should return the ASCII character for the file separator (OS dependent).

Please try this in the Nyquist Prompt (should work in both “normal” (version 4) and “legacy (version 3) syntax”:

(print *FILE-SEPARATOR*)

and press the Debug button.

The debug output on Linux is:

#/

which is correct.

On Windows it should return (in the debug window):

#\

I’m not sure what it should return on Mac OS X, I’d guess either the same as Linux or #:

On Mac it returns the same as Linux.
– Bill

For both Version 3 and 4 the debug output is:

error: unbound variable - *FILE-SEPARATOR*
if continued: try evaluating symbol again
1>

In 2.0.6, as expected:

#\

Sample Data Export is broken as well in HEAD:

error: unbound variable - *FILE-SEPARATOR*
if continued: try evaluating symbol again
Function: #<FSubr-SETQ: #4120858>
Arguments:
  FILESEPARATOR
  (FORMAT NIL "~a" *FILE-SEPARATOR*)
Function: #<Closure-FILEWRITER: #4109a28>
1> sample-data   1 channel (mono)
Sample Rate: 44100 Hz. Sample values on dB scale.
Length processed: 100 samples 0.00227 seconds.


error: unbound variable - FP
if continued: try evaluating symbol again
Function: #<FSubr-CASE: #411dc68>
Arguments:
  HEADER
  (0 (FORMAT T (NORMHEAD)) (FORMAT FP (NOHEAD)))
  (1 (FORMAT T (NORMHEAD)) (FORMAT FP (MINHEAD)))
  (2 (FORMAT T (NORMHEAD)) (FORMAT FP (NORMHEAD)))
  (3 (FORMAT T (NORMHEAD)) (FORMAT FP (FULLHEAD)))
Function: #<Closure-PRINTDATA: #410b098>
Function: #<FSubr-IF: #411f9c8>
Arguments:
  (= FILEFORMAT 4)
  (PRINTHTML)
  (PRINTDATA)
Function: #<FSubr-PROGN: #41202d8>
Arguments:
  (PUT-HEAD-INFO)
  (IF (= FILEFORMAT 4) (PRINTHTML) (PRINTDATA))
Function: #<FSubr-IF: #411f9c8>
Arguments:
  (> (LENGTH ERR) 0)
  (IF (= MESSAGES 2) (S-REST 0) (FORMAT NIL "Error.~%~a" ERR))
  (PROGN (PUT-HEAD-INFO) (IF (= FILEFORMAT 4) (PRINTHTML) (PRINTDATA)))
Function: #<FSubr-SETQ: #4120858>
Arguments:
  FILESEPARATOR
  (FORMAT NIL "~a" *FILE-SEPARATOR*)
Function: #<Closure-FILEWRITER: #4109a28>
2> 1>

Gale