[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Denemo-devel] The scheme problem: example
From: |
Richard Shann |
Subject: |
Re: [Denemo-devel] The scheme problem: example |
Date: |
Thu, 20 Nov 2008 16:52:42 +0000 |
I've got this sorted now. Contrary to the docs, some modules are not
loaded
(use-modules (srfi srfi-13))
is the magic needed.
(Thanks to Neil Jerram)
Richard
On Thu, 2008-11-20 at 07:47 +0000, Richard Shann wrote:
> In case you are wondering how I stumbled on the string-join problem,
> here is my filter for entering figured bass by playing the notes
> specified. It requires the latest git for the function d-BassFigure
> which returns the bass figure for a given interval in the current key
> signature (actually the initial keysig at the moment).
> The long series of (display xxx) lines are debugging the problem which
> is revealed as string-join being unbound.
> Richard
>
> ;;;;;;;;;;;;
> ;;; Figured Bass filter
>
> (d-PutMidi 0);;; Our own Reset, this makes the filter toggle off/on
> (define Figures "_")
>
> (define trans 0);;0 semi up
>
> (define AddFigure (lambda (note);;fixme pass both or neither...
> (begin
> (display "adding a figure")
> (display Figures)
> (set! Figures (cons (d-BassFigure bassnote note)
> Figures)))))
>
>
> (define GetFigures (lambda ()
> (begin
> (display Figures)
> (display list> Figures)
> (display "true?")
>
>
> (display (list? Figures))
> (display Figures)
> (display "true?")
>
> (display (list? (reverse Figures)))
> (display "going to try accessing string-join")
> (display string-join)
> (display "hooray")
> (display (string-join (reverse Figures)))
>
> (string-append "figures=" (string-join (reverse Figures))))))
>
>
> (define midi 0)
> (define velocity 0)
> (define command 0)
> (define bassnote 0)
> (define note 0)
>
> (define loop (lambda ()
> (begin
> (display "bassnote")
> (display bassnote)
> (set! midi (d-GetMidi))
> (set! velocity (bit-extract midi 16 24))
> (set! note (bit-extract midi 8 16))
> (set! command (bit-extract midi 0 8))
> (display "midi message ")
> (display `(,command ,note ,velocity))
> (if (= command #x90)
> (begin
> (if (and (> velocity 0)(= bassnote 0))
> (begin
> (display "bass note on")
> (display note)
> (set! bassnote note)
> (set! Figures '())
> (d-PutMidi midi)
> (display "inserted bass note"))
> ;;; not bass note on
> (if (and (= velocity 0)(= note bassnote))
> (begin
> (display "bass note off")
> (set! bassnote 0)
> (d-EditFiguredBass (GetFigures))
> (d-PutMidi midi))
> ;;; not bass note off
> (if (> velocity 0)
> (begin
> (AddFigure note)
> (display Figures)))))))
> (if (and (= command #xB0) (= note #x40) (= velocity #x7F))
>
> (begin
> (display "Pedal down")
> (set! Figures (cons Figures " | "))))
> (if (not (= command 0))
> (loop))
> )))
> (loop)
> (display "finished bass figure filter")
> ;;; to force it to finish run a script that does (d-PutMidi 0)
>
>
>
>
> _______________________________________________
> Denemo-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/denemo-devel