• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Get audio mapping for each channel from clip with Extend Script. getAudioChannelMapping

New Here ,
Apr 12, 2022 Apr 12, 2022

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

 

 

 

TOPICS
Editing , Formats , SDK

Views

486

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , May 05, 2022 May 05, 2022

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.]

Votes

Translate

Translate
Adobe Employee ,
Apr 12, 2022 Apr 12, 2022

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 05, 2022 May 05, 2022

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 23, 2023 Aug 23, 2023

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Aug 23, 2023 Aug 23, 2023

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...? 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 24, 2023 Aug 24, 2023

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 `{audioChannelsType0audioClipsNumber4}` 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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Aug 24, 2023 Aug 24, 2023

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]

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 28, 2023 Aug 28, 2023

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 05, 2022 May 05, 2022

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.]

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines