pencil
pencil copied to clipboard
Implement audacity shortcut and hot reloading
The idea behind this is that we encourage audio editing through Audacity but doing so requires A workflow like this: after importing a sound in pencil2d:
- open Audacity
- selecting the file to edit,
- Edit stuff or whatever...
- export audio
- maximize pencil2d again
- Select old audio track
- delete audio track
- Import the new audio file
phew... and we're done! Now that was easy right? now you just gotta do that for the 20 or so other tracks you've imported Well I think that we can do better!
My proposal goes like this: Check if Audacity is installed (should be possible to find and select the executable from properties in case of custom location) then whenever you want to edit an audio file, simply double-click on the track in the timeline. This launches Audacity and starts a new project where you can edit the sound.
Because we obviously can't see what audacity is doing, we'd have to expect that the user overwrites his old audio track, then when Pencil is focused again, the timeline will reload, changing the old audio file with the new.
This makes the workflow look like:
- double-click on audio frame in timeline
- Automatically launches Audacity
- Edit stuff or whatever...
- export audio
- maximize pencil2d again
Now every time you want to modify an imported sound file, you simply double-click on one of the audio frames which launches audacity, then you can edit, export and BAM the timeline is updated.
The way to check whether the file has been modified could be by checking the file modification date, if it's different, re-import the audio file from it's original path.
How do we launch Audacity and open a project? Fortunately Audacity has a command-line interface, so doing something like:
$> audacity myAwesometrack.mp3
should launch Audacity, open a project and import the file into that project for you to edit.
While this is of course not better than a built-in audio editing interface, it certainly makes the multi app workflow seem less daunting.
I definitely agree that Pencil2D should have no need for fully featured sound editing capabilities. things like using sound effects (equalization, reverb, etc) or doing format conversion (MP3 to WAV, etc) shouldn't be done with Pencil2D. As mentioned before at most we should just let the user expose the sound on the timeline at will with a similar way to how the drawing containers are exposed.
At a quick glance I like this proposal a lot because in a way it's in line with what we had in mind by having a software compatibility layers with other animation applications. This idea could work perfectly for exporting to a video editor (e.g Kdenlive, Openshot, shotcut) or video compositor (Natron) as well; there are plenty of FOSS options.
I think the workflow though could be even more flexible. You should be able configure which audio editor to use in the preferences, but to avoid licensing issues, we would have the full compatibility implementation with Audacity and if someone else wants to make it compatible with say...Ardour or Adobe Audition, then having the Audacity implementation as an exmaple, they should be able to make a plugin to connect to other apps in a similar way. I feel trying to maintain more than one editor with this bi-directional I/O workflow would be very difficult, but at least just invoking the program by changing it through the preferences should be doable.
As for the workflow itself it's pretty much what you described, I've just loaded a few extra considerations:
- User configures which external editor should open in the Pencil2D preferences. If they have Audacity installed then it could automatically make the link, but this would be more of an enhancement to that workflow.
- User imports sound into Pencil2D
- If user wants to cut and remove a clip, or shrink / enlarge the exposure of the sound the should be able to. The sound sample would be clipped wherever the sound exposure stops.
- Use the "Send to external editor" option
Note: Since double clicking on an empty frame currently prompts the user to import a sound, double clicking on an imported sound container should prompt them to replace the sound Instead.
To send the sound to an external editor we should consider either a right-click menu option for the sound container, a feature in the options panel relative to the sound layer or Maybe even to have a separate sound option panel; would need further discussion. I'm leaning toward right clicking because there are other features that could be used with a frame right click menu behavior, but as a dependency we would need to implement such behavior in the first place.
- The external editor is loaded and the referenced sound sample is imported into the editor.
Note: Another consideration. Let's say we initially imported the sound from a separate sound folder into Pencil2D. At this stage I'm wondering if we are loading the originally imported file or the one that is copied inside either, the Pencil2D temporary folder (PCLX) or the data folder (PCL).
If we were to use the sample copied into the data folder, for any cross-software loading to happen the user would need to save the Pencil2D project at least once, otherwise everything would become unmanageable in memory alone. Q: Should we force them to save through a warning? -> "For the sound sample to be loaded properly into the external editor you need to save your Pencil2D file"
- Export the file back to Pencil2D
Note: I wish wouldn't need to export the sound file again, but this is an audacity safety measure / limitation, where sound modifications in audacity are made available in-editor only and are saved to their .aup project file, I don't know how they do it but they seem to divide the sound tracks in smaller chunks (.au files). So even if you save the AUProject, the original sound sample you imported is not really modified so the file itself is not damaged until you overwrite it, so in the end you do have to export the edits as a sound file to get the .wav or any other file format and thus getting it back into pencil2d.
Maybe we can prompt an option to replace the file instead of overwrite once it exports from audacity.
Also the current sound sample properties should be passed on to audacity so the exported file comes with the same sample bit rate, channels and what not.
Thank you for taking the time to draft this! :smile: