Squeak Class Documentation category index | class index  
 
WaveEditor
  category: Sound-Interface
  superclass: AlignmentMorph
  subclasses:

This tool was created to aid in the preparation of LoopedSampledSound objects. It includes support for finding good loop points with a little help from the user. Namely, the user must identify a good ending point for the loop (typically just before the decay phase begins) and identify one cycle of the waveform. After that, the "choose loop point" menu command can be invoked to search backwards to find and rank all possible loop starting points. Some experimentation is usually required to find a loop that "breaths" in a natural way.

This tool can also be used as a general viewer of numerical sequences of any kind, such as time-varying functions, FFT data, etc.

instance methods
  accessing
  data:
graph
loopCycles
loopCycles:
loopEnd
loopEnd:
loopLength
loopLength:
loopStart
loopStart:
perceivedFrequency
perceivedFrequency:
samplingRate
samplingRate:

  initialization
  addControls
addLoopPointControls
initialize

  menu
  chooseLoopStart
invokeMenu
jumpToLoopEnd
jumpToLoopStart
makeLoopedSampledSound
play
playAfterCursor
playBeforeCursor
playFrom:to:
playLoop
playTestNote
saveInstrument
setLoopEnd
setLoopStart
setOneCycle
setUnlooped
setUnpitched
showEnvelope
showFFTAtCursor
trimAfterCursor
trimBeforeCursor

  other
  autoCorrolationBetween:and:length:
errorBetween:and:
findPossibleLoopStartsFrom:
fractionalLoopStartAt:
interpolatedWindowAt:width:
normalize:
scrollTime:
step
stretch:by:
zeroCrossingAfter:

class methods
  instance creation
  openOn:

  parts bin
  descriptionForPartsBin

instance methods
  accessing top  
 

data:


 

graph


 

loopCycles


 

loopCycles:


 

loopEnd


 

loopEnd:


 

loopLength


 

loopLength:


 

loopStart


 

loopStart:


 

perceivedFrequency


 

perceivedFrequency:


 

samplingRate


 

samplingRate:


  initialization top  
 

addControls


 

addLoopPointControls


 

initialize


  menu top  
 

chooseLoopStart


 

invokeMenu

Invoke a menu of additonal functions for this WaveEditor.


 

jumpToLoopEnd


 

jumpToLoopStart


 

makeLoopedSampledSound


 

play


 

playAfterCursor


 

playBeforeCursor


 

playFrom:to:


 

playLoop


 

playTestNote


 

saveInstrument


 

setLoopEnd


 

setLoopStart

Assuming that the loop end and approximate frequency have been set, this method uses the current cursor position to determine the loop length and the number of cycles.


 

setOneCycle

Set the approximate frequency based on a single cycle specified by the user. To use this, first set the loop end, then place the cursor one full cycle before the loop end and invoke this method.


 

setUnlooped

Make this sound play straight through without looping.


 

setUnpitched

Make this instrument be unpitched and unlooped. Suitable for percussive sounds that should not be pitch-shifted when played. By convention, such sounds are played at a pitch of 100.0 to obtain their original pitch.


 

showEnvelope

Show an envelope wave constructed by collecting the maximum absolute value of the samples in fixed-size time windows of mSecsPerQuantum.


 

showFFTAtCursor


 

trimAfterCursor


 

trimBeforeCursor


  other top  
 

autoCorrolationBetween:and:length:

Answer the cummulative error between the portions of my waveform starting at the given two indices and extending for the given length. The larger this error, the greater the difference between the two waveforms.


 

errorBetween:and:

Answer the cummulative error between the two sample arrays, which are assumed to be the same size.


 

findPossibleLoopStartsFrom:

Assume loopEnd is one sample before a zero-crossing.


 

fractionalLoopStartAt:

Answer the fractional index starting point near the given integral index that results in the closest match with the cycle following the loop end.


 

interpolatedWindowAt:width:

Return an array of N samples starting at the given index in my data.


 

normalize:

Return a copy of the given sample array scaled to use the maximum 16-bit sample range. Remove any D.C. offset.


 

scrollTime:


 

step

Do some periodic activity. Use startStepping/stopStepping to start and stop getting sent this message. The time between steps is specified by this morph's answer to the stepTime message. The generic version dispatches control to the player, if any. The nasty circumlocation about owner's transformation is necessitated by the flexing problem that the player remains in the properties dictionary both of the flex and the real morph. In the current architecture, only the top renderer's pointer to the player should actually be honored for the purpose of firing.


 

stretch:by:

Return an array consisting of the given samples \stretched in time by the given factor.


 

zeroCrossingAfter:

Find the index of the next negative-to-non-negative transition at or after the current index. The result is the index, i, of a zero crossing such that the sample at i-1 is negative and the sample at i is zero or positive. Answer the index of the last sample if the end of the array is encountered before finding a zero crossing.


class methods
  instance creation top  
 

openOn:

Open a new WaveEditor on the given sequencable collection of data.


  parts bin top  
 

descriptionForPartsBin

If the receiver is a member of a class that would like to be represented in a parts bin, answer the name by which it should be known, and a documentation string to be provided, for example, as balloon help. When the 'nativitySelector' is sent to the 'globalReceiver', it is expected that some kind of Morph will result. The parameters used in the implementation below are for documentation purposes only!