Re: SoundRecorder

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

Re: SoundRecorder

Scott Wallace-3
Hi, John, and all,

It perhaps bears mentioning that my tests were all run on an Intel Mac.

        -- S

On Nov 8, 2006, at 5:32 PM, Scott Wallace wrote:

> I downloaded the 3.9 image you pointed to, ran it on my Mac, and  
> discovered:
>
> (a)  The sound-in-event-recorder bug *does* occur.  But it's  
> slightly different:  although the speed of playback is nearly  
> doubled, as in OLPC, the *pitch* does not change.  So it is not a  
> Donald Duck sound.
>
> (b)  Also, the same bug now (i.e. in 3.9) also occurs in the  
> vanilla SoundRecorderMorph!  (In the OLPC/Mac image, the vanilla  
> SoundRecorderMorph produces good playback on the Mac -- it's only  
> the use of sound within an EventRecorderMorph that's  
> problematical.  In the 3.9/Mac image *every* SoundRecorderMorph use  
> has this problem.  But again, the overly-fast playback occurs  
> *without* a pitch rise.)
>
> So evidently 3.9 went "final" with the SoundRecorder completely  
> broken on the Mac.
>
>
> Hopefully the above observations will provide some useful clues.  
> After all, we now have examples of images in which:
>
> [a]  Plain SoundRecorder and EventRecorder-Sound both work fine  
> [Squeakland3.8]
>
> [b]  Plain SoundRecorder works fine but EventRecorder-Sound is  
> broken, donald-duck style [OLPC]
>
> [c]  Plain SoundRecorder and EventRecorder-Sound are *both*  
> broken;  playback too fast but no donald-duck-style pitch [Squeak 3.9]
>
>
> BTW:  all my tests were run with the same Mac VM, namely Squeak  
> 3.8.12beta4U.app.
>
>
> Cheers,
>
>  -- Scott
>
>
> On Nov 8, 2006, at 10:31 AM, Yoshiki Ohshima wrote:
>
>>   ... It looks like the code we use is pretty much similar in the one
>> Squeak 3.9.  Can you check if you can reproduce it in an image like:
>>
>> http://ftp.squeak.org/3.9/Squeak3.9-final-7067.zip
>>
>> -- Yoshiki
>>
>> On Oct 31, 2006 at 2:27 PM, Scott Wallace wrote:
>>
>>> The sound-recording option of the EventRecorder in OLPC1.0 has  
>>> somehow gotten broken, in that when you play back an event-
>>> recording that was recorded with sound, the sound comes out  
>>> Donald-Duck style, almost twice as fast as real time.



Reply | Threaded
Open this post in threaded view
|

Re: SoundRecorder

johnmci
My notes indicate that at 3.8.6b5 is where I switch to the unix/
quartz unix sound code that uses core audio.

You should try with a 3.8.6b4 or earlier VM and see if you have the  
same problems.


On 8-Nov-06, at 7:22 PM, Scott Wallace wrote:

> Hi, John, and all,
>
> It perhaps bears mentioning that my tests were all run on an Intel  
> Mac.
>
> -- S
>
> On Nov 8, 2006, at 5:32 PM, Scott Wallace wrote:
>
>> I downloaded the 3.9 image you pointed to, ran it on my Mac, and  
>> discovered:
>>
>> (a)  The sound-in-event-recorder bug *does* occur.  But it's  
>> slightly different:  although the speed of playback is nearly  
>> doubled, as in OLPC, the *pitch* does not change.  So it is not a  
>> Donald Duck sound.
--
========================================================================
===
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
========================================================================
===



Reply | Threaded
Open this post in threaded view
|

Re: SoundRecorder

Scott Wallace-3
Hi, John,

Okay -- as you suspected, I can confirm that the bug does *not* occur  
when I switch to a sufficiently old VM.

Running an old 3.8.1Beta2 VM, I tested both the SoundRecorder and  
sound use in the EventRecorder, in both Squeak3.9 and OLPC1.0, and  
never encountered any problems.

So...?

Cheers,

   -- Scott



On Nov 8, 2006, at 10:19 PM, John M McIntosh wrote:

