Music.Theory.Braille

Contents

Synopsis

# Documentation

type BRAILLE = (Int, Char, [Int], Char, String) Source #

Braille coding data. Elements are: (ASCII HEX,ASCII CHAR,DOT LIST,UNICODE CHAR,MEANING). The dot numbers are in column order.

ASCII Char of BRAILLE.

Unicode Char of BRAILLE.

Dot list of BRAILLE.

ASCII Braille table.

all id (map (\(x,c,_,_,_) -> x == fromEnum c) braille_table) == True

Lookup BRAILLE value for unicode character.

braille_lookup_unicode '⠝' == Just (0x4E,'N',[1,3,4,5],'⠝',"n")

Lookup BRAILLE value for ascii character (case invariant).

braille_lookup_ascii 'N' == Just (0x4E,'N',[1,3,4,5],'⠝',"n")

braille_64 :: [(String, String, String)] Source #

The arrangement of the 6-dot patterns into decades, sequences of (1,10,3) cells. The cell to the left of the decade is the empty cell, the two cells to the right are the first two cells of the decade shifted right.

For each decade there are two extra cells that shift the first two cells of the decade right one place. Subsequent decades are derived by simple transformation of the first. The second is the first with the addition of dot 3, the third adds dots 3 and 6, the fourth adds dot 6 and the fifth shifts the first down one row.

The first decade has the 13 of the 16 4-dot patterns, the remaining 3 are in the fifth decade, that is they are the three 4-dot patterns that are down shifts of a 4-dot pattern.

let trimap f (p,q,r) = (f p,f q,f r)
let f = map (fromJust . decode) in map (trimap f) braille_64

Transcribe ASCII to unicode braille.

transcribe_unicode "BRAILLE ASCII CHAR GRID" == "⠃⠗⠁⠊⠇⠇⠑⠀⠁⠎⠉⠊⠊⠀⠉⠓⠁⠗⠀⠛⠗⠊⠙"
transcribe_unicode "BRAILLE HTML TABLE GRID" == "⠃⠗⠁⠊⠇⠇⠑⠀⠓⠞⠍⠇⠀⠞⠁⠃⠇⠑⠀⠛⠗⠊⠙"

Generate a character grid using inidicated values for filled and empty cells.

let ch = (' ','.')
putStrLn$transcribe_char_grid ch "BRAILLE ASCII CHAR GRID" let ch = (white_circle,black_circle) putStrLn$ string_html_table $transcribe_char_grid ch "BRAILLE HTML TABLE GRID" dots_grid :: (c, c) -> [Int] -> [[c]] Source # Generate 6-dot grid given (white,black) values. dots_grid (0,1) [1,2,3,5] == [[1,0],[1,1],[1,0]] Decoding. let t0 = ["⠠⠁⠇⠇⠀⠓⠥⠍⠁⠝⠀⠆⠬⠎⠀⠜⠑⠀⠃⠕⠗⠝⠀⠋⠗⠑⠑⠀⠯⠀⠑⠟⠥⠁⠇⠀⠔⠀⠙⠊⠛⠝⠰⠽⠀⠯⠀⠐⠗⠎⠲" ,"⠠⠮⠽⠀⠜⠑⠀⠢⠙⠪⠫⠀⠾⠀⠗⠂⠎⠕⠝⠀⠯⠀⠒⠎⠉⠊⠰⠑⠀⠯⠀⠩⠙⠀⠁⠉⠞⠀⠞⠪⠜⠙⠎⠀⠐⠕⠀⠁⠝⠕⠤" ,"⠮⠗⠀⠔⠀⠁⠀⠸⠎⠀⠷⠀⠃⠗⠕⠮⠗⠓⠕⠕⠙⠲"] concatMap (fromMaybe "#" . decode) (concat t0) braille_rng :: Integral i => (i, i) Source # Start and end unicode indices. All characters, in sequence. length braille_seq == 256 putStrLn braille_seq The nth character, zero indexed. braille_ix :: Int -> (Char, Char) Source # Two element index, 255 * 255 = 65025 places. map braille_ix [100,300] HTML character encoding (as hex integer). unwords$ map unicode_html braille_seq

# Unicode

White (empty) circle.

Black (filled) circle.