def test_audioNode_given(self): # test from a given Maya sound node cmds.file(self.path, i=True, type='audio', options='o=0') node = cmds.ls(type='audio')[0] audio = r9Audio.AudioNode(node) assert audio.audioNode == node assert audio.isLoaded
def test_path_but_Loaded(self): cmds.file(self.path, i=True, type='audio', options='o=0') node = cmds.ls(type='audio')[0] assert node audio = r9Audio.AudioNode(filepath=self.path) assert audio.path == self.path assert audio.isLoaded assert audio.audioNode == node
def test_path_but_Loaded(self): # from Path but that path is a loaded Maya sound node cmds.file(self.path, i=True, type='audio', options='o=0') node = cmds.ls(type='audio')[0] assert node audio = r9Audio.AudioNode(filepath=self.path) assert audio.path == self.path assert audio.isLoaded assert audio.audioNode == node
def test_pyDub_base(self): # pyDub calls internal self.audioNode = r9Audio.AudioNode(filepath=self.path) assert self.audioNode.sample_width == 2 assert self.audioNode.sampleRate == 44100 assert self.audioNode.sample_bits == 16 assert self.audioNode.channels == 1 print self.audioNode.dBFS print self.audioNode.max_dBFS assert True # self.audioNode.dBFS
def test_full_convert(self): ''' full round the houses process back to input value through all converts ''' framerate = 30.0 timecode = '00:10:13:22' a = r9Audio.timecode_to_milliseconds(timecode, smpte=True, framerate=framerate) assert r9Core.floatIsEqual(a, 613733.333333, 0.0001) b = r9Audio.milliseconds_to_frame(a, framerate=framerate) assert r9Core.floatIsEqual(b, 18412.0, 0.0001) c = r9Audio.frame_to_milliseconds(b, framerate=framerate) assert r9Core.floatIsEqual(c, 613733.333333, 0.0001) d = r9Audio.milliseconds_to_Timecode(c, smpte=False, framerate=framerate) assert d == '00:10:13:733' # note converted to non-smpte e = r9Audio.timecode_to_frame(d, smpte=False, framerate=framerate) assert r9Core.floatIsEqual(e, 18411.99, 0.0001) f = r9Audio.frame_to_timecode(e, smpte=True, framerate=framerate) assert f == '00:10:13:22' assert f == timecode
def test_full_convert(self): ''' full round the houses process back to input value through all converts ''' framerate=30.0 timecode='00:10:13:22' a=r9Audio.timecode_to_milliseconds(timecode, smpte=True, framerate=framerate) assert r9Core.floatIsEqual(a, 613733.333333, 0.0001) b=r9Audio.milliseconds_to_frame(a, framerate=framerate) assert r9Core.floatIsEqual(b, 18412.0, 0.0001) c=r9Audio.frame_to_milliseconds(b, framerate=framerate) assert r9Core.floatIsEqual(c, 613733.333333, 0.0001) d=r9Audio.milliseconds_to_Timecode(c, smpte=False, framerate=framerate) assert d=='00:10:13:733' # note converted to non-smpte e=r9Audio.timecode_to_frame(d, smpte=False, framerate=framerate) assert r9Core.floatIsEqual(e, 18411.99, 0.0001) f=r9Audio.frame_to_timecode(e, smpte=True, framerate=framerate) assert f=='00:10:13:22' assert f==timecode
def test_path_given(self): pathNode = r9Audio.AudioNode(filepath=self.path) assert not pathNode.isLoaded assert pathNode.path == self.path assert not pathNode.audioNode assert int(pathNode.endFrame) == 199 assert int(pathNode.endTime) == 8294 assert pathNode.startTime == 0 assert pathNode.startFrame == 0 pathNode.importAndActivate() assert pathNode.isLoaded assert pathNode.audioNode assert pathNode.isValid()
def test_path_given(self): # build the AudioNode directly from the path not through Maya pathNode = r9Audio.AudioNode(filepath=self.path) assert not pathNode.isLoaded assert pathNode.path == self.path assert not pathNode.audioNode assert int(pathNode.endFrame) == 199 assert int(pathNode.endTime) == 8294 assert pathNode.startTime == 0 assert pathNode.startFrame == 0 pathNode.importAndActivate() assert pathNode.isLoaded assert pathNode.audioNode assert pathNode.isValid()
def setup(self): cmds.file(new=True, f=True) self.bwavpath = os.path.join(r9Setup.red9ModulePath(), 'tests', 'testFiles', 'bwav_test.wav') self.audioNode = r9Audio.AudioNode(filepath=self.bwavpath) self.audioNode.importAndActivate()
def test_full_convert(self): ''' full round the houses process back to input value through all converts ''' framerate = 30.0 timecode = '00:10:13:22' a = r9Audio.timecode_to_milliseconds(timecode, smpte=True, framerate=framerate) print a assert r9Core.floatIsEqual(a, 613733, 0.0001) b = r9Audio.milliseconds_to_frame(a, framerate=framerate) print b assert r9Core.floatIsEqual(b, 18412.0, 0.0001) c = r9Audio.frame_to_milliseconds(b, framerate=framerate) print c assert r9Core.floatIsEqual(c, 613733.0, 0.0001) d = r9Audio.milliseconds_to_Timecode(c, smpte=False, framerate=framerate) print d assert d == '00:10:13:733' # note converted to non-smpte e = r9Audio.timecode_to_frame(d, smpte=False, framerate=framerate) print e assert r9Core.floatIsEqual(e, 18412.0, 0.0001) f = r9Audio.frame_to_timecode(e, smpte=True, framerate=framerate) print e assert f == '00:10:13:22' assert f == timecode # try again with single tests assert r9Audio.timecode_to_frame('06:10:29:29', smpte=True, framerate=framerate) == 666899.0 assert r9Audio.frame_to_timecode(666899.0) == '06:10:29:29' assert r9Audio.timecode_to_milliseconds('06:10:29:29') == 22229966 assert r9Audio.milliseconds_to_Timecode(22229966) == '06:10:29:29' assert r9Audio.frame_to_milliseconds(666899.0) == 22229966 assert r9Audio.milliseconds_to_frame(22229966) == 666899.0 assert r9Audio.timecode_to_frame('06:10:29:29', smpte=True, framerate=29.97) == 666232.13
def test_full_convert(self): ''' full round the houses process back to input value through all converts ''' framerate = 30.0 timecode = '00:10:13:22' a = r9Audio.timecode_to_milliseconds(timecode, smpte=True, framerate=framerate) print a assert r9Core.floatIsEqual(a, 613733, 0.0001) b = r9Audio.milliseconds_to_frame(a, framerate=framerate) print b assert r9Core.floatIsEqual(b, 18412.0 , 0.0001) c = r9Audio.frame_to_milliseconds(b, framerate=framerate) print c assert r9Core.floatIsEqual(c, 613733.0, 0.0001) d = r9Audio.milliseconds_to_Timecode(c, smpte=False, framerate=framerate) print d assert d == '00:10:13:733' # note converted to non-smpte e = r9Audio.timecode_to_frame(d, smpte=False, framerate=framerate) print e assert r9Core.floatIsEqual(e, 18412.0, 0.0001) f = r9Audio.frame_to_timecode(e, smpte=True, framerate=framerate) print e assert f == '00:10:13:22' assert f == timecode # try again with single tests assert r9Audio.timecode_to_frame('06:10:29:29', smpte=True, framerate=framerate) == 666899.0 assert r9Audio.frame_to_timecode(666899.0) == '06:10:29:29' assert r9Audio.timecode_to_milliseconds('06:10:29:29') == 22229966 assert r9Audio.milliseconds_to_Timecode(22229966) == '06:10:29:29' assert r9Audio.frame_to_milliseconds(666899.0) == 22229966 assert r9Audio.milliseconds_to_frame(22229966) == 666899.0 assert r9Audio.timecode_to_frame('06:10:29:29', smpte=True, framerate=29.97) == 666232.13