Is it really not possible to create a sound track through python?
-
So from what I understand the BaseSound class is only accessible through the c++ api? I've managed to load files into a sound track with python, but only after manually creating the track myself, which obviously isn't ideal. Is there a reason for this, or could this possibly be added in the future? I understand sound stuff isn't really that high on the list of requested features to be fair lol.
-
Hello @phillipg,
Welcome to the Maxon developers forum and its community, it is great to have you with us!
Getting Started
Before creating your next postings, we would recommend making yourself accustomed with our forum and support procedures. You did not do anything wrong, we point all new users to these rules.
- Forum Overview: Provides a broad overview of the fundamental structure and rules of this forum, such as the purpose of the different sub-forums or the fact that we will ban users who engage in hate speech or harassment.
- Support Procedures: Provides a more in detail overview of how we provide technical support for APIs here. This topic will tell you how to ask good questions and limits of our technical support.
- Forum Features: Provides an overview of the technical features of this forum, such as Markdown markup or file uploads.
It is strongly recommended to read the first two topics carefully, especially the section Support Procedures: How to Ask Questions.
About your First Question
I am not quite sure where you came across the information that it would be impossible to do this, but you can allocate and add a sound track just as any other special track as documented. Please post your code for future support requests.
Cheers,
Ferdinand"""Adds a sound track to the selected object, unless it already has one. """ import c4d doc: c4d.documents.BaseDocument # The currently active document. op: c4d.BaseObject | None # The primary selected object in `doc`. Can be `None`. def main() -> None: """Called by Cinema 4D when the script is being executed. """ if not op: return c4d.gui.MessageDialog("Please select an object.") # The description ID for a sound track and check if it already exists on the object. did: c4d.DescID = c4d.DescID(c4d.DescLevel(c4d.CTsound, c4d.CTsound, 0)) if op.FindCTrack(did): return c4d.gui.MessageDialog("The object already has a sound track.") # Create a new sound track and add it to the object. track: c4d.CTrack = c4d.CTrack(op, did) op.InsertTrackSorted(track) c4d.EventAdd() if __name__ == '__main__': main()