Re: [livecode] audio source in linux

From: Charles Turner <vze26m98_at_optonline.net>
Date: Sat, 03 May 2008 08:27:58 -0400

On Sat, 03 May 2008 13:02:40 +0200, Kassen wrote:
>
>>
>> 3. Just introduce me to the sound card, and let us develop our own
>> rapport/language
>> in which we shall converse.
>
> Have a look at Forth. Forth (in some versions) can boot straight into
> Forth, skipping the OS altogether, at that point the *only* thing you
> can do is develop a language to converse in... with no middle man.
> I'd take a ancient computer for this, 8086 or so because there are
> good reasons for middle-men on modern ones.

Here's the audio section of a Chua oscillator simulation from Marcel
Hendrix's iForth:

-- Static preferences for the wav output file: 1 second, 44100 kHz,
stereo, 16bit
: AUDIOSCALE ( F: r max -- ) ( -- u )
        F/ 15e F2^x F* FROUND F>S ; PRIVATE

: WRITE-CHUA ( "name" -- )
        0 LOCAL ix
        0e 0e FLOCALS| vc1max vc2max |
        #1000 #44100 TRUE #16 WAV-INIT \ 1 second, 44100 kHz, stereo, 16bits
        0e 1e-9 0e 1e x{ #=>
        #100 TO steps
        dT 100e F* 1/F F>S TO cycles \ cycles = 1 second / (steps * dT)
        SIM-LOOP
        vC1{ MATRANGE FSWAP FABS FMAX TO vc1max
        vC2{ MATRANGE FSWAP FABS FMAX TO vc2max
        'wav /wav_at_ BOUNDS DO vC1{ ix } DF_at_ vc1max audioscale I B!
                                      vC2{ ix } DF_at_ vc2max audioscale I 2+ B!
                                1 +TO ix
                     4 +LOOP
        /PARSE WAV-FLUSH ;

The current release uses the ALSA OSS emulation as a sound interface.
There's a native ALSA interface that's almost finished, and Jack and OS
X sound support are in the works. You can, of course to the extent that
Linux, Windows or OS X will let you, program directly to the hardware.
iForth is a native compiler, arguably the fastest Intel Forth, arguably
as fast as gcc.

<http://home.iae.nl/users/mhx/>

Best, Charles
Received on Sat May 03 2008 - 12:30:44 BST

This archive was generated by hypermail 2.4.0 : Sun Aug 20 2023 - 16:02:23 BST