Auto-Fit WIDTH and HEIGHT [SOLVED]

Hi.
I’m using the new Audacity. Latest.
I figured that the ability the track opened with Full Width setting is gone.
I still can tick the optios automatically open with maximum vertical height.
How to achieve this?: automatically when opening a FILE?

It has only gone when using the “File > Open” menu, and it has only gone temporarily - it will be back in the next release.
If you use any of the other methods for importing audio files (drag and drop, or “File > Import” or “Ctrl+Shift+i”) then you still get the track fitting horizontally.

To fit hight automatically, enable “Auto-fit track height” in Preferences: Tracks Preferences - Audacity Manual

“Auto-fit track height” doesn’t seem to do anything me in 2.2.0 , (or 2.1.3) : No automatic vertical zooming occurring …

It’s not supposed to “zoom”, it’s supposed to expand the track vertically, like grabbing the bottom edge of the track with the mouse and dragging down.
(It intentionally does not affect collapsed tracks).

Ahh, now I get it. Yes, that preference does make the vertical-scale of the track fill the window.

t has only gone when using the “File > Open” menu, and it has only gone temporarily - it will be back in the next release.
If you use any of the other methods for importing audio files (drag and drop, or “File > Import” or “Ctrl+Shift+i”) then you still get the track fitting horizontally.

To fit hight automatically, enable “Auto-fit track height” in Preferences: > http://manual.audacityteam.org/man/trac > … ences.html

Thank you for the information. I hope it’s back in the next release.
I will use the workaround you are letting me know.
Yes, the height seems like it’s working fine. Thanks.

It will be, and you can try it very soon as the release candidate is to become available imminently (it will be announced here on the forum as soon as I get the go-ahead)

A very useful editing tool would be a Vertical Zoom Toggle for a track. Very often, when editing a track among other tracks, we need to expand its height to full window height just tht time we edit it and then immediately return to previous height once editing is done. Current process to achieve this is the track height mouse drag process, which takes a lot of time, when you have a lot to edit on various tracks. It would be very appreciated to be able to instantly get the under-edit track height fit the full window height, do one’s editing action and then toggle the track height back to what it was. Any hope to see this capability implemented ?

An alternative is to use the “collapse” button (Audio Tracks - Audacity Manual). Once you have the “expanded” size as big as you want, you can then toggle between expanded and collapsed.

Yes, thanks Steve. That’s what I use to do, but alas, the collapsed track graphic is not what I’d like to get from the toggle. I’d rather need one to switch between expanding to full window height and returning to user defined specific track height for any track. It would be very useful for rapid editing between tracks.
Is there a way to integrate that option in next release ?

There will be very few “new features” in the next release, because there is a very substantial amount of “under the hood” improvements.

You are welcome to propose a new feature in this section of the forum: Adding Features - Audacity Forum
After a discussion period on the forum, feature requests are logged on the Audacity wiki and may be taken up by a developer.

Thanks Steve.

As another way to tackle this issue, I would like to use “Set Track Visuals” in a chain macro, as it appears this Extra/Scriptable I options is available in the list of Chain commands. As a matter of fact, when I use directly (via the main menu) Extra/Scriptable I/Set Track Visuals dialog and set a specific height, it works fine as desired. But if I call via a Chain Macro, with the same parameters, nothing happens.

Do you have an idea of how to make it work that way ?
SetTrackVisuals_Snapshot.PNG

Perhaps you need to add a “Select Tracks” command.

Well, I have tried another approach using Nyquist, and I am apparently pretty close to the Height Toggle I was looking for. Here is my current code :

;nyquist plug-in
;version 4
;type process
;name "TrackHeightToggle"
;action "Toggles track height between full Vertical Zoom and a specific Height"

(print "----Step # 1----")

(print (format nil "scratch/effectx is : ~a" (get '*SCRATCH* 'zoom)))
(cond ((equal (get '*SCRATCH* 'zoom) nil)
	   (print "scratch/zoom is NIL")
	   (remprop '*SCRATCH* 'zoom)
	   (putprop '*SCRATCH* 0 'zoom) ;; 0 = not zoomed yet 
	   (remprop '*SCRATCH* 'trackNumber)
	   (remprop '*SCRATCH* 'waiting)
	   (putprop '*SCRATCH* 1 'waiting) ;; 1 = wait for handling, 0 = handled
	  ))

