Category Archives: IO

File and console I/O

Digital Signal Processing #1

The following example uses sequence and array operators to implement a simple digital filter. The example builds on the previous WAV I/O example. A digital filter frequently needs multiply-add operators, these may be implemented using Array.map2 > let fx = … Continue reading

Posted in Algorithms, IO | Leave a comment

Reading and writing WAV audio files

The following example shows simple reading and writing (and later processing) of WAV audio files using File.ReadAllBytes, File.WriteAllBytes and BitConverter. > open System.IO;; > File.ReadAllBytes;; val it : string -> byte [] = <fun:clo@4> > File.WriteAllBytes;; val it : string … Continue reading

Posted in Getting Started, IO | 1 Comment

Interactive Session #9: Processing XML

Reading and interpreting XML data is performed through the System.Xml package. You need to create a new XmlDocument value and load the XML text into the XmlDocument. > open System.Xml;; > let txt = “<drawing><line><x>10.0</x><y>20.0</y><dx>50.0</dx> <dy>50.0</dy></line><circle><x>50.0</x><y>50.0</y><r>20.0</r> </circle></drawing>”;; val txt : … Continue reading

Posted in Getting Started, GUI, IO, Text | 1 Comment

Interactive Session #7: Text file I/O

Binary and text file access is provided through the module System.IO. The type File provides static methods to create, open, read and write files. File.CreateText creates a new file (if it exists already content is overwritten) in text mode. > … Continue reading

Posted in Getting Started, IO, Text | Leave a comment

Interactive Session #5: Creating and editing image files

Image manipulation is provided through the System.Drawing package. To create drawings you need to create a bitmap first. > open System.Drawing;; > let bitmap = new Bitmap(10, 10);; val bitmap : Bitmap You may edit the bitmap directly by setting … Continue reading

Posted in GUI, IO | Leave a comment