jump to navigation

Audacity: Looping and Dictation Aids August 25, 2007

Posted by samwyse in Uncategorized.
trackback

One of the Audacity use cases lists functions that would be useful when transcribing recordings.  I’ve investigated what is required to implement these features, and while it’s more complicated than I might have hoped, it doesn’t appear to be insurmountable.  Looping play repeats the initially selected section until stopped; however the selected region can be changed without affecting the looping region.  Similarly, it seems apparent that dynamic changes to the looping region should not change the current selection.  Therefore, none of the current “change selection” code can be re-used.
Instead, I’m leaning towards new methods for the AudioIO class.  I’ll need names for all of these.

  • When the user hits right-bracket, set the end of looping region to the current position and go back to beginning immediately.
    void AudioIO::ShortenRight() {
       mT1 = mT;
       for (i = 0; i < mPlaybackTracks.GetCount(); i++)
          mPlaybackMixers[i]->Restart();
       mT = mT0;
    }
  • When the user hits left-bracket, set the beginning of the looping play to the current play position immediately.
    void AudioIO::ShortenLeft() {
       mT0 = mT;
    }
  • When the user hits shift-right-bracket, set the end of the looping region to the end of the track immediately.
    void AudioIO::LengthenRight() {
       AudacityProject *p = GetActiveProject();
       if (p) TrackList *t = p->GetTracks();
       mT1 = t->GetEndTime();
    }
  • When the user hits shift-left-bracket, set the beginning of the looping region to the existing end of the looping region and move the play head to this new location. Also set the end of the looping region to the end of the track.
    void AudioIO::LoopNext() {
       mT0 = mT1;
       AudacityProject *p = GetActiveProject();

       if (p) TrackList *t = p->GetTracks();

       mT1 = t->GetEndTime();
       for (i = 0; i < mPlaybackTracks.GetCount(); i++)
          mPlaybackMixers[i]->Restart();
       mT = mT0;
    }

I realize that there are some problems with the above code, especially where I get the track list.

Advertisements

Comments»

No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: