returns 20 tracks from a specified search in an array of Track objects
427151
def search term
      response = Faraday.get("#{API_BASE}/categorylist/#{term}")
      attributes = JSON.parse(response.body)
      assemble_tracks attributes
    end
308953
int[] getChunkSizes(Track track) {

        long[] referenceChunkStarts = fragmenter.sampleNumbers(track);
        int[] chunkSizes = new int[referenceChunkStarts.length];


        for (int i = 0; i < referenceChunkStarts.length; i++) {
            long start = referenceChunkStarts[i] - 1;
            long end;
            if (referenceChunkStarts.length == i + 1) {
                end = track.getSamples().size();
            } else {
                end = referenceChunkStarts[i + 1] - 1;
            }

            chunkSizes[i] = l2i(end - start);
        }
        assert DefaultMp4Builder.this.track2Sample.get(track).size() == sum(chunkSizes) : "The number of samples and the sum of all chunk lengths must be equal";
        return chunkSizes;


    }
479833
public double[] calculateDrift(ArrayList<T> tracks){
		double[] result = new double[3];
		
		double sumX =0;
		double sumY = 0;
		double sumZ = 0;
		int N=0;
		for(int i = 0; i < tracks.size(); i++){
			T t = tracks.get(i);
			TrajectoryValidIndexTimelagIterator it = new TrajectoryValidIndexTimelagIterator(t,1);
	
			//for(int j = 1; j < t.size(); j++){
			while(it.hasNext()) {
				int j = it.next();
				sumX += t.get(j+1).x - t.get(j).x;
				sumY += t.get(j+1).y - t.get(j).y;
				sumZ += t.get(j+1).z - t.get(j).z;
				N++;
			}
		}
		result[0] = sumX/N;
		result[1] = sumY/N;
		result[2] = sumZ/N;
		return result;
	}
731517
def getTracksInCollection(user=nil,start=nil,count=nil,sort=nil,query=nil,extras=nil)
      method = 'getTracksInCollection'
      type = Track
      args = {}
      args[:user] = user if user
      args[:start] = start if start
      args[:count] = count if count
      args[:sort] = sort if sort
      args[:query] = query if query
      args[:extras] = extras if extras
      return_object type,method,args
    end
925517
public static List<Track> nonEmptyTracks(final List<Track> tracks) {
		return tracks.stream()
			.map(track -> track.toBuilder()
				.listMap(Filters::nonEmptySegments)
				.build())
			.filter(Track::nonEmpty)
			.collect(toList());
	}
320398
public function getAllTracks()
    {
        $cacheId = __CLASS__ . '_' . __FUNCTION__;

        if ($results = $this->cache->load($cacheId)) {
            return $results;
        }

        $select = "SELECT gtr_id_track, gtr_track_name
                    FROM gems__tracks
                    WHERE gtr_track_class != 'SingleSurveyEngine'
                    ORDER BY gtr_track_name";

        $results = $this->db->fetchPairs($select);
        $this->cache->save($results, $cacheId, array('tracks'));
        return $results;
    }
1302163
def _load_track_estimates(track, estimates_dir, output_dir):
    """"""
    user_results = {}
    track_estimate_dir = os.path.join(
        estimates_dir,
        track.subset,
        track.name
    )
    for target in glob.glob(
        track_estimate_dir + '/*.wav'
    ):

        target_name = op.splitext(
            os.path.basename(target)
        )[0]
        try:
            target_audio, _ = sf.read(
                target,
                always_2d=True
            )
            user_results[target_name] = target_audio
        except RuntimeError:
            pass

    if user_results:
        eval_mus_track(
            track,
            user_results,
            output_dir=output_dir
        )

    return None
1292682
def search_all(self, quota=50, format='json'):
        '''
        
        '''
        quota_left = quota
        results = []
        while quota_left > 0:
            more_results = self._search(quota_left, format)
            if not more_results:
                break
            results += more_results
            quota_left = quota_left - len(more_results)
            time.sleep(1)
        results = results[0:quota]
        return results
1010037
def search(self, s, stype=1, offset=0, total='true', limit=60):
        """"""
        action = uri + '/search/get'
        data = {
            's': s,
            'type': stype,
            'offset': offset,
            'total': total,
            'limit': 60
        }
        resp = self.request('POST', action, data)
        if resp['code'] == 200:
            return resp['result']['songs']
        return []
