コード例 #1
0
    def SetChannel(self, new_channel):
        """Set a new channel, estimates the values to be displayed.

        :param new_channel: (sppasChannel)

        """
        # Set the channel
        self._channel = new_channel

        wx.BeginBusyCursor()
        b = wx.BusyInfo("Please wait while loading and analyzing data...")

        # To estimate values related to amplitude
        frames = self._channel.get_frames(self._channel.get_nframes())
        self._ca = sppasAudioFrames(frames, self._channel.get_sampwidth(), 1)

        # Estimates the RMS (=volume), then find where are silences, then IPUs
        self._cv = sppasChannelSilence(self._channel)
        self._cv.search_silences()  # threshold=0, mintrackdur=0.08
        self._cv.filter_silences()  # minsildur=0.2
        self._tracks = self._cv.extract_tracks()  # mintrackdur=0.3

        b.Destroy()
        b = None
        wx.EndBusyCursor()
コード例 #2
0
    def SetChannel(self, new_channel):
        """ Set a new channel, estimates the values to be displayed.

        :param new_channel: (sppasChannel)

        """
        # Set the channel
        self._channel = new_channel

        wx.BeginBusyCursor()
        b = wx.BusyInfo("Please wait while loading and analyzing data...")

        # To estimate values related to amplitude
        frames = self._channel.get_frames(self._channel.get_nframes())
        self._ca = sppasAudioFrames(frames, self._channel.get_sampwidth(), 1)

        # Estimates the RMS (=volume), then find where are silences, then IPUs
        self._cv = sppasChannelSilence(self._channel)
        self._cv.search_silences()               # threshold=0, mintrackdur=0.08
        self._cv.filter_silences()               # minsildur=0.2
        self._tracks = self._cv.extract_tracks() # mintrackdur=0.3

        b.Destroy()
        b = None
        wx.EndBusyCursor()
コード例 #3
0
ファイル: audioinfo.py プロジェクト: gmontcheuil/sppas
    print("  - max:           {:d}".format(audiovol.max()))
    print("  - mean:          {:.2f}".format(audiovol.mean()))
    print("  - median:        {:.2f}".format(audiovol.median()))
    print("  - stdev:         {:.2f}".format(audiovol.stdev()))
    print("  - coefvariation: {:.2f}".format(audiovol.coefvariation()))

else:

    for n in range(nc):
        print("Channel {:d}".format(n))
        cidx = audio.extract_channel(n)
        channel = audio.get_channel(cidx)

        # Values related to amplitude
        frames = channel.get_frames(channel.get_nframes())
        ca = sppasAudioFrames(frames, channel.get_sampwidth(), 1)
        for i in range(2, 9, 2):
            f = float(i)/10.
            c = ca.clipping_rate(f) * 100.
            print("  - factor={:.1f}:      {:.3f}".format(f, c))

        # RMS (=volume)
        cv = sppasChannelVolume(channel)
        print("  Volume:")
        print("  - min:           {:d}".format(cv.min()))
        print("  - max:           {:d}".format(cv.max()))
        print("  - mean:          {:.2f}".format(cv.mean()))
        print("  - median:        {:.2f}".format(cv.median()))
        print("  - stdev:         {:.2f}".format(cv.stdev()))
        print("  - coefvariation: {:.2f}".format(cv.coefvariation()))
コード例 #4
0
if verbose > 1:
    print("\nBegin getting factor at %s" %
          time.strftime('%d/%m/%y %H:%M:%S', time.localtime()))

if p:
    p.update(0.1, "Left")
minleft, maxleft = mixer_left.get_minmax()
if p:
    p.update(0.5, "Right")
minright, maxright = mixer_right.get_minmax()

if p:
    p.update(0.9, "Attenuator estimation")
maxval = max(maxleft, maxright)
maxvalth = sppasAudioFrames().get_maxval(sampleswidth)

if maxval > maxvalth:
    attenuator = float(maxvalth) / maxval * 0.95
else:
    attenuator = 1

if verbose > 0:
    p.update(1, "")
    del p
if verbose > 1:
    print("\nEnd getting factor at %s" %
          time.strftime('%d/%m/%y %H:%M:%S', time.localtime()))

# ========================MIX============================#
コード例 #5
0
ファイル: audioinfo.py プロジェクト: lym0302/sppas
    print("  - max:           {:d}".format(audiovol.max()))
    print("  - mean:          {:.2f}".format(audiovol.mean()))
    print("  - median:        {:.2f}".format(audiovol.median()))
    print("  - stdev:         {:.2f}".format(audiovol.stdev()))
    print("  - coefvariation: {:.2f}".format(audiovol.coefvariation()))

else:

    for n in range(nc):
        print("Channel {:d}".format(n))
        cidx = audio.extract_channel(n)
        channel = audio.get_channel(cidx)

        # Values related to amplitude
        frames = channel.get_frames(channel.get_nframes())
        ca = sppasAudioFrames(frames, channel.get_sampwidth(), 1)
        for i in range(2, 9, 2):
            f = float(i) / 10.
            c = ca.clipping_rate(f) * 100.
            print("  - factor={:.1f}:      {:.3f}".format(f, c))

        # RMS (=volume)
        cv = sppasChannelVolume(channel)
        print("  Volume:")
        print("  - min:           {:d}".format(cv.min()))
        print("  - max:           {:d}".format(cv.max()))
        print("  - mean:          {:.2f}".format(cv.mean()))
        print("  - median:        {:.2f}".format(cv.median()))
        print("  - stdev:         {:.2f}".format(cv.stdev()))
        print("  - coefvariation: {:.2f}".format(cv.coefvariation()))
コード例 #6
0
ファイル: audiotoaster.py プロジェクト: gmontcheuil/sppas
if verbose > 1:
    print("\nBegin getting factor at %s" %
          time.strftime('%d/%m/%y %H:%M:%S', time.localtime()))

if p:
    p.update(0.1, "Left")
minleft, maxleft = mixer_left.get_minmax()
if p:
    p.update(0.5, "Right")
minright, maxright = mixer_right.get_minmax()

if p:
    p.update(0.9, "Attenuator estimation")
maxval = max(maxleft, maxright)
maxvalth = sppasAudioFrames().get_maxval(sampleswidth)

if maxval > maxvalth:
    attenuator = float(maxvalth)/maxval*0.95
else:
    attenuator = 1

if verbose > 0:
    p.update(1, "")
    del p
if verbose > 1:
    print("\nEnd getting factor at %s" %
          time.strftime('%d/%m/%y %H:%M:%S', time.localtime()))

# ========================MIX============================#