pivot_long_notes: Write 'note_on' and 'note_off' events in two lines (wide to...

View source: R/pivot_note_on_off.R

pivot_long_notesR Documentation

Write note_on and note_off events in two lines (wide to long)

Description

Write note_on and note_off events in two lines (wide to long)

Usage

pivot_long_notes(df_notes_wide)

Arguments

df_notes_wide

notes dataframe in wide format

Value

Transforms notes in wide dataframe format to long format.

See Also

Other Pivot midi frame functions: pivot_wide_notes()

Examples

## Not run: 
mid_file_str <- system.file("extdata", "test_midi_file.mid", package = "pyramidi")
mido_mid_file <- mido$MidiFile(mid_file_str)
dfc <- miditapyr$frame_midi(mido_mid_file)
ticks_per_beat = mido_mid_file$ticks_per_beat
df <- dfc %>%
  miditapyr$unnest_midi()

## End(Not run)
## Not run: 
dfm <- tab_measures(df, ticks_per_beat)
library(zeallot)
c(df_meta, df_notes) %<-% miditapyr$split_df(dfm)
dfw <- df_notes %>% pivot_wide_notes()
dfw %>% pivot_long_notes()

## End(Not run)

urswilke/pyramidi documentation built on March 7, 2024, 3:48 p.m.