Hi Dan,
> However, now I need to do some bit fiddling and I would like to add
> them to the buffer.
>
> What methods should I look at? Any example code would be helpful.
'wr' should be useful here. For example, here I found a function
that assembles an audio format:
# Header for audio data 8-bit, mu-law, mono, 8000 Hz
(de head.au (Cnt)
(prin ".snd") # Tag
(wr 0 0 0 28) # Header size
(wr # Data size
(>> 24 Cnt)
(>> 16 Cnt)
(>> 8 Cnt)
Cnt )
(wr 0 0 0 1) # Data format
(wr 0 0 31 64) # Sampling frequency (8000 Hz)
(wr 0 0 0 1) # Channel (1)
(wr 0 0 0 0) ) # Information (0)
(de rect.au (F A)
(head.au 8000) # 1 sec
(let (S 0 Lo (ext:Ulaw (- A)) Hi (ext:Ulaw A))
(for (I 1 (<= I (* 2 F)) (+ 2 I))
(let N (- (*/ I 4000 F) S)
(inc 'S N)
(do N (wr Lo))
(setq N (- (*/ (inc I) 4000 F) S))
(inc 'S N)
(do N (wr Hi)) ) ) ) )
(de tst.au (F)
(make
(let S 0
(for (I 1 (<= I (* 2 F)) (+ 2 I))
(let N (- (*/ I 4000 F) S)
(inc 'S (link N))
(setq N (- (*/ (inc I) 4000 F) S))
(inc 'S (link N)) ) ) ) ) )
Other examples you can find on
http://rosettacode.org/wiki/Category:PicoLisp
in e.g. the tasks
Binary strings
Bitmap/Write a PPM file
Bitwise IO
Grayscale image
Mandelbrot set
Hope this helps.
Cheers,
- Alex
--
UNSUBSCRIBE: mailto:[email protected]?subject=unsubscribe