![]() |
|
MusicString - Tunes packed into a bunch of ASCII characters (WIP) - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Coding (https://sinister.ly/Forum-Coding--71) +--- Thread: MusicString - Tunes packed into a bunch of ASCII characters (WIP) (/Thread-MusicString-Tunes-packed-into-a-bunch-of-ASCII-characters-WIP) |
RE: MusicString - Tunes packed into a bunch of ASCII characters (WIP) - Jacob - 02-15-2012 EDIT: Nevermind, i figured out how to speed up and slow down notes ^_^ The higher the pre-interger the slower the tone
RE: MusicString - Tunes packed into a bunch of ASCII characters (WIP) - Frooxius - 02-15-2012 Updated to version 0.1.1a ! Download the compiler! -Fixed a timing issue ------------------------------------------------------------------------------------ Jacob: I'm gonna release documentation soon, for now, this short info has to do. You change the length of note using a digit, the moment you type the digit, all following notes will have the new length, unless you use another digit of course. Lengths are following: Code: 0 - 1/128 note
1 - 1/64 note
2 - 1/32 note
3 - 1/16 note
4 - 1/8 note
5 - 1/4 note (default)
6 - 1/2 note
7 - 1/1 note
8 - 2/1 note
9 - 4/1 noteRegarding the "variables" (they are called subroutines, they are defined only once, so they can't change during the execution, so they're not variables), you got it quite right though. {name; body} <--- This is subroutine definition {name:} <--- subroutine usage {name: argument0, argument1} <--- subroutine usage with two arguments passed to it %n This is not looping, this is changing the volume (same as with length) Looping is done like this: [body:loopcount] For example [abcd:4] is equivallent to abcdabcdabcdabcd Or [.D:10] is equivalent to .D.D.D.D.D.D.D.D.D.D For a quick reference, here are syntax constructs copied from my private MusicString analysis document, some don't work yet though: Code: 0 – 9 = duration of the note
a – Z = play tone of given frequency
. = pause
~ = set sine waveform
/ = set sawtooth waveform
| = set pluck waveform
- = set square waveform
^ = set triangle waveform
* = set noise waveform
( … ) = chord – group several statements that are played at once. It’s considered as one note, even if it contains several. Separate individual statements with comma
{name; sequence} = subroutine definition
{name: parameters} = subroutine call, parameters are optional
$n = argument usage in subroutine, n is number from 0 to 9
[name: sequence :n] = repeat sequence n times, 0 for infinity, name is optional
[name] = stop sequence with given name, if playing
&n = perform shift of pitch scale
&+n = perform shift of pitch scale plus 1 more step
&-n = perform shift of pitch scale minus 1 more step
@bpm; = set bpm
#soundfont; = specifies a file with alternate soundfont that will be used
> = set the tones to use fadeout
< = set the tones to use fadein
= = set the tones to use constant volume
%n = set the volume, n is an alphabet letter
?n = skip over following statement if argument n is zero
!n = skip over following statement if argument n is nonzero
?(n=x) = skip over following statement if argument n != x
!(n=x) = skip over following statement if argument n == x
?(n@y=x) = skip over following statement if argument n@y == x
!(n@y=x) = skip over following statement if argument n@y != x
@y = represents a simple integer operation with another number y
Operations can be following: +, -, *, /, %, <<, >>, &, |, ^Regarding chords, you write them like this ab(c,d) <--- Plays a, then b, and then c and d at once (ab,cd) <--- Playes a and c at once, then b and d at once RE: MusicString - Tunes packed into a bunch of ASCII characters (WIP) - Jacob - 02-15-2012 The possibilities are endless! DDD
RE: MusicString - Tunes packed into a bunch of ASCII characters (WIP) - Frooxius - 02-15-2012 Additionally, you can use chords to play several instruments at once, like this for example: (^abcdefgh, >^[.Z:5], ~6roTHl) RE: MusicString - Tunes packed into a bunch of ASCII characters (WIP) - Jacob - 02-15-2012 (02-15-2012, 02:12 PM)Frooxius Wrote: Additionally, you can use chords to play several instruments at once, like this for example: oh my gosh you're a genius! Dedit: is there a way to play back, in reverse, a sub routine? RE: MusicString - Tunes packed into a bunch of ASCII characters (WIP) - Frooxius - 02-15-2012 Genius? :oO: WHATDIDIDOOOoooooo? Oo I mean it's just simple thing really ^^' The chords work more like forks - they launch several threads at once, for every item between the parentheses. Items are separated by comma and they can be anything, any MusicString code, including subroutines (even definitions, though it's kinda pointless and messy to put them inside a a chord), loops, or even more chords, or just a single tone. Though there's no way to play subroutine in reverse, other than making a copy and reversing it manually. It might be possible to implement it, however question is, if it's really necessary and if it's going to be used often, otherwise it might be wasting time, resources and symbols that I haven't used for any constructs yet. RE: MusicString - Tunes packed into a bunch of ASCII characters (WIP) - Frooxius - 02-16-2012 UPDATE! Version 0.2a Please update to the new version, DOWNLOAD HERE [*] Rewrote the parsing thread scheduling code and (hopefully) resolved all timing issues that way, also made code more clean [+] New noise generation, so it now has much better, frequency based noise and plucks! [+] Now supports statement [loopname] to terminate any loop with that name (you can try it with tune.mstr) [+] New and updated examples RE: MusicString - Tunes packed into a bunch of ASCII characters (WIP) - Jacob - 02-16-2012 Woo! V0.2 ![]() RE: MusicString - Tunes packed into a bunch of ASCII characters (WIP) - Frooxius - 02-16-2012 Have you tried it yet? :3 What do you say about the new noise? ^^ It does funny things, depending on frequency. Try doing this for example: Code: *9&a abcdeRE: MusicString - Tunes packed into a bunch of ASCII characters (WIP) - Frooxius - 02-16-2012 Hi again, here's a small update, I designed a logo for this project. Official website and documentation are coming soon! >:3 Keep tuned!
|