[Etoys] [Fwd: Squeak MIDI output with Linux / ALSA]

Bert Freudenberg bert at freudenbergs.de
Mon Mar 12 06:50:06 EDT 2007

That would be great I think. Did you look at it more closely? What  
synthesizer will it use on the XO - AFAIK there is no HW synth? Can  
it be made to use the CSound synthesizer?

- Bert -

On Mar 12, 2007, at 10:02 , Diego Gomez Deck wrote:

> Folks,
> May be we can include this at OLPC.
> Cheers,
> -- Diego
> --------- Mensaje reenviado --------
>> De: Florian Hars <florian at hars.de>
>> Responder a: The general-purpose Squeak developers list
>> <squeak-dev at lists.squeakfoundation.org>
>> Para: squeak-dev at lists.squeakfoundation.org
>> Asunto: Squeak MIDI output with Linux / ALSA
>> Fecha: Sun, 11 Mar 2007 20:33:34 +0100
>> I spent the sunday reading some ALSA documentation and produced a  
>> replacement
>> for sqUnixMIDI.c (which I compiled into Squeak by hacking the  
>> generated
>> Makefiles, yuck), which compiles, and the three or so functions  
>> Scratch uses
>> actually do something useful (I ignored MIDI input, the drumkit  
>> and other
>> things). Maybe somebody with a better (read: any) understanding of  
>> the  squeak
>> internals can use this as a basis to create something that  
>> actually works and
>> is integrated into the build environment.
>> Some observations that should be adressed in a final version:
>> midiInit is only ever called when a note is played. So the MIDI  
>> output port
>> will only come into existence when the first note has been sent,  
>> and only then
>> can you connect the port to the input port of a sythesizer. This  
>> connection
>> will be destroyed if you stop the script in Scratch (in  
>> sqMIDIClosePort), so
>> you have to reconnect before starting the next script. There  
>> *must* be
>> something better than that.
>> There is a slight mismatch between Squeaks sqMIDIGetPortCount and  
>> the ability
>> to create as many ports as you want in ALSA.
>> The ALSA sequencer can schedule events, but the return type of
>> snd_seq_queue_status_get_tick_time is (typedefed to) unsigned int,  
>> so I do not
>> know if the assumption "The MIDI clock is assumed to wrap at or  
>> before half the
>> maximum positive SmallInteger value. This allows events to be  
>> scheduled
>> into the future without overflowing into LargePositiveIntegers."  
>> holds. As far
>> as I understand the ALSA documentation, the client shouldn't make  
>> these
>> assumtion at all and refrain from guessing at future clock values:  
>> "As each
>> sequencer queue has it's own clock the only way to deliver events  
>> at the right
>> time is by using the relative timestamp format. When the event  
>> arrives at the
>> queue it is normalised to absolute format."
>> (http://www.alsa-project.org/alsa-doc/alsa-lib/seq.html)
>> My code is probably broken in this regard (Scratch produces only  
>> immediate events).
>> If you route the Squeak MIDI output to a sequencer that outputs to  
>> jack, Squeak
>> may no longer be able to open the normal ALSA audio device, so you  
>> should
>> either use a synth that does not require jack like timidity -iA - 
>> oS, or
>> implement jack output for Squeak. The latter could be difficult,  
>> the former has
>> the disadvantage of high latency (at least on my machine I have a  
>> noticable
>> delay if I send events from an external keyboard to timidity).
>> Yours, Florian Hars.
>> PS: http://www.squeakvm.org/unix/ mentions something like "svn export
>> http://squeakvm.org/svn/squeak/tags/unix-3.9-8", but that doesn't  
>> exist, there
>> is no tag past unix-3.9-4 there.

More information about the Etoys mailing list