Key:
Save
Speagram Home
|
tutorial
|
use me
|
live interface
|
documentation
|
developer's corner
|
links
|
contact
MUSIC
Done
Hide
Edit
Run
This part
New
Up
Down
Delete
Help
…
TEMPLAT_TEXT
Done
Hide
Edit
Run
This part
New
Up
Down
Delete
Help
…
In this file we put basic definitions necessary to create music with Speagram. This possibility is in a very early stage and many things do not work well, so beware. Let's start in the usual way: %$Load state library:/basic.$%
Done
Hide
Edit
Run
This part
New
Up
Down
Delete
Help
…
Now we define the basic type for notes. To be compatible with music XML we say that a note consists of four parts: step, octave, type and duration. Normally duration and type are in correspondence, we will add shorthands for it later. %$ New class ''note step''. New element ''C'' as note step. New element ''D'' as note step. New element ''E'' as note step. New element ''F'' as note step. New element ''G'' as note step. New element ''A'' as note step. New element ''B'' as note step. New class ''note duration''. New element ''whole'' as note duration. New element ''half'' as note duration. New element ''quarter'' as note duration. New element ''eighth'' as note duration. New element ''16th'' as note duration. New class ''note''. New element note step natural number note duration natural number as note. $%
Done
Hide
Edit
Run
This part
New
Up
Down
Delete
Help
…
Additionally we define a shorthand so we do not have to write the notation when it is standard. %$ New function note step natural number note duration as note. New variable n as natural number. New variable s as note step. Let s n whole be s n whole 16. Let s n half be s n half 8. Let s n quarter be s n quarter 4. Let s n eighth be s n eighth 2. Let s n 16th be s n 16th 1. $%
Done
Hide
Edit
Run
This part
New
Up
Down
Delete
Help
…
We have to tell Speagram how to transform notes to music XML to be able to play them. %$ New variable m as natural number. New variable d as note duration. Add xslt for (s n d m) template "
1
". Close context. $%
Done
Hide
Edit
Run
This part
New
Up
Down
Delete
Help
…
Now let us define a very basic type of music parts. Such parts consist of a name, tempo and list of notes. Obviously these things need to be extended for more complex use. %$ New class ''music part''. New element ''music'' string ''tempo'' natural number ''on'' natural number ''notes'' note list as music part. $%
Done
Hide
Edit
Run
This part
New
Up
Down
Delete
Help
…
Again, we need to convert music parts to music XML to play them. %$ New variable m as natural number. New variable n as natural number. New variable s as string. New variable nl as note list. Add xslt for (music s tempo n on m notes nl) template "
- Part 1
4
0
G
2
". Close context. $%
Saved XSLT Stylesheet
Saved SRGS Grammar