[Etoys] OggVorbisCodec crash

karl karl.ramberg at comhem.se
Sun Dec 9 14:28:45 EST 2007

Takashi Yamamiya wrote:
> Hi Karl,
> (sorry I misspelled your name)
> 2007/12/8, Karl <karl.ramberg at comhem.se>:
>> Takashi Yamamiya wrote:
>>> This is my excuse. OggPlugin is made for SoundRecoder which uses
>>> SequentialSound as internal sound buffer. So I didn't care that
>>> such huge chunk of data is passed to the plugin a time.
>>> It should be handled as primitiveFailed at least.
>>> VM crash is a bug anyway.
>> So one must send smaller chunks to the plugin. Do you have workaround ?
>> Karl
> Yes, if you can divide SampledSound into a number of SequentialSound for
> each second, it should work. But I don't know an easy way to convert to
> SequentialSound. I'll take a look at that. It is a shame.
I made this method:
    | newSound sound samplesPerSecond size buffer startIndex stopIndex 
tempSound |
    size := self samples size.
    startIndex := 1.
    newSound := SequentialSound new.
    samplesPerSecond := (self computeSamplesForSeconds: 1) size.
        to: size
        by: samplesPerSecond
        do: [:i |
             ((stopIndex _ startIndex + samplesPerSecond) > size) 
ifTrue:[ stopIndex _ size].
            buffer := self samples copyFrom: startIndex to: stopIndex.
            sound := SampledSound samples: buffer samplingRate: self 
            tempSound _ sound compressWith: OggVorbisCodec.
                add: tempSound.
            startIndex := stopIndex + 1].
    ^ newSound

This method returns a SequentialSound with several SampledSounds 
compressed with OggVorbis in it. It's not optimal as you can notice the 
cut between the each sound.


More information about the Etoys mailing list