446365
function sortTracks(tracks) {
  var lib = new MusicLibraryIndex();
  tracks.forEach(function(track) {
    lib.addTrack(track);
  });
  lib.rebuildTracks();
  var results = [];
  lib.artistList.forEach(function(artist) {
    artist.albumList.forEach(function(album) {
      album.trackList.forEach(function(track) {
        results.push(track);
      });
    });
  });
  return results;
}
943992
def match_tracks(self, model_tracks, obs_tracks, unique_matches=True, closest_matches=False):
        
        if unique_matches:
            pairings = self.track_matcher.match_tracks(model_tracks, obs_tracks, closest_matches=closest_matches)
        else:
            pairings = self.track_matcher.neighbor_matches(model_tracks, obs_tracks)
        return pairings
699678
def get_tagged_tracks(self, tag, limit=None, cacheable=True):
        """"""

        params = self._get_params()
        params["tag"] = tag
        params["taggingtype"] = "track"
        if limit:
            params["limit"] = limit
        doc = self._request(self.ws_prefix + ".getpersonaltags", cacheable, params)
        return _extract_tracks(doc, self.network)
1356745
@Override
	public void spawnTracks() {
		for (int setIndex = 0; setIndex < sets.length; setIndex++) {
			SetTrackInfo<Desc> info = sets[setIndex];

			// setup data structures
			if( info.isAssociated.length < info.featDst.size ) {
				info.isAssociated = new boolean[ info.featDst.size ];
			}

			// see which features are associated in the dst list
			for( int i = 0; i < info.featDst.size; i++ ) {
				info.isAssociated[i] = false;
			}

			for( int i = 0; i < info.matches.size; i++ ) {
				info.isAssociated[info.matches.data[i].dst] = true;
			}

			// create new tracks from latest unassociated detected features
			for( int i = 0; i < info.featDst.size; i++ ) {
				if( info.isAssociated[i] )
					continue;

				Point2D_F64 loc = info.locDst.get(i);
				addNewTrack(setIndex, loc.x,loc.y,info.featDst.get(i));
			}
		}

	}
707347
async def load_tracks(self, query) -> LoadResult:
        
        self.__check_node_ready()
        url = self._uri + quote(str(query))

        data = await self._get(url)

        if isinstance(data, dict):
            return LoadResult(data)
        elif isinstance(data, list):
            modified_data = {
                "loadType": LoadType.V2_COMPAT,
                "tracks": data
            }
            return LoadResult(modified_data)
713566
function(track) {
  var request = new XMLHttpRequest()
  request.open('GET', 'sounds/' + track + '.wav', true)
  request.responseType = 'arraybuffer'
  request.onload = function() {
    context.decodeAudioData(request.response, function(buffer) {
      var createNode = function() {
        var node = context.createBufferSource()
        node.buffer = buffer
        node.connect(context.destination)
        return node
      }
      soundBank[track] = { createNode: createNode }
    })
  }
  request.send()
}
326305
function getGoToTrackState({
  prevState,
  index,
  track,
  shouldPlay = true,
  shouldForceLoad = false
}) {
  const isNewTrack = prevState.activeTrackIndex !== index;
  const shouldLoadAsNew = Boolean(isNewTrack || shouldForceLoad);
  const currentTime = track.startingTime || 0;
  return {
    duration: getInitialDuration(track),
    activeTrackIndex: index,
    trackLoading: shouldLoadAsNew,
    mediaCannotPlay: prevState.mediaCannotPlay && !shouldLoadAsNew,
    currentTime: convertToNumberWithinIntervalBounds(currentTime, 0),
    loop: shouldLoadAsNew ? false : prevState.loop,
    shouldRequestPlayOnNextUpdate: Boolean(shouldPlay),
    awaitingPlayAfterTrackLoad: Boolean(shouldPlay),
    awaitingForceLoad: Boolean(shouldForceLoad),
    maxKnownTime: shouldLoadAsNew ? 0 : prevState.maxKnownTime
  };
}
520401
private void trackUsingKlt(List<CombinedTrack<TD>> tracks) {
		for( int i = 0; i < tracks.size();  ) {
			CombinedTrack<TD> track = tracks.get(i);

			if( !trackerKlt.performTracking(track.track) ) {
				// handle the dropped track
				tracks.remove(i);
				tracksDormant.add(track);
			} else {
				track.set(track.track.x,track.track.y);
				i++;
			}
		}
	}