Copy link to clipboard
Copied
Dear Adobe Community
I would like to use an ExtendScript to do audio channel mapping for multiple clips. However, I should be able to know the initial value before assigning the audio channels. In the documentation for "getAudioChannelMapping" I can't find a way to read the matrix of the mapping. Is there a way to do this. Maybe also in the future?
It would also be enough for me if there was an option to restore the default settings of the file.
A bit more detailed:
in the planned script first the audio type is evaluated and then based on "Stereo" or "Mono" decide what to do. But if a user runs the script again, previously changed audio settings will be misinterpreted and reassigned again. At the moment I try to save the original state of the clip by adding a metadate. However, I am still at the beginning with the understanding of reading and adding metadata.
Thank you very much for any help.
https://github.com/Adobe-CEP/Samples/blob/master/PProPanel/jsx/PPRO/Premiere.jsx#L987
https://github.com/Adobe-CEP/Samples/blob/master/PProPanel/jsx/PPRO/Premiere.jsx#L2336
One possible approach: You could temporarily re-import the actual media, which will then have "default" audio channel mapping. Compare it with the current (potentially modified) projectItem you're processing, then delete the additional projectItem. [Delete items by putting them into a 'dispose me' bin, then delete the bin.]
Copy link to clipboard
Copied
Hello Fabian,
I'm not sure what you mean, when you write "the matrix of the mapping". Could you explain further?
The API provides ways to get and set audio channel mapping, but there is no way to "reset those values to defaults". One approach = you might try using app.project.importFiles() to bring in a new instance of that media, use its audio channel mapping as the default state, then remove the new instance from the project.
Leaving yourself a note in a projectItem's metadata, to determine whether you've already processed it or not, is a wise move.
Copy link to clipboard
Copied
Thank you Mr. Bullis for the quick reply. Unfortunately I didn't answer so fast, please excuse me :-). But thanks to your very helpful and well done extendscript examples I have now adopted the variant with the "projectItem's metadata".
By "matrix" I meant the distribute from sources channel to timeline tracks. Like:
„mapping.setMappingForChannel(0, 4)“
I thought maybe there is a way to read this values. (getMappingForChannel). But I am satisfied with the metadata solution.
Thanks and greetings.
Copy link to clipboard
Copied
You mention that “The API provides ways to get and set audio channel mapping”. How can one get the audio channel mapping? That’s unclear to me.
Also, `setAudioChannelMapping` doesn’t work for me most of the time (does return `true` though). Any ideas why?
Thanks!
Copy link to clipboard
Copied
> How can one get the audio channel mapping?
Like so:
var mapping = currentItem.getAudioChannelMapping;
Tricky bit; it's a member, not a method. The name is confusing. Here's some example usage from PProPanel.
> Also, `setAudioChannelMapping` doesn’t work for me most of the time (does return `true` though). Any ideas why?
None; seems to behave here.
Send me a project that contains a known piece of media, some ExtendScript that doesn't work for you, and steps I can follow to see the failure...?
Copy link to clipboard
Copied
Thank you, yeah, the name indead got me confused yesterday. Not having it on types-for-adobe made that worse. (I flagged that here: https://github.com/aenhancers/Types-for-Adobe/issues/111).
I’m still confused by what it returns though. Should one be able to get the information one can get out of the Modify Clip dialog (Clip > Modify > Audio Channels)?
I have an audio file with four audio channels in the sequence, and would like to know which channel is on which track.
(Ultimately I want to work with the audio of each track, so I’m planning to get a track’s files with in/out points and the info of which channel is used for the track).
All I can get with `getAudioChannelMapping` is `{audioChannelsType: 0, audioClipsNumber: 4}` though. That doesn’t tell me which channel is on which track.
I might be completely misunderstanding what audio channel mapping is about?
Is there a way to know which channel is on which track?
Copy link to clipboard
Copied
TypeScript = luxury!
[joking; I see the value]
There is no track mapping information within the audio mapping object for a projectItem, because a projectItem exists independently of any trackItems ('clips' in sequences), based on that projectItem.
Perhaps it's useful to think of setAudioChannelMapping, as preparing a 'stencil' from which trackItems can be created. When you obtain a projectItem's channel mapping, you get the channel type, and count. Conceivably, you could change the mapping to match [desired config], call insertClip() to create a trackItem with the corresponding settings, then change the mapping back to what it was before.
> Is there a way to know which channel is on which track?
Not really, because there's no deterministic way to know what the channel mapping for the projectItem was, when that trackItem was created.
[Let me know if that's helpful, and feel free to keep asking questions]
Copy link to clipboard
Copied
> Not really, because there's no deterministic way to know what the channel mapping for the projectItem was, when that trackItem was created.
Ah ok, I see. Thank you! I’ll try to work around that then …
> feel free to keep asking questions
Thank you! 😊 might do
Copy link to clipboard
Copied
One possible approach: You could temporarily re-import the actual media, which will then have "default" audio channel mapping. Compare it with the current (potentially modified) projectItem you're processing, then delete the additional projectItem. [Delete items by putting them into a 'dispose me' bin, then delete the bin.]