> My notes indicate that at 3.8.6b5 is where I switch to the unix/
> quartz unix sound code that uses core audio.
>
> You should try with a 3.8.6b4 or earlier VM and see if you have the  
> same problems.
>
>
> On 8-Nov-06, at 7:22 PM, Scott Wallace wrote:
>
>> Hi, John, and all,
>>
>> It perhaps bears mentioning that my tests were all run on an Intel  
>> Mac.
>>
>> -- S
>>
>> On Nov 8, 2006, at 5:32 PM, Scott Wallace wrote:
>>
>>> I downloaded the 3.9 image you pointed to, ran it on my Mac, and  
>>> discovered:
>>>
>>> (a)  The sound-in-event-recorder bug *does* occur.  But it's  
>>> slightly different:  although the speed of playback is nearly  
>>> doubled, as in OLPC, the *pitch* does not change.  So it is not a  
>>> Donald Duck sound.
> --
> ======================================================================
> =====
> John M. McIntosh <[hidden email]>
> Corporate Smalltalk Consulting Ltd.  http://
> www.smalltalkconsulting.com
> ======================================================================
> =====
>
>


Reply | Threaded
Open this post in threaded view
|

Re: SoundRecorder

johnmci
Well it means I get to read some C code and wander thru apple  
developer pages, and press buttons in XCode for the weekend.

On 8-Nov-06, at 10:49 PM, Scott Wallace wrote:

> Hi, John,
>
> Okay -- as you suspected, I can confirm that the bug does *not*  
> occur when I switch to a sufficiently old VM.
>
> Running an old 3.8.1Beta2 VM, I tested both the SoundRecorder and  
> sound use in the EventRecorder, in both Squeak3.9 and OLPC1.0, and  
> never encountered any problems.
>
> So...?
>
> Cheers,
>
>   -- Scott
>
>

--
========================================================================
===
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
========================================================================
===



Reply | Threaded
Open this post in threaded view
|

Re: SoundRecorder

Scott Wallace-3
Thank you, John.  That sounds like fun!

Another clue, and caution, is that occasionally (for me, maybe 5% of  
the time) the sound speedup bug does *not* occur.

Cheers,

   -- Scott


On Nov 8, 2006, at 10:58 PM, John M McIntosh wrote:

> Well it means I get to read some C code and wander thru apple  
> developer pages, and press buttons in XCode for the weekend.
>
> On 8-Nov-06, at 10:49 PM, Scott Wallace wrote:
>
>> Hi, John,
>>
>> Okay -- as you suspected, I can confirm that the bug does *not*  
>> occur when I switch to a sufficiently old VM.
>>
>> Running an old 3.8.1Beta2 VM, I tested both the SoundRecorder and  
>> sound use in the EventRecorder, in both Squeak3.9 and OLPC1.0, and  
>> never encountered any problems.
>>
>> So...?
>>
>> Cheers,
>>
>>   -- Scott
>>
>>
>
> --
> ======================================================================
> =====
> John M. McIntosh <[hidden email]>
> Corporate Smalltalk Consulting Ltd.  http://
> www.smalltalkconsulting.com
> ======================================================================
> =====
>
>


Reply | Threaded
Open this post in threaded view
|

Re: SoundRecorder

johnmci
In reply to this post by Scott Wallace-3
Ok, well grabbing the sound recording morphic in a 3.9 image I find  
that the sound recorder is saying the recording rate is
11050 and records sound at this rate, now if you watch the second  
hand and count to 10, then hit play, what happens is the
SoundPlayer then is asked to play those sound buffers at 22050 and  
again looking at the clock we see the counting to 10 happens
in 5 seconds.

However I'm not sure where the issue is yet, I think the math  
involved in calculating the samples from a routine that is given  
bytes moved is suspect. I'll look more in a day or two.   For testing  
I recorded a countdown with a Squeak 3.8.1Beta2.app, then played  
back, it was fine, then saved the image and played back with a  
3.8.14b3U vm on powerpc, it was fine.

Then I recorded with a 3.8.14b3U and played back it was 2x too fast,  
then saved the image and played back with a 3.8.1b2 vm, and again it  
was too fast which tells me the sound is not being recorded correctly  
once Ian made the switch to core audio.

On 8-Nov-06, at 7:22 PM, Scott Wallace wrote:

