MPEG/MP3 and url

John M McIntosh johnmci at smalltalkconsulting.com
Sat Oct 21 19:41:01 UTC 2000


>I was trying to implement audio/mp3 as a mime type in Scamper but
>ran into trouble when the MPEGPlayer wanted aPath to the file to
>analyze if it has all the right properties etc. If anybody
>have a suggestion please let me now.
>
>I also note that the playback is very pleasing on mp3 :-)
>
>Due to the multitasking in mac os using squeak as a mp3
>player will give some dropout off the sound ( when squeak is
>a background app.) The droput is less than one second but happens
>on most events.
>Could this be overcome by some cashe/buffer loading of the
>stream or is it in the VM over all so it the whole
>squeak process that halts for a short time ?
>
>Karl


Karl you need to look at how the audio is being queued up and 
processed. Also how the SoundPlayer is initialized. John Maloney did 
explority work there for me, but his time constraints have prevented 
him from completing it.

See MPEGPlayer>>setupStream: for where the SoundPlayer gets inited
Also see
SoundPlayer(class)>>initialize but I think the buffer set by 
BufferMSecs gets altered by my request in MPEGPlayer>>setupStream:


see MPEGPlayer>>readSoundChannel:stream: for where we read some sound 
data, in chunks of an arbitrary length.

see MPEGPlayer>>privatePlayAudioStream:  for where we attempt to keep 
stuff in the queue in a small number of chunks.

One needs to play with the numbers in order to get pleasing sound in 
the background etc etc. If you've a few hours, then please do so. If 
you get a good set of number please post to the list, and I of course 
will alter the source.

Don't forget to try it at different Khz

Steams????
An exercise for reader?

One could explore writting to a file, and have the player read the 
file? I'm not sure if this allowed? Otherwise some C magic would be 
needed to fake file I/O from the stream.

Oh, if you've a few 100MB of free memory around you can suck in the 
whole mp3 file and build a sound buffer to play. This works very 
well. But expensive.
-- 
--
===========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================
Custom Macintosh programming & various Smalltalk dialects
PGP Key: DSS/Diff/46FC3BE6
Fingerprint=B22F 7D67 92B7 5D52 72D7  E94A EE69 2D21 46FC 3BE6
===========================================================================





More information about the Squeak-dev mailing list