(print "----Step # 2----")

(setq trackNumber (car (get '*selection* 'tracks)))
(putprop '*SCRATCH* trackNumber 'trackNumber);; first selected track number
(if (equal (get '*SCRATCH* 'zoom) nil)
    (putprop '*SCRATCH* 0 'zoom)) ;; 0 = not zoomed yet
(if (equal (get '*SCRATCH* 'waiting) nil)
    (putprop '*SCRATCH* 1 'waiting)) ;; 1 = wait for handling, 0 = handled
(setq zoomState (get '*SCRATCH* 'zoom))
(setq waiting (get '*SCRATCH* 'waiting))
(print (format nil "zoom : ~a, trackNumber : ~a, waiting : ~a" zoomState trackNumber waiting))

(print "----Step # 3----")

(cond ((= waiting 1)
       (if (= zoomState 0) ;; not yet zoomed => go ahead zoom first selected track
           (cond ((= trackNumber (get '*TRACK* 'index)) ;; is under-processing track the selected track ? 
	              (print (format nil "height ZOOM set for selected track ~a" trackNumber))
	              (aud-do "FitV:")
                  (aud-do "SetTrack: Color=Color1")
	              (putprop '*SCRATCH* 1 'zoom) ;; 1 = zoom to full height
	              (putprop '*SCRATCH* 0 'waiting) ;; 0 = handled
                  (setq zoomState (get '*SCRATCH* 'zoom))
                  (setq waiting (get '*SCRATCH* 'waiting))
                 ))
           ;; zoomState=1, already zoomed => go ahead set first selected track back to default height
           (cond ((= trackNumber (get '*TRACK* 'index))
	              (print (format nil "NORMAL height set for track ~a" trackNumber))
                  (aud-do "SetTrack: Height=200 Color=Color0")
	              (putprop '*SCRATCH* 0 'zoom) ;; 0 = back to normal height
	              (putprop '*SCRATCH* 0 'waiting) ;; 0 = handled
                  (setq zoomState (get '*SCRATCH* 'zoom))
                  (setq waiting (get '*SCRATCH* 'waiting))
	             )))))

(print (format nil "zoom : ~a, trackNumber : ~a, waiting : ~a, track processed : ~a" zoomState trackNumber waiting (get '*TRACK* 'index)))

(print "----Step # 4----")
(cond ((>= (get '*TRACK* 'index) (get '*PROJECT* 'tracks))
       (putprop '*SCRATCH* 1 'waiting) ;; 1 = return to waiting once all tracks processed
       (setq waiting (get '*SCRATCH* 'waiting))
       (print (format nil "zoom : ~a, trackNumber : ~a, waiting : ~a" zoomState trackNumber waiting))))

Now there is something I do not understand in its behavior. The toggle works fine to the last instruction, but when I exit the code, any change is lost and the track returns to its height before launching the code, the changes do not persist. Would you have a clue about that ?

Just to let you know. Apparently this behavior occurs when using the Nyquist Prompt but I just tried the plugin after installing it and enabling in the Effects menu, and it seems to work fine… You may know why…

Actually, the “aud-do “FitV”” code does not do exactly what I need as if there are several tracks, the height will be splitted between them equally, which is not the full zoom I looked for. So I tried enforcing a maximal height and in my case, Audacity will not accept more than 700 pixels although when using FitV for only one tracks, it can go beyond 830 pixels. Is there any possibility to have more than 700 pixels via Nyquist ?

OK, this is the final plugin code I came with and which seems to work :

;nyquist plug-in
;version 4
;type process
;name “TrackHeightToggle”
;action “Toggles track height between full Vertical Zoom and a specific Height”

