And another bug - for “alternate channels”, left and right were wrong way round.
Thanks for the update…
Help screen for the new feature:
When importing files sequentially, the files are
‘merged’ into one track with no split marks. Sometimes
it is useful to be able to see where each track starts
and ends, so the plug-in provides the ability to create
labels for each imported file.
To create labels for each file AFTER successfully
running Sequential Import, run the plug-in again with
‘Output’ set to ‘Labels’.
The labels will be retained by the plug-in for use at
any time after running Append Import in ‘Sequential’
mode for the duration of the Audacity session. Running
Append Import again in Sequential mode will replace
the labels stored by the plug-in with labels for the
most recent import.
Tip: To view a help screen in a form that can be easily
copied, use the Debug button with ‘View Help’ enabled.
Remember to deselect Help before running the plug-in.
It still needs thorough testing as there have been quite a lot of code changes, but here’s the new version.
Normally I’m not keen on Nyquist plug-in help screens, but due to limitations in the Nyquist plug-in interface I think that this plug-in requires some built-in help. For this reason I’ve kept the help screens and a little bit of advice in the GUI.
AppendImport.ny (8.88 KB)
It looks OK to me, but I’d appreciate a second opinion
Tested on Windows 8 (just to be awkward). If the “Import Folder” field is empty and I choose “Sequential”, “Mono” (or “Stereo”) I get a message “Directory “” does not exist" (with no Debug output). The “Usage” help states the working directory correctly, though. This is true whether the working directory contains importable files or not.
The labels seems like a nice feature. I take it we cannot have a control:
“Label sequential import” Yes, No
that does the labelling at import time, and remove that choice from “Output”? This would be much more user-friendly I think.
If we don’t change that, should labelling not just work on the audio at its current Timeline position? It seems un-necessary to label starting at the cursor point because user could have moved the cursor or selection, meaning the labels will be in the wrong place.
I see from the code that “Alternate channels” assumes equal file length, but could it not fill the empty channel with silence if the files are different length, rather than truncate the file?
I know file lists only support ascii but I should probably relate the following anyway. I had a problem with a character in a file name in filelist.txt that looks like 2D hyphen-minus (and is identified as such if I paste it into various online checking tools) but it causes filelist.txt import to fail. The file itself imports OK from the folder it is in if filelist.txt is not in that folder.
I added the file name to filelist.txt by F2 and copy-paste. I assume it is really not hyphen-minus as if I replace it with a hyphen typed on my PC keyboard, the error goes away. The wav file came from a Mac; I attach the filelist.txt file.
Here is the result when the Import Folder is S:Filesfilelist.txt and that file contains that hyphen character:
Contents of filelist.txt:
S:NoiseRemovalSamples1NoiseRemovalSamplesRock1-start.wav error: invalid octal digit Function: #<Subr-(null): #6cf5be8> Arguments: #<Unnamed-Stream: #6d14238> #" Function: #<Subr-(null): #6cf5b88> Arguments: #<Unnamed-Stream: #6d14238> #( Function: #<Subr-(null): #6cf5b88> Arguments: #<Unnamed-Stream: #6d14238> #( Function: #<Subr-READ: #6cf0388> Arguments: #<Unnamed-Stream: #6d14238> Function: #<Closure-STRING-EVAL: #6cac638> Arguments: "(list (list 0 30.8361 "S:\NoiseRemovalSamples1\NoiseRemovalSamples\Rock\1-start.wav"))" Function: #<FSubr-SETQ: #6cf5d18> Arguments: LABELS (STRING-EVAL (FORMAT NIL "(list ~a)" LABELS)) Function: #<FSubr-PROGN: #6cf5768> Arguments: (SETF SLIST (MAPCAR (FUNCTION CONVERT) SLIST)) (SETQ LABELS (STRING-EVAL (FORMAT NIL "(list ~a)" LABELS))) (PUTPROP (QUOTE *SCRATCH*) LABELS (PROPERTY "labels")) (SEQREP (I (LENGTH SLIST)) (CUE (NTH I SLIST))) Function: #<FSubr-IF: #6cf4e28> Arguments: (= IMPORTMODE 1) (PROGN (SETQ OUTPUT 0) (SETF SLIST (MAPCAR (FUNCTION CONVERT) SLIST)) (SETQ SLIST (SPLIT-ALT SLIST)) (VECTOR (SEQREP (I (LENGTH (AREF SLIST 0))) (CUE (NTH I (AREF SLIST 0)))) (SEQREP (I (LENGTH (AREF SLIST 1))) (CUE (NTH I (AREF SLIST 1)))))) (PROGN (SETF SLIST (MAPCAR (FUNCTION CONVERT) SLIST)) (SETQ LABELS (STRING-EVAL (FORMAT NIL "(list ~a)" LABELS))) (PUTPROP (QUOTE *SCRATCH*) LABELS (PROPERTY "labels")) (SEQREP (I (LENGTH SLIST)) (CUE (NTH I SLIST)))) Function: #<FSubr-PROGN: #6cf5768> Arguments: (SETQ FLIST (IF (SETQ FP (OPEN FILELIST :DIRECTION :INPUT)) (DO ((LINE (READ-LINE FP) (SETQ LINE (READ-LINE FP))) FLIST) ((NOT LINE) (REVERSE FLIST)) (WHEN (TEST-EXT LINE) (SETQ FLIST (CONS LINE FLIST)))) (GET-ALL))) (PFLIST FLIST) (SETF SLIST (MAPCAR (FUNCTION S-READ-ADD) FLIST)) (IF (= IMPORTMODE 1) (PROGN (SETQ OUTPUT 0) (SETF SLIST (MAPCAR (FUNCTION CONVERT) SLIST)) (SETQ SLIST (SPLIT-ALT SLIST)) (VECTOR (SEQREP (I (LENGTH (AREF SLIST 0))) (CUE (NTH I (AREF SLIST 0)))) (SEQREP (I (LENGTH (AREF SLIST 1))) (CUE (NTH I (AREF SLIST 1)))))) (PROGN (SETF SLIST (MAPCAR (FUNCTION CONVERT) SLIST)) (SETQ LABELS (STRING-EVAL (FORMAT NIL "(list ~a)" LABELS))) (PUTPROP (QUOTE *SCRATCH*) LABELS (PROPERTY "labels")) (SEQREP (I (LENGTH SLIST)) (CUE (NTH I SLIST))))) Function: #<FSubr-IF: #6cf4e28> Arguments: (LISTDIR *DEFAULT-SF-DIR*) (PROGN (SETQ FLIST (IF (SETQ FP (OPEN FILELIST :DIRECTION :INPUT)) (DO ((LINE (READ-LINE FP) (SETQ LINE (READ-LINE FP))) FLIST) ((NOT LINE) (REVERSE FLIST)) (WHEN (TEST-EXT LINE) (SETQ FLIST (CONS LINE FLIST)))) (GET-ALL))) (PFLIST FLIST) (SETF SLIST (MAPCAR (FUNCTION S-READ-ADD) FLIST)) (IF (= IMPORTMODE 1) (PROGN (SETQ OUTPUT 0) (SETF SLIST (MAPCAR (FUNCTION CONVERT) SLIST)) (SETQ SLIST (SPLIT-ALT SLIST)) (VECTOR (SEQREP (I (LENGTH (AREF SLIST 0))) (CUE (NTH I (AREF SLIST 0)))) (SEQREP (I (LENGTH (AREF SLIST 1))) (CUE (NTH I (AREF SLIST 1)))))) (PROGN (SETF SLIST (MAPCAR (FUNCTION CONVERT) SLIST)) (SETQ LABELS (STRING-EVAL (FORMAT NIL "(list ~a)" LABELS))) (PUTPROP (QUOTE *SCRATCH*) LABELS (PROPERTY "labels")) (SEQREP (I (LENGTH SLIST)) (CUE (NTH I SLIST)))))) (FORMAT NIL "Error.~%Directory "~a" does not exist.~%" *DEFAULT-SF-DIR*) Function: #<Closure-IMPORT: #6caa958> Function: #<FSubr-IF: #6cf4e28> Arguments: (< OUTPUT 2) (IMPORT) (MAKE-LABELS) Function: #<FSubr-CASE: #6cf30c8> Arguments: VIEWHELP (1 (HELP)) (2 (LABEL-HELP)) (3 (LIMITATIONS)) (T (IF (< OUTPUT 2) (IMPORT) (MAKE-LABELS))) 1>
On the “Usage” help screen:
- “uncompressed audio files of type .WAV .AIFF or .AU” lacks the full stop at the end of the sentence.
- This text may be better for only a couple more words:
"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.n
- Say “1) A file name in the ‘Import Folder’, with extension” (import fails without the extension)
- I prefer to say " ‘Sequential’ will append the files end-to-end" as I think it is less ambiguous.
- If ‘Alternate Channels’ retains the equal length restriction, you could say that by dropping some superfluous words e.g. “assumes the first file is for the left channel”… is shorter.
I don’t mean to be disparaging about this very useful plug-in but I think this is one plug-in where a built in C++ version would be vastly more functional. How soon or if that version will happen, even given it’s an “approved” P4 enhancement, remains to be seen.
filelist.txt (60 Bytes)
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.
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:
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:
- A file in the ‘Import Folder’
- A fully qualified file name.
‘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
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.
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
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
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.
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).
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.
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.
If not found, all supported audio files in the Import Folder will be loaded in alphanumeric character order.
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:
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!
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)…
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.
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.
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.