Skip to contents

Use this if you want to extract only the tonal qualities from pitch data, discarding octave and step information.

Usage

quality(
  x,
  ...,
  generic = FALSE,
  simple = FALSE,
  octave.relative = FALSE,
  Key = NULL,
  transposeArgs = list(),
  parseArgs = list(),
  gamutArgs = list(),
  inPlace = FALSE
)

Arguments

x

Input data to parse as pitch information.

The x argument can be any (atomic) vector, or a tonalInterval, or NULL.

...

Arguments passed to the pitch deparser.

There are also two hidden (advanced) arguments you can specify: memoize and deparse (see the details below).

generic

Should "specific" pitch information (accidentals and qualites) be discarded?

Defaults to FALSE.

Must be a singleton logical value: an on/off switch.

simple

Should "compound" pitch information (octave/contour) be discarded?

Defaults to FALSE.

Must be a singleton logical value: an on/off switch.

Key

The input Key used by the parser, deparser, and transposer.

Defaults to NULL.

Must be a diatonicSet or something coercable to diatonicSet; must be either length 1 or length(x)

transposeArgs

An optional list of arguments passed to a special transpose() call.

Defaults to an empty list().

Must be a list of named arguments to transpose().

parseArgs

An optional list of arguments passed to the pitch parser.

Defaults to an empty list().

Must be a list of named arguments to the pitch parser.

inPlace

Should non-pitch information be retained in the output string.

Defaults to FALSE.

Must be a singleton logical value: an on/off switch.

This argument only has an effect if the input (the x argument) is character strings, and there is extra, non-pitch information in the input strings "besides" the pitch information. If so, and inPlace = TRUE, the output will be placed into an output string beside the original non-pitch information. If inPlace = FALSE, only the pitch output information will be returned (details below).

See also

Examples


chorale <- readHumdrum(humdrumRroot, 'HumdrumData/BachChorales/chor001.krn')
#> Finding and reading files...
#> 	REpath-pattern '/home/nat/.tmp/RtmpBDgnJw/temp_libpath28db92437ebb13/humdrumR/HumdrumData/BachChorales/chor001.krn' matches 1 text files in 1 directory.
#> One file read from disk.
#> Validating one file...
#> all valid.
#> Parsing one file...
#> Assembling corpus...
#> Done!

within(chorale[[20:30,]], quality(Token))
#> ######################## vvv chor001.krn vvv #########################
#>     8:        **quality      **quality      **quality      **quality
#>    12:        *>[A,A,B]      *>[A,A,B]      *>[A,A,B]      *>[A,A,B]
#>    13:     *>norep[A,B]   *>norep[A,B]   *>norep[A,B]   *>norep[A,B]
#>    14:              *>A            *>A            *>A            *>A
#>    20:                P              M              P              P
#>    21:               =1             =1             =1             =1
#>    22:                P              M              P              P
#>    23:                M              P              M              .
#>    24:                .              M              .              .
#>    25:                M              M              P              P
#>    26:               =2             =2             =2             =2
#>    27:                P              P              P              M
#>    28:                P              M              .              .
#>    29:                .              .              .              M
#>    30:                M              P              M              P
#>    52:              *>B            *>B            *>B            *>B
#>   124:               *-             *-             *-             *-
#> ######################## ^^^ chor001.krn ^^^ #########################
#> 
#>    Data fields: 
#> 	         Token                     :: character
#> 	        *humdrumR:::quality(Token) :: character (**quality tokens)
#> 

# Harmonic interval qualities:

within(chorale[[20:30,]], hint(Token, deparser = quality))
#> ######################## vvv chor001.krn vvv #########################
#>     8:        **quality      **quality      **quality      **quality
#>    12:        *>[A,A,B]      *>[A,A,B]      *>[A,A,B]      *>[A,A,B]
#>    13:     *>norep[A,B]   *>norep[A,B]   *>norep[A,B]   *>norep[A,B]
#>    14:              *>A            *>A            *>A            *>A
#>    20:             [GG]              M              m              P
#>    21:               =1             =1             =1             =1
#>    22:              [G]              M              m              P
#>    23:              [E]              m              M              .
#>    24:                .            [B]              .              .
#>    25:             [F#]              m              P              P
#>    26:               =2             =2             =2             =2
#>    27:              [G]              P              P              M
#>    28:              [D]              M              .              .
#>    29:                .              .              .            [a]
#>    30:              [E]              m              M              m
#>    52:              *>B            *>B            *>B            *>B
#>   124:               *-             *-             *-             *-
#> ######################## ^^^ chor001.krn ^^^ #########################
#> 
#>    Data fields: 
#> 	         Token                                      :: character
#> 	        *humdrumR:::hint(Token, deparser = quality) :: character (**quality tokens)
#> 
with(chorale[[20:30,]], hint(Token, deparser = quality, incomplete = NA, bracket = FALSE)) |> table()
#> 
#> P A M m 
#> 6 0 6 6