Sound stuff

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

Sound stuff

Brian Brown-2
Hello all,

I did the following in a workspace:

rec := SoundRecorder new
rec recordLevel: 1.0.
rec samplingRate: 22050.
rec samplingRate.
rec clearRecordedSound.
rec resumeRecording.
rec pause.
rec playback.


The audio that came out was much faster than the recorded sound and  
has a lot of reverb. I dimly remembered something about reverb from  
my first Squeak experiments, so I tracked down the  
AbstractSound>>play and saw that SoundRecorder is used for playback.  
I turned off reverb in SoundRecorder and that worked, but I still  
have the issue of the speed of the recording...

I got the SequentialSound out of the SoundRecorder and used wrote out  
a wav file:

sound := rec recordedSound
sound storeWAVOnFileNamed: 'foo.wav'.

Which also plays back much faster than the recording should. Anyone  
have any ideas why there would be this mismatch?


Thanks!

Brian


Reply | Threaded
Open this post in threaded view
|

Re: Sound stuff

johnmci
On May 16, 2007, at 9:59 AM, Brian Brown wrote:

> Which also plays back much faster than the recording should. Anyone  
> have any ideas why there would be this mismatch?

would that be the issue below?


> From:  [hidden email]
> Subject: Sound Recording on Mac
> Date: November 8, 2006 6:00:46 PM PST (CA)
> To:  [hidden email], squeak-
> [hidden email], [hidden email]
>
>   Hello,
>
>   Has anybody tried sound recording and playback on Mac lately?  Scott
> reported that it is broken in Squeak 3.9 7067 (and OLPC etoys image)
> on 3.8.12beta4U.app VM.  What happens is that if you record your voice
> with a SoundRecorderMorph or EventRecorderMorph (with the voiceControl
> enabled) and play the recorded sound back, you get incorrect sound.
>
>   Here is what Scott described:
>
> --------------------------------------
> (a)  The sound-in-event-recorder bug *does* occur [in 3.9 7067].  
> 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.
> --------------------------------------


> From:  [hidden email]
> Subject: Re: SoundRecorder
> Date: November 26, 2006 3:46:21 AM PST (CA)
> To:  [hidden email]
> Reply-To:  [hidden email]
>
> 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
========================================================================
===



Reply | Threaded
Open this post in threaded view
|

Re: Sound stuff

johnmci
In reply to this post by Brian Brown-2

On May 16, 2007, at 9:59 AM, Brian Brown wrote:

> Which also plays back much faster than the recording should. Anyone  
> have any ideas why there would be this mismatch?

See
http://bugs.squeak.org/view.php?id=3272


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



Reply | Threaded
Open this post in threaded view
|

Re: Sound stuff

Brian Brown-2
Hey John, thanks for the reply!

I had read those messages earlier but didn't think this patch  
applied. I loaded that cs into my image, but it has made no  
difference, so I'm still at a loss as to why this is happening.

thanks!

Brian

On May 16, 2007, at 11:50 AM, John M McIntosh wrote:

>
> On May 16, 2007, at 9:59 AM, Brian Brown wrote:
>
>> Which also plays back much faster than the recording should.  
>> Anyone have any ideas why there would be this mismatch?
>
> See
> http://bugs.squeak.org/view.php?id=3272
>
>
> --
> ======================================================================
> =====
> John M. McIntosh <[hidden email]>
> Corporate Smalltalk Consulting Ltd.  http://
> www.smalltalkconsulting.com
> ======================================================================
> =====
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Sound stuff

johnmci
I noted in the mantis entry

"This fix impacts os-x, causes sound to play back at 2x speed because  
of interaction with the delay and putting sound bytes on the os-x  
sound channel. "

If you are using os-x or unix vm on os-x this patch WILL break things


On May 16, 2007, at 3:27 PM, Brian Brown wrote:

> Hey John, thanks for the reply!
>
> I had read those messages earlier but didn't think this patch  
> applied. I loaded that cs into my image, but it has made no  
> difference, so I'm still at a loss as to why this is happening.
>
> thanks!
>
> Brian
>
> On May 16, 2007, at 11:50 AM, John M McIntosh wrote:
>
>>
>> On May 16, 2007, at 9:59 AM, Brian Brown wrote:
>>
>>> Which also plays back much faster than the recording should.  
>>> Anyone have any ideas why there would be this mismatch?
>>
>> See
>> http://bugs.squeak.org/view.php?id=3272
>>
>>
>> --
>> =====================================================================
>> ======
>> John M. McIntosh <[hidden email]>
>> Corporate Smalltalk Consulting Ltd.  http://
>> www.smalltalkconsulting.com
>> =====================================================================
>> ======
>>
>>
>>
>

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



Reply | Threaded
Open this post in threaded view
|

Re: Sound stuff

Brian Brown-2

On May 16, 2007, at 4:48 PM, John M McIntosh wrote:

> I noted in the mantis entry
>
> "This fix impacts os-x, causes sound to play back at 2x speed  
> because of interaction with the delay and putting sound bytes on  
> the os-x sound channel. "
>
> If you are using os-x or unix vm on os-x this patch WILL break things

Yes, I understand that now. It didn't affect my image, because that  
patch is already in there. So I commented out that line in renderLoop  
and everything is working as I expect now.

thanks, John

Brian



>
>
> On May 16, 2007, at 3:27 PM, Brian Brown wrote:
>
>> Hey John, thanks for the reply!
>>
>> I had read those messages earlier but didn't think this patch  
>> applied. I loaded that cs into my image, but it has made no  
>> difference, so I'm still at a loss as to why this is happening.
>>
>> thanks!
>>
>> Brian
>>
>> On May 16, 2007, at 11:50 AM, John M McIntosh wrote:
>>
>>>
>>> On May 16, 2007, at 9:59 AM, Brian Brown wrote:
>>>
>>>> Which also plays back much faster than the recording should.  
>>>> Anyone have any ideas why there would be this mismatch?
>>>
>>> See
>>> http://bugs.squeak.org/view.php?id=3272
>>>
>>>
>>> --
>>> ====================================================================
>>> =======
>>> John M. McIntosh <[hidden email]>
>>> Corporate Smalltalk Consulting Ltd.  http://
>>> www.smalltalkconsulting.com
>>> ====================================================================
>>> =======
>>>
>>>
>>>
>>
>
> --
> ======================================================================
> =====
> John M. McIntosh <[hidden email]>
> Corporate Smalltalk Consulting Ltd.  http://
> www.smalltalkconsulting.com
> ======================================================================
> =====
>
>