> Hi, John, and all,
>
> It perhaps bears mentioning that my tests were all run on an Intel  
> Mac.
>
> -- S
>
> On Nov 8, 2006, at 5:32 PM, Scott Wallace wrote:
>
>> I downloaded the 3.9 image you pointed to, ran it on my Mac, and  
>> discovered:
>>
>> (a)  The sound-in-event-recorder bug *does* occur.  But it's  
>> slightly different:  although the speed of playback is nearly  
>> doubled, as in OLPC, the *pitch* does not change.  So it is not a  
>> Donald Duck sound.
--
========================================================================
===
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
========================================================================
===



Reply | Threaded
Open this post in threaded view
|

Re: SoundRecorder

Dominique Dutoit-2
In reply to this post by Scott Wallace-3
I think I have found the culprit.

If you listen carefully to the recorded sound, you will notice that  
frames are dropped at regular intervals. Since this pattern is quite  
obvious and the VM doesn't seem to screw the sound data, it should be  
something happening at the image level.

Looking for a clue in a 3.9 alpha version, I found a change made by  
"dgd" on April 4, 2006:

        "workaround for OSS emulation on top
        on ALSA (on Linux environments)"
        (Delay forMilliseconds: 20) wait.

If the last line is commented out, the sound recorder just works as  
expected. The same code is present in the OLPC and Squeakland images  
and both work pretty well without this delay.

CoreAudio records the audio input in real time but SoundRecorder  
picks the data once in a while. The end result is that the sound data  
is stored in a different time frame that the sampling rate and the  
sound plays faster.

Now I am not sure what can be done to have a cross-platform solution,  
but as far I have seen the problem is not on the Mac VM side.

Reply | Threaded
Open this post in threaded view
|

Re: SoundRecorder

Bert Freudenberg
On Nov 26, 2006, at 12:46 , Dominique Dutoit wrote:

> I think I have found the culprit.
>
> If you listen carefully to the recorded sound, you will notice that  
> frames are dropped at regular intervals. Since this pattern is  
> quite obvious and the VM doesn't seem to screw the sound data, it  
> should be something happening at the image level.
>
> Looking for a clue in a 3.9 alpha version, I found a change made by  
> "dgd" on April 4, 2006:
>
> "workaround for OSS emulation on top
> on ALSA (on Linux environments)"
> (Delay forMilliseconds: 20) wait.
>
> If the last line is commented out, the sound recorder just works as  
> expected. The same code is present in the OLPC and Squeakland  
> images and both work pretty well without this delay.
>
> CoreAudio records the audio input in real time but SoundRecorder  
> picks the data once in a while. The end result is that the sound  
> data is stored in a different time frame that the sampling rate and  
> the sound plays faster.
>
> Now I am not sure what can be done to have a cross-platform  
> solution, but as far I have seen the problem is not on the Mac VM  
> side.

Since there is now an ALSA plugin we don't really need the OSS  
emulation anymore. Maybe Diego could explain what this was about?

- Bert -



Reply | Threaded
Open this post in threaded view
|

Re: SoundRecorder

johnmci
In reply to this post by Dominique Dutoit-2
SoundRecorder>>recordLoop

Ah, which explains why I couldn't see anything wrong. I'll note we  
convert data from the internal recording format, to the format PCM  
need by Squeak at the desired frequency using core audio, that looked  
ok. Once that is done we move bytes over and did some math to convert  
the bytes moved into the number of samples.  I had noticed it was  
clipping sound and I was  earlier in the week looking at the math  
involved but couldn't see anything wrong.


On 26-Nov-06, at 3:46 AM, Dominique Dutoit wrote:

> I think I have found the culprit.
>
> If you listen carefully to the recorded sound, you will notice that  
> frames are dropped at regular intervals. Since this pattern is  
> quite obvious and the VM doesn't seem to screw the sound data, it  
> should be something happening at the image level.
>
> Looking for a clue in a 3.9 alpha version, I found a change made by  
> "dgd" on April 4, 2006:
>
> "workaround for OSS emulation on top
> on ALSA (on Linux environments)"
> (Delay forMilliseconds: 20) wait.
>
> If the last line is commented out, the sound recorder just works as  
> expected. The same code is present in the OLPC and Squeakland  
> images and both work pretty well without this delay.
>
> CoreAudio records the audio input in real time but SoundRecorder  
> picks the data once in a while. The end result is that the sound  
> data is stored in a different time frame that the sampling rate and  
> the sound plays faster.
>
> Now I am not sure what can be done to have a cross-platform  
> solution, but as far I have seen the problem is not on the Mac VM  
> side.
>

--
========================================================================
===
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
========================================================================
===