The Trunk: MorphicExtras-nice.91.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: MorphicExtras-nice.91.mcz

commits-2
Nicolas Cellier uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-nice.91.mcz

==================== Summary ====================

Name: MorphicExtras-nice.91
Author: nice
Time: 22 August 2010, 8:39:17.098 pm
UUID: af9da0d8-0c7b-4cb8-b605-38a23306b682
Ancestors: MorphicExtras-cbr.90

minor change: avoid creating a SortedCollection when not necessary...
asSortedCollection asArray -> asArray sort

=============== Diff against MorphicExtras-cbr.90 ===============

Item was changed:
  ----- Method: WaveEditor>>findPossibleLoopStartsFrom: (in category 'other') -----
  findPossibleLoopStartsFrom: index
  "Assume loopEnd is one sample before a zero-crossing."
 
  | r postLoopCycleStart i postLoopCycleLength cycleLength cycleCount err oldI |
  r := OrderedCollection new.
 
  "Record the start and length of the first cycle after the loop endpoint."
  postLoopCycleStart := loopEnd + 1. "Assumed to be a zero-crossing."
  i := self zeroCrossingAfter: postLoopCycleStart
  + (0.9 * samplingRate / perceivedFrequency) asInteger.
  postLoopCycleLength := i - loopEnd - 1.
 
  "Step backwards one cycle at a time, using zero-crossings to find the
  beginning of each cycle, and record the auto-corrolation error between
  each cycle and the cycle following the loop endpoint. Assume pitch may shift gradually."
  i := self zeroCrossingAfter: postLoopCycleStart
  - (1.1 * postLoopCycleLength) asInteger.
  cycleLength := postLoopCycleStart - i.
  cycleCount := 1.
  [cycleLength > 0] whileTrue:
  [err := self
  autoCorrolationBetween: i
  and: postLoopCycleStart
  length: postLoopCycleLength.
  r add: (Array
  with: i
  with: err
  with: cycleCount
  with: ((loopEnd - i) asFloat / self samplingRate roundTo: 0.01)).
  oldI := i.
  i := self zeroCrossingAfter: oldI - (1.1 * cycleLength) asInteger.
  cycleLength := oldI - i. "will be zero when start of data is encountered"
  cycleCount := cycleCount + 1].
+ ^r asArray sort: [:e1 :e2 | e1 second < e2 second]!
- r := r asSortedCollection: [:e1 :e2 | (e1 second) < (e2 second)].
- ^r asArray!