Squeak Class Documentation category index | class index  
 
SoundRecorder
  category: Sound-Synthesis
  superclass: Object
  subclasses: SoundInputStream ChatRecorder

No comment. Sorry.

instance methods
  accessing
  codec:
desiredSampleRate:
isActive
isPaused
meterLevel
recordLevel
recordLevel:
samplingRate
samplingRate:

  initialization
  initialize
initializeRecordingState

  object fileIn
 

  primitives
  primGetActualRecordingSampleRate
primRecordSamplesInto:startingAt:
primSetRecordLevel:
primStartRecordingDesiredSampleRate:stereo:semaIndex:
primStopRecording

  private
  allocateBuffer
emitBuffer:
emitPartialBuffer
meterFrom:count:in:
recordLoop
samplesPerFrame

  recording controls
  clearRecordedSound
pause
playback
resumeRecording
startRecording
stopRecording

  results
  condensedSamples
condensedStereoSound
recordedSound
soundSegments

  trimming
  copyFrom:to:normalize:dcOffset:
copyTo:from:to:from:startingAt:normalize:dcOffset:
endPlace
firstSampleOverThreshold:dcOffset:startingAt:
normalizeFactorFor:min:max:dcOffset:
place:plus:
scanForEndThreshold:dcOffset:minLull:startingAt:
scanForStartThreshold:dcOffset:minDur:startingAt:
segmentsAbove:normalizedVolume:
suppressSilence
trim:normalizedVolume:

class methods
  accessing
  anyActive
canRecordWhilePlaying

  class initialization
  initialize

  instance creation
  new

instance methods
  accessing top  
 

codec:


 

desiredSampleRate:

use of this method indicates a strong desire for the specified rate, even if
the OS/hardware are not cooperative


 

isActive

Return true if I have a recordProcess running.


 

isPaused

Return true if recording is paused.


 

meterLevel

Return the meter level, an integer in the range [0..100] where zero is silence and 100 represents the maximum signal level possible without clipping.


 

recordLevel


 

recordLevel:

Set the desired recording level to the given value in the range 0.0 to 1.0, where 0.0 is the lowest recording level and 1.0 is the maximum. Do nothing if the sound input hardware does not support changing the recording level.


 

samplingRate


 

samplingRate:


  initialization top  
 

initialize

SoundRecorder new


 

initializeRecordingState


  object fileIn top  

  primitives top  
 

primGetActualRecordingSampleRate

Return the actual sample rate being used for recording. This primitive fails unless sound recording is currently in progress.


 

primRecordSamplesInto:startingAt:

Record a sequence of 16-bit sound samples into the given array starting at the given sample index. Return the number of samples recorded, which may be zero if no samples are currently available.


 

primSetRecordLevel:

Set the desired recording level to the given value in the range 0-1000, where 0 is the lowest recording level and 1000 is the maximum. Do nothing if the sound input hardware does not support changing the recording level.


 

primStartRecordingDesiredSampleRate:stereo:semaIndex:

Start sound recording with the given stereo setting. Use a sampling rate as close to the desired rate as the underlying platform will support. If the given semaphore index is > 0, it is taken to be the index of a Semaphore in the external objects array to be signalled every time a recording buffer is filled.


 

primStopRecording

Stop sound recording. Does nothing if recording is not currently in progress. Do not fail if plugin is not available


  private top  
 

allocateBuffer

Allocate a new buffer and reset nextIndex.


 

emitBuffer:

since some sound recording devices cannot (or will not) record below a certain sample rate,
trim the samples down if the user really wanted fewer samples


 

emitPartialBuffer


 

meterFrom:count:in:

Update the meter level with the maximum signal level in the given range of the given buffer.


 

recordLoop

Record process loop that records samples.


 

samplesPerFrame

Can be overridden to quantize buffer size for, eg, fixed-frame codecs


  recording controls top  
 

clearRecordedSound

Clear the sound recorded thus far. Go into pause mode if currently recording.


 

pause

Go into pause mode. The record level continues to be updated, but no sound is recorded.


 

playback

Playback the sound that has been recorded.


 

resumeRecording

Continue recording from the point at which it was last paused.


 

startRecording

Turn of the sound input driver and start the recording process. Initially, recording is paused.


 

stopRecording

Stop the recording process and turn of the sound input driver.


  results top  
 

condensedSamples

Return a single SoundBuffer that is the contatenation of all my recorded buffers.


 

condensedStereoSound

Decompose my buffers into left and right channels and return a mixed sound consisting of the those two channels. This may be take a while, since the data must be copied into new buffers.


 

recordedSound

Return the sound that was recorded.


 

soundSegments


  trimming top  
 

copyFrom:to:normalize:dcOffset:

Return a new SoundBuffer containing the samples in the given range.


 

copyTo:from:to:from:startingAt:normalize:dcOffset:

Copy samples from buf to resultBuf removing the DC offset and normalizing their volume in the process.


 

endPlace


 

firstSampleOverThreshold:dcOffset:startingAt:

Beginning at startPlace, this routine will return the first place at which a sample exceeds the given threshold.


 

normalizeFactorFor:min:max:dcOffset:

Return a normalization factor for the range of sample values and DC offset. A normalization factor is a fixed-point number that will be divided by 1000 after multiplication with each sample value.


 

place:plus:

Return the place that is nSamples (may be negative) beyond thisPlace.


 

scanForEndThreshold:dcOffset:minLull:startingAt:

Beginning at startPlace, this routine will find the last sound that exceeds threshold, such that if you look lull samples later you will not find another sound over threshold within the following block of lull samples.
Return the place that is lull samples beyond to that last sound.
If no end of sound is found, return endPlace.


 

scanForStartThreshold:dcOffset:minDur:startingAt:

Beginning at startPlace, this routine will find the first sound that exceeds threshold, such that if you look duration samples later you will find another sound over threshold within the following block of duration samples.
Return the place that is duration samples prior to that first sound.
If no sound is found, return endPlace.


 

segmentsAbove:normalizedVolume:

Break the current recording up into a sequence of sound segments separated by silences.


 

suppressSilence


 

trim:normalizedVolume:

Remove the leading and trailing parts of this recording that are below the given threshold. Remove any DC offset and scale the recording so that its peaks are the given percent of the maximum volume.


class methods
  accessing top  
 

anyActive

Return true if any sound recorder is actively recording


 

canRecordWhilePlaying

Return true if this platform supports simultaneous sound recording and playback.


  class initialization top  
 

initialize

SoundRecorder initialize


  instance creation top  
 

new

Answer a new instance of the receiver (which is a class) with no indexable variables. Fail if the class is indexable.