I suggest that when exporting a selected audio track, the default file name be its track name. Currently, if you open an audio file to a track and then have several other tracks created or imported during your editing session, when you want to export a selected track, its default filename is the name of the first file opened, that is , always the one of the first track, not the one of the selected track.
Actually the name of the exported track is the name of the “project”.
If you import files (rather than record) into an empty project, or if you “open” an audio file in Audacity, the project is named according to the name of the audio file.
If you then export a track from the project, the name of the exported file is according to the name of the project.
In most cases, the above scheme is perfectly reasonable, but I agree that it looks a little strange in the specific case of:
“Import several files into a project, then export a selected track that is not the first track”.
While there may be some benefit to treating this special case differently, software developers tend to be cautious about making “special case” behaviours, as the user then has to learn multiple behaviours and the situations in which they occur, rather than just one consistent behaviour.
In the common case of recording, the default name of the track (“Audio Track”) is unlikely to be useful as the name of the exported track,
For a project that has been saved, the name of the project is arguably as good a name as any for the default name when exporting.
Perhaps it would be better if the user was prompted to name the project when the project window first opens, but that’s at least one extra button press when starting a new project, which some users will complain about.
It is probably impossible to devise a naming scheme that will suit everyone in every case. The developers may be persuaded to change the scheme if presented with a scheme that demonstrates significant benefits overall, but there is always a downside to changing a behaviour that millions of current users are familiar with.
The easy workaround is to drop a label at the bginning of the audio and for the label text use the filename you require - the use File > Export Multiple
The File>Export Mutiple option sounds good for the exporting with the track name as filename, except it applies to all tracks in the audacity open window rather than concerning only selected tracks. Am I right ?
Fundamentally I think you are right - but I have a suspicion that Audacity will not export any tracks that are muted (but sorry I haven’t got time to test that right now)
Is ther any way to export a specific audio track with its track name automatically taken as exported filename ?
Not that I know of.
But - I was right in my thinking that with Export Multiple (indeed all Exports) Audacity does not export any tracks that are muted.
So I can suggest a couple of workarounds
1)Using Export Multiple.
a) have multiple tracks
b) create an empty track - and name it say “Dummy”
c) mute all tracks with Ctrl+U
d) unmute the track you require - and unmute the dummy track
e) use Export Multiple (track-based option)
f) Audacity will export your track into a file based on the trackname - and it will export a dummy file (which you can just delete, later if necessary)
BTW Ctrl_Shift+U will unmute all the tracks
This kludge is because with Export Multiple based on tracks Audacity expects to be able to export “mutiple”( i.e. more than one) tracks.
Which is a bit odd as with Export Multiple based on labels Audacity will happily create a single audio file based on the single label (as in my earlier suggested workaround),
Now I’m thinking that this looks inconsistent - and I think it’s perfectly reasonable for track-based Export Multiple to operate and not error out if you
i) have multiple audio tracks
ii) only one of those tracks is unmuted
2) Using Export Selected Audio
a) In the track you want to export, click in the Track control panel name to get the dropdown context menu
b) Click “Name” in the entry
c) use Ctrl+C to copy the trackname - and just exit that dialog
d) select the track you want export
e) use Export Selected Audio
f) the export dialog will pop up with the “File name” field active and highlighted
g) use Ctrl+V to overwrite the offered name (the project name) with your trackname
h) OK the export
As wacylinder wrote, no, but there are workarounds.
Here’s another workaround. It requires this plug-in to be installed, and assumes that you don’t already have any label tracks:
tracknamelabel.ny (300 Bytes)
See here for how to install the plug-in:
With the plug-in installed:
- Click on the track that you want to install
- From the “Generate” menu, select “Track Name Label”
- Click the “Solo” button on the track that you wish to export
- “Export Multiple” based on Labels. The default naming options will use the label text, which is the name of the track that you selected in step 1.
Thanks to all, and particularly to Steve. I did not check this forum issue for a full year, and I did not realize you’ve got a solution to this problem. Steve’ solution is probably the best one, most approaching the need I mentioned. But I still strongly maintain that exporting a selected track systematically with its trackname would be very good sense, even in the framework of the audacity project concept. Any hope it will be added as a default track-exporting behaviour ? I mean current default to export any track with the track name of the first track imported does not really makes sense to me, as it drains your attention to the risk of wrongly replacing the previously exported track with the same name…
The default export name is the name of the “project” (look at the project name at the top of the main Audacity window).
The default name of the project, when you import an audio track into a new, empty project, is the name of the imported file.
Importing audio files into a non-empty project does not change the project name.
When you save a project, the project name updates if necessary to match the name that you saved the project as.
- New project. Project is “unnamed”, and the Audacity title bar shows “Audacity”.
- Import an audio file called “test”. The project name is now “test”.
- Save the project as “another”. The project name is now “another”.
- Export. The default export name is “another”.
Steve, I understand, but I mainly use import and export of audio files as tracks, without necessarily using the project concept. I import and edit each track separately and store each in different directories, depending what I am doing with them. I need to be more free to use the tracks than via the project concept. And I do a lot of editing this way. So each time I export a track, I would really need its track name as default filename to save. And I see that Export Multiple does that, but for all non muted tracks and to the same directory, so I cannot use this either in a very practical manner.
I tried to code a Nyquist plugin for doing what I need, but I hit another error with the following code.
(s-save s ny:all (strcat “D:\TMP\” (get track 'name) “.wav”))
does not work properly in Nyquist version 4, Debug says the sound-save hits a non-sound file;
but when I code (let’s say my track name is “MyTrack”) :
(s-save s ny:all “D:\TMP\MyTrack.wav”)
everything works fine in version 4 and 3
and the following also works :
(setq pathName “D:\TMP\”)
(s-save s ny:all (strcat pathName “MyTrack.wav”))
Of course I would need (s-save s ny:all (strcat “D:\TMP\” (get track 'name) “.wav”)) to work as the track variable does not seem to exist in version 3…
Do you have any clue of what I should do to make it work ?
As a matter of fact, I found a way to export/save a track selection by using a new Nyquist plug-in I created from an original source code given in Audacity tutorials. Here is my modified version plug-in I named “SaveTrackByName.ny” :
$name (_ “SaveTrackByName”)
$action (_ “Save a selection by track name…”)
$author (_ “Paul/Agua”)
$copyright (_ “Released under terms of the GNU General Public License version 2”)
;;original source code used : Audacity Support Forum / Audacity and Nyquist / Nyquist Reference Manual / Nyquist Examples and Tutorials
;; s-save – saves a file
(setf NY:ALL 1000000000) ; 1GIG constant for maxlen
(defmacro s-save (expression &optional (maxlen NY:ALL) filename
&key (format 'default-sf-format)
(mode 'default-sf-mode) (bits 'default-sf-bits)
(endian NIL) ; nil, :big, or :little – specifies file format
`(let ((ny:fname ,filename)
; allow caller to omit maxlen, in which case the filename will
; be a string in the maxlen parameter position and filename will be null
(cond ((null ny:fname)
(cond ((stringp ny:maxlen)
(setf ny:fname ny:maxlen)
(setf ny:maxlen NY:ALL))
(setf ny:fname default-sound-file)))))
(cond ((equal ny:fname “”)
(cond ((not ,play)
(format t "s-save: no file to write! play option is off!
(setf ny:fname (soundfilename ny:fname))
(format t “Saving sound file to ~A~%” ny:fname)))
(cond ((eq ny:endian :big)
(setf ny:swap (if ny:bigendianp 0 1)))
((eq ny:endian :little)
(setf ny:swap (if ny:bigendianp 1 0))))
(snd-save ',expression ny:maxlen ny:fname ,format ,mode ,bits ny:swap ,play)))
(s-save track ny:all (strcat “D:\Org\TMP\Musique\” (get 'track 'name) “.wav”))
It saves the track to a hard coded name directory of your choice (here “D:\Org\TMP\Musique\”). It could be improved by adding some dialog to enter the path of any other directory, but that’s the raw version, which works well.
Hope it will help any other user interested in this capability.
It will be useful if you provide a link to the relevant page.
Regarding the plug-in, why not just:
;nyquist plug-in ;version 4 ;type process ;name "Save Track by Name" ;action "Saving selection by track name..." ;copyright "Released under terms of the GNU General Public License version 2" (setf path "D:\\Org\\TMP\\Musique\\") ;; This must be a valid path!! (setf filename (format nil "~a~a.wav" path (get '*track* 'name))) (s-save *track* ny:all filename) (format nil "Exported to ~s" path)
There are also some problems / drawbacks to this plug-in:
- If there is already a file with the same name, it will be overwritten without warning.
- If the project contains multiple tracks with the same name, each successive track of that name will overwrite the previous track’s file.
- Important to note that it is the selected audio from each selected track that is exported.
- If the selected time region is longer that the track, then any selected “white space” at the ends are included in the exported file as silence.
- There is very little error handling. If anything goes wrong, any error message is likely to be cryptic at best.
Thank you, Steve, for the simplification improvement. I am not fluent in Lisp or Nyquist language and your help is very appreciated.
I see also your points about the weaknesses of the plugin solution I proposed. Again I am not fluent enough in this language to see if I can handle those points. I guess the best solution would be to include the solution into the Audacity internal C++ code directly, at least having the track name as the default filename for the standard “Export Selection” menu option.
Do you think it’s something which would be included in next release ?
Hi again, Steve. The URL to the Nyquist code I found and used is :
It won’t be in the next release. Audacity 2.3.3 (the next release) is mostly about under the hood changes and bug fixes.
Neither was I when I started. I’d done a bit of BBC basic many years before, and that was all.
With a bit of work, I think that most of the problems that I highlighted may be resolved with Nyquist.
I have to go for short while, but I’ll post some more about this later…
If this is the objective, then there’s a simple solution built in:
- Click the Solo button on the track that you want to export
- Export Multiple (based on tracks)
I tried this simple solution, which I had tried already before, but whether you set the desired track solo or not, the Export Multiple dialog will keep exporting all tracks. It does export them by their trackname, which is good, but will export all tracks, which is not the desired functionality. I might have 20 tracks involved in an edit session, I don’t want exporting all 20 after modifying just one of them.
Are you sure that you are using Audacity and not some other program?
Are you sure that you only soloed one track?
I’ve just tested with Audacity 2.3.2, and as expected, muted tracks are not exported. With default setting, when one track is soloed, all other tracks are muted.