Pro_Pack : Audio¶
ProPack audio module manages BWav formats, Timecode and the more advanced aspects of dealing with Audio within Maya. All the BWav handling in the StudioPack ultimately calls this codebase but most of the actual handling in ProPack still uses the AudioNode and AudioHandler from the StudioPack API.
>>> # import statement for the module via the r9pro decompiler
>>> from Red9.pro_pack import r9pro
>>> r9pro.r9import('r9paudio')
>>> import r9paudio
This module is extensions to the main audio support through the Red9 StudioPack and requires the StudioPack codebase to run
Core Functions
milliseconds_to_Timecode (milliseconds[, ...]) |
convert milliseconds into correctly formatted timecode |
milliseconds_to_frame (milliseconds[, framerate]) |
convert milliseconds into frames |
timecode_to_milliseconds (timecode[, smpte, ...]) |
from a properly formatted timecode return it in milliseconds |
timecode_to_frame (timecode[, smpte, framerate]) |
from a properly formatted timecode return it in frames |
frame_to_timecode (frame[, smpte, framerate]) |
from a given frame return that time as timecode |
frame_to_milliseconds (frame[, framerate]) |
from a given frame return that time in milliseconds |
validate_timecodeString (timecode[, smpte]) |
validate that any timecode string entered is correctly formatted |
Main Classes
Timecode ([node]) |
Timecode class designed to be integrated into a pipeline for adding timecode markers, extracting data from nodes, decoding data and syncing assets. |
BWav_Handler (filepath) |
|
AudioGRP_Manager ([parent]) |
simple UI to edit a given ExportLoop tag |
-
milliseconds_to_Timecode
(milliseconds, smpte=True, framerate=None)¶ convert milliseconds into correctly formatted timecode
Parameters: - milliseconds – time in milliseconds
- smpte – format the timecode HH:MM:SS:FF where FF is frames
- framerate – when using smpte this is the framerate used in the FF block default (None) uses the current scenes framerate
Note
- If smpte = False : the format will be HH:MM:SS:MSS = hours, minutes, seconds, milliseconds
- If smpte = True : the format will be HH:MM:SS:FF = hours, minutes, seconds, frames
-
milliseconds_to_frame
(milliseconds, framerate=None)¶ convert milliseconds into frames
Parameters: - milliseconds – time in milliseconds
- framerate – when using smpte this is the framerate used in the FF block default (None) uses the current scenes framerate
-
timecode_to_milliseconds
(timecode, smpte=True, framerate=None)¶ from a properly formatted timecode return it in milliseconds timecode_to_milliseconds(‘09:00:00:00’)
Parameters: - timecode – ‘09:00:00:20’ as a string
- smpte – calculate the milliseconds based on HH:MM:SS:FF (frames as last block)
- framerate – only used if smpte=True, the framerate to use in the conversion, default (None) uses the current scenes framerate
-
timecode_to_frame
(timecode, smpte=True, framerate=None)¶ from a properly formatted timecode return it in frames timecode_to_milliseconds(‘09:00:00:00’)
Parameters: - timecode – ‘09:00:00:20’ as a string
- smpte – calculate the milliseconds based on HH:MM:SS:FF (frames as last block)
- framerate – only used if smpte=True, the framerate to use in the conversion, default (None) uses the current scenes framerate
-
frame_to_timecode
(frame, smpte=True, framerate=None)¶ from a given frame return that time as timecode relative to the given framerate
Parameters: - frame – current frame in Maya
- smpte – calculate the milliseconds based on HH:MM:SS:FF (frames as last block)
- framerate – the framerate to use in the conversion, default (None) uses the current scenes framerate
-
frame_to_milliseconds
(frame, framerate=None)¶ from a given frame return that time in milliseconds relative to the given framerate
Parameters: - frame – current frame in Maya
- framerate – only used if smpte=True, the framerate to use in the conversion, default (None) uses the current scenes framerate
-
<<<<<<< HEAD
-
timecode_difference
(referencedTC, inputTC)¶ calculate the difference between 2 timecodes in frames
Parameters: - src – timecode we’re comparing against SMPTE formatted as string
- des – timecode we want to find the frame difference too from the src
-
=======
>>>>>>> d7ab8a039c4da0838a07bf4a9ec3ad957667b21e
-
validate_timecodeString
(timecode, smpte=True)¶ validate that any timecode string entered is correctly formatted
Parameters: timecode – expecting a correctly formatted string ‘00:00:00:00’ but here we validate that this is correct and returmn Flase if not
-
class
Timecode_Wrangler
(parent=None, *args, **kwgs)¶ Bases:
PySide.QtGui.QMainWindow
,Ui_MainWindow
simple UI to manager timecode on the mRigs
-
class
Timecode
(node=None)¶ Bases:
object
Timecode class designed to be integrated into a pipeline for adding timecode markers, extracting data from nodes, decoding data and syncing assets.
Parameters: node – node to bind to the class for timecode management -
<<<<<<< HEAD
-
count
= 'timecode_count'¶
-
samplerate
= 'timecode_samplerate'¶
-
ref
= 'timecode_ref'¶
-
=======
>>>>>>> d7ab8a039c4da0838a07bf4a9ec3ad957667b21e
-
timecode_input
¶ internal timecode cached on the class instance
-
getTimecode_count
¶ get the ‘timecode_count’ attr from the Maya node at the current frame. This is the incremental counter thats added to the ‘timecode_ref’ attr to generate the actual timecode at a given frame
-
getTimecode_ref
¶ get the ‘timecode_ref’ attr from the Maya node at the current frame, this is the pointer in milliseconds
-
getTimecode_samplerate
¶ get the ‘timecode_samplerate’ attr from the Maya node at the current frame, this is the sample-rate set when the counter attr was generated
-
getTimecode_from_node
(time=None, smpte=True)¶ wrapper method to get the timecode back from a the node bound to the class
Parameters: - time – time at which to get the data, else get it from currentTime
- smpte – if true (default) return the timecode as smpte, else return millisecs
-
hasTimeCode
()¶ test to check if a given node has all the required TimeCode setups
-
static
getTimecode_from_maya
()¶ get the internal timecode binding from Maya’s production mapping
Note
Maya has a function for modifying the default mapping through the setTimecode ui which binds a given frame to a given timecode. This code compensates for that binding
-
<<<<<<< HEAD
addTimecode_to_node
(tc='', propagate=False, suppress=False)¶
=======
wrapper to add the timecode attrs to a node and if set propagate that data to the node and fill the attrs up
Parameters: - tc – optional timecode, used in conjunction with the propagate flag
- propagate – push the timecode given onto the node and bake the count attr against the current fps <<<<<<< HEAD
- suppress – confirmDialog warnings supression ======= >>>>>>> d7ab8a039c4da0838a07bf4a9ec3ad957667b21e
addTimecode_to_node
(tc='', propagate=False)¶ >>>>>>> d7ab8a039c4da0838a07bf4a9ec3ad957667b21e-
setTimecode
(tc, propagate=False)¶ set the timecode to the Maya node and propagate if set, just a re-worked stub to make it more obvious when setting the timecode up rather than calling add, which actuially does the same thing ;)
-
removedTimecode_from_node
()¶ remove the timecode attrs from a node
-
<<<<<<< HEAD
-
timecode_difference_to
(referenceTC)¶ get the difference in frames between this instances timecode and a given reference TC
-
timecode_HUD
(force=False)¶ get the current Timecode HUD mNode, if not found, create one with the force flag
Parameters: force – if there’s no MetaTimeCodeHUD node already in the scene we generate one and return that
-
hud_connect
(draw=True)¶ add this Timecode node to the Timecode HUD display
Parameters: draw – when we connect set the HUD to be drawn
-
hud_remove
()¶ remove this timecode instance from the timecode HUD, unconnecting the nodes
-
hud_delete
()¶ delete the MetaTimeCodeHUD node altogether
-
hud_toggle_draw
()¶ toggle the HUD draw state
-
hud_kill
()¶ turn OFF the HUD draw but do not delete the wires or the MetaTimeCodeHUD
-
enterTimecodeUI
(buttonlabel='set', buttonfunc=None, *args)¶ generic UI to enter timecode
Parameters: - buttonlabel – label to add to the button
- buttonfunc – function to bind to the button on exit, default is self.addTimecode_to_node()
-
enterTimecodeUI
(buttonlabel='set', buttonfunc=None)¶ generic UI to enter timecode
:param buttonlabel’ = label to add to the button :param buttonfunc’ = function to bind to the button on exit
>>>>>>> d7ab8a039c4da0838a07bf4a9ec3ad957667b21e
-
-
class
BWav_Handler
(filepath)¶ Bases:
object
-
isBwav
()¶ validate if the given source wav is a BWav or not
-
sampleRate
¶ sample rate in milliseconds
-
bwav_getHeader
()¶ retrieve the BWav header info and push it into an internal dic that you can inspect self.bwav_HeaderData. This is designed to be cached against this instance of the audioNode object. Note that this code uses a binary seek to first find the starting chunk in the binary file where the ‘bext’ data is written.
Note
We could, if we could ensure it was available, use ffprobe.exe (part of the ffmpeg project) This would also cover most media file formats including Mov, avi etc There is coverage for this in this module getMediaFileMetaData() does just that
-
bwav_timecodeMS
()¶ read the internal timecode reference form the bwav and convert that number into milliseconds
-
bwav_timecodeReference
()¶ internal timeReference in the bwav
-
bwav_timecodeFormatted
(smpte=True, framerate=None)¶ convert milliseconds into timecode
Parameters: - smpte – format the timecode HH:MM:SS:FF where FF is frames, else milliseconds
- framerate – when using smpte this is the framerate used in the FF block
-
-
class
AudioGRP_Manager
(parent=None, *args, **kwgs)¶ Bases:
PySide.QtGui.QMainWindow
,Ui_MainWindow
simple UI to edit a given ExportLoop tag
-
selected_expTag
¶ we only allow single selection of expTags
-
selected_sceneAudio
¶ return instantiated r9Audio.AudioNodes
-
selected_linkedAudio
¶ return instantiated r9Audio.AudioNodes
-
disconnectAudio
()¶ disconnect the selected linked audio from the tag
-
staticMetaObject
= <PySide.QtCore.QMetaObject object at 0x0000000012DAB9C8>¶
-
connectAudio
()¶ connect the selected audio in the scene list to the selected tag
-
staticMetaObject
= <PySide.QtCore.QMetaObject object at 0x00000000130A5DC8>¶
-
-
getMediaFileMetaData
(filepath, ffprobePath=None)¶ This function is capable of returning most metaData from mediaFiles, the return is in a json format so easily accessed. :param ffprobePath: if not given the code will asume that ffprobe.exe has been
dropped into teh Red9/packages folder, else it’ll use the given pathNote
This is a stub function that requires ffprobe.exe, you can download from http://www.ffmpeg.org/download.html it’s part of the ffmpeg tools. Once downloaded drop it here Red9/pakcages/ffprobe.exe This inspect function will then be available to use for many common media formats. More info: http://www.ffmpeg.org/ffprobe.html