(setq DEBUGGING 0)
(if (= DEBUGGING 1) (print “----Step # 1----”))

(print (format nil “scratch/zoom : ~a” (get 'SCRATCH 'zoom)))
(cond ((equal (get 'SCRATCH 'zoom) nil)
(if (= DEBUGGING 1) (print “scratch/zoom is NIL”))
(remprop 'SCRATCH 'zoom)
(putprop 'SCRATCH 0 'zoom) ;; 0 = not zoomed yet
(remprop 'SCRATCH 'trackNumber)
(remprop 'SCRATCH 'waiting)
(putprop 'SCRATCH 1 'waiting) ;; 1 = wait state for handling, 0 = handled
))

(if (= DEBUGGING 1) (print “----Step # 2----”))

(setq trackNumber (car (get 'selection 'tracks)))
(putprop 'SCRATCH trackNumber 'trackNumber);; first selected track number
(if (equal (get 'SCRATCH 'zoom) nil)
(putprop 'SCRATCH 0 'zoom)) ;; 0 = not zoomed yet
(if (equal (get 'SCRATCH 'waiting) nil)
(putprop 'SCRATCH 1 'waiting)) ;; 1 = wait state for handling, 0 = handled
(setq zoomState (get 'SCRATCH 'zoom))
(setq waiting (get 'SCRATCH 'waiting))
(if (= DEBUGGING 1) (print (format nil “zoom : ~a, trackNumber : ~a, waiting : ~a” zoomState trackNumber waiting)))

(if (= DEBUGGING 1) (print “----Step # 3----”))
(setq currentTrack (get 'TRACK 'index))

(cond ((= waiting 1)
(if (= zoomState 0) ;; not yet zoomed => go ahead zoom first selected track
(cond ((= trackNumber currentTrack) ;; is under-processing track the selected track ?
(if (= DEBUGGING 1) (print (format nil “height ZOOM set for selected track ~a” trackNumber)))
;;(aud-do “FitV:”)
(aud-do “ZoomSel:”)
(aud-do “SetTrack: Height=700 Color=Color1”)
(putprop 'SCRATCH 1 'zoom) ;; 1 = zoom to full height
(putprop 'SCRATCH 0 'waiting) ;; 0 = handled
(setq zoomState (get 'SCRATCH 'zoom))
(setq waiting (get 'SCRATCH 'waiting))
))
;; zoomState=1, already zoomed => go ahead set first selected track back to default height
(cond ((= trackNumber currentTrack)
(if (= DEBUGGING 1) (print (format nil “NORMAL height set for track ~a” trackNumber)))
(aud-do “ZoomNormal:”)
(aud-do “SetTrack: Height=137 Color=Color0”)
(putprop 'SCRATCH 0 'zoom) ;; 0 = back to normal height
(putprop 'SCRATCH 0 'waiting) ;; 0 = handled
(setq zoomState (get 'SCRATCH 'zoom))
(setq waiting (get 'SCRATCH 'waiting))
)))))

(if (= DEBUGGING 1) (print (format nil “zoom : ~a, trackNumber : ~a, waiting : ~a, track processed : ~a” zoomState trackNumber waiting currentTrack)))

(if (= DEBUGGING 1) (print “----Step # 4----”))

(putprop 'SCRATCH 1 'waiting) ;; 1 = return to waiting state once all tracks processed
(setq waiting (get 'SCRATCH 'waiting))
(if (= DEBUGGING 1) (print (format nil “zoom : ~a, trackNumber : ~a, waiting : ~a” zoomState trackNumber waiting)))

I still don’t get why it does not behave the same in Nyquist Prompt, but nevertheless it works as an installed effect.

Steve, if by any chance you have an answer about this discrepancy, it will certainly enhance my understanding of the Nyquist Prompt.

Otherwise, if you think this Toggle code can be of use by others, is it possible to put it where it can serve ?

For people that are familiar with Nyquist / Lisp, it is a lot more comfortable to read code that is indented appropriately. The forum software strips leading white-space unless tags are used.
To enter code tags, use the “</>” button (rather than the “text color” tags).

Unfortunately, the 700 pixel limit is hard coded into Audacity. Given that many displays are a lot bigger than that, I agree that 700 pixels is a bit on the small side. I’ll ask the developer of this feature if he’d be happy for me to increase it.

The scripting command will actually go bigger than 700, but the hard coded limit triggers an error message.

I’ve only looked briefly at your code, but I notice that it does not clean up after itself. With the following modification, you can see that the only time that the scratch properties are removed, is on first run (and the properties don’t actually exist on first run):

(cond ((equal (get '*SCRATCH* 'zoom) nil)
	   (print "Resetting")