Sound.Analysis.SHARC

Description

SHARC XML file IO.

Synopsis

# Documentation

data Instrument Source

A SHARC instrument.

Constructors

 Instrument Fieldsinstrument_id :: String notes :: [Note]

data Note Source

A SHARC note.

Constructors

 Note Fieldsfrequency :: Double partials :: [Partial]

data Partial Source

A SHARC partial.

Constructors

 Partial Fieldspartial :: Int amplitude :: Double phase :: Double

# Partial analysis

Calculate the frequency of a `Partial` given the fundamental frequency.

``` partial_frequency 440 (Partial 3 0.1 0) == 1320
```

Calculate the `(frequency,amplitude,phase)` triple of a `Partial` given the fundamental frequency.

``` partial_triple 440 (Partial 3 0.1 pi) == (1320,0.1,pi)
```

# Note analysis

note_spectra :: Note -> [(Double, Double, Double)]Source

Translate a `Note` into (frequency,amplitude,phase) triples.

``` note_spectra (Note 440 [Partial 3 0.1 pi]) == [(1320,0.1,pi)]
```

The number of partials at a `Note`.

# Amplitude transformations

Apply a linear scalar to the amplitude of a `Partial`.

Apply a linear scalar to the amplitudes of all `Partial`s at a `Note`.

Find the minimum and maximum amplitudes of all `Partial`s at a `Note`.

Normalise a `Note` so the maximum amplitude of any `Partial` is `1.0`.

Find the minimum and maximum amplitudes of all `Partial`s at all `Note`s of an `Instrument`.

Normalise an `Instrument` so the maximum amplitude of any `Partial` is `1.0`.

# XML parsers

The root `Element` of a SHARC xml graphs is a `tree`, which parses to a list of `Instrument`s.

Parse an `instrument` `Element`.

Parse a `note` `Element`.

Parse an `a` `Element`.