[Feature suggestion] Replace audio clips from source files

Started by Snarky, Fri 31/12/2021 09:35:14

Previous topic - Next topic

Snarky

With sprites, there is a feature to reimport a sprite or a selection of sprites from the source file(s). This can be very useful if graphics are updated, and IIRC it is also the basis for an experimental feature to recreate a missing sprite file from scratch.

I would like to request similar functionality for audio clips. Sometimes you need to update the audio for whatever reason (for example to adjust the volume for consistency), and currently this requires a whole sequence of steps to replace the clip in AGS (or the "hack" of overwriting the file in the AudioCache). It would also be useful if a missing AudioCache directory could be automatically recreated from the source files (to save space with source control tracking).

Crimson Wizard

#1
Quote from: Snarky on Fri 31/12/2021 09:35:14
I would like to request similar functionality for audio clips. Sometimes you need to update the audio for whatever reason (for example to adjust the volume for consistency), and currently this requires a whole sequence of steps to replace the clip in AGS (or the "hack" of overwriting the file in the AudioCache). It would also be useful if a missing AudioCache directory could be automatically recreated from the source files (to save space with source control tracking).

I believe all this must work already, with editor checking audio timestamps of the source files. AudioCache is also supposed to be fully recreated if missing, so long as the source files can be found on their remembered locations.
Does it not?

I only remember that there has been a bug occuring under certain conditions:
https://github.com/adventuregamestudio/ags/issues/778


PS I remember to never keep AudioCache under the source control for all of my team projects, and it always worked iirc.

PPS In regards to sprites, we have a ticket for "recreate sprite file" feature, and I believe it's doable, with the exception for the sprites imported from clipboard (when you do Ctrl+C/Ctrl+V from a image editor), as these cannot have a source file reference.

Cassiebsg

Yes, though I think the way it works now is somewhat misleading and requires ppl to know how it works. It's really not clear.
It would be nice to not have things not running "hidden & automaticly" in the BG.
There are those who believe that life here began out there...

Crimson Wizard

#3
Quote from: Cassiebsg on Sun 02/01/2022 23:43:50
Yes, though I think the way it works now is somewhat misleading and requires ppl to know how it works. It's really not clear.
It would be nice to not have things not running "hidden & automaticly" in the BG.

Suppose, I could add a command into a context menu saying "Update from source", and maybe a checkbox in Preferences to switch autoupdate off. Would that be better?

1. If we have this as an option, I may immediately see a problem: this lets Editor work in two "modes", where in the first the AudioCache is synced with the sources, and in the second it is not. In the second case AudioCache is detached and a kind of source itself, and audio files in it are separate variants from the ones in the source.
As a consequence, in the first "mode" the AudioCache folder is safe to delete, because it's supposedly just a copy of sources, and automatically restoring from sources is always wanted.
In the second "mode" it will NOT be safe to delete, as it's not an automatic copy, but a separate variant, not necessarily identical to the source, and automatically restoring from sources may not be wanted.
I'm concerned that this will increase the amount of trouble finding out how the editor works, and will make advising users difficult, because you will have to know which "mode" they are working on. For instance, right now I always say that it's safe to delete AudioCache / not store it inside the source control repository, so long as you have originals in the initial location, because editor will restore the cache from sources. If the above change is made, I would have to double check whether user autosyncs or not syncs AudioCache with the sources.

2. So, let's suppose that the more "proper" way would be to completely remove the autosyncing. In which case we have "mode two", where AudioCache cannot be safely deleted unless user is absolutely certain that the sources contain the variant they need for this game. Of course this also will screw everyone who is used to work with sources, editing them and expecting that the game catches them up. As well as will make storing source audio files inside the project folder unnecessarily increasing the project size, as Snarky mentioned above.

3. The third alternative, which just came to my mind, is this: if the source files are located in the relative location inside the game folder, then they are autosynced. Because if user put them into the project, they likely want these to be used automatically.
Otherwise (if they are somewhere outside) - they are not autosynced.
Again, I have no idea if this is convenient. Good systems are simple systems, that work one way.




I should also mention, that at least some developers (including me) would like to move towards having all the game resources directly in the game folder, so that there are no intermediate "caches", then a user may work with files directly in a specifically designated folder.
I.e. right now there's a change to room formats in works, that stores rooms split into its components, with backgrounds, masks etc as separate files that may be edited at will using any external editor (image editors etc).

Snarky

So what happens currently if one or more of the source files are deleted or moved? (Or the project is shared with someone who doesn't have the source files in exactly the same file locations?) And when in the process is this auto-refresh supposed to happen?

Let's say you have 99 audio clips, but one of them cannot be found at its source location. Does the whole auto-sync process grind to a halt, and with no way to make it refresh any of the others?

Because this seems to me to be a very likely and common occurrence.

What I'm experiencing is this: I have a project which is tracked in git. The AudioCache folder is not included (as per advice, IIRC). At one point I made a branch of the project and removed a bunch of audio files. Then I switched back to the main branch. However, the AudioCache is not updated to restore the missing files, even though most of them are in the source file locations (a couple were moved when I reorganized some files, and there are other files in the AudioCache for which I don't have the source files anywhere else). But it might also be that I didn't go through the necessary step to trigger the update.

PS: I wholeheartedly second morganwillcock's comment in the linked github thread about how the weird "in-between" cache/update approach of the AGS IDE makes it almost impossible to understand what state(s) the project, builds and "preview" are in.

Cassiebsg

Personally, and this is just my own preference, is that the AudioCache gets tossed out and just becomes "imported audio".
This means that if you want to edit the audio file you can, you can re-import and/or delete them from the game, without risking messing up the original sound you had.

Which in a way, is how Sprites work, they get imported into the project, you can edit them directly using an external program if you like, or edit the original and re-import them. And you can also delete tehm from the Game without messing your original sprites.

The way it is now, you end up with 3 audio files anyway. The original, the edited one, and the AudioCache (or you can edit the Cache file and hope it doesn't get overwritten by the imported one while building the game...).
There are those who believe that life here began out there...

Dave Gilbert

Nothing to add, except that this is a feature I would *love*. Testing sound effects is often a pain, because I often make small changes to the source file (making it shorter or longer or adjusting volume or whatever) and having to delete and reimport the file each time is a lot of extra work!

eri0o

Hey, made a PR for this, targeting 3.6.1. (editor binaries here)

eri0o

PR is merged, in another thread some mentioned reimporting all audio clips and also reporting failures, that is also included in the new feature. :)

SMF spam blocked by CleanTalk