Skip to content

Instantly share code, notes, and snippets.

@leonawicz
Last active December 14, 2019 01:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leonawicz/390caffe2356d72b9d273089eab1b385 to your computer and use it in GitHub Desktop.
Save leonawicz/390caffe2356d72b9d273089eab1b385 to your computer and use it in GitHub Desktop.
tabr example: Hard to Handle intro - open G tuning (requires tabr >= v0.4.1)
---
title: "Change tuning when rendering tabs"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Hard to handle - intro
This example transcribes the intro to The Black Crowes version of *Hard to handle*. This is a simple example demonstrating the ease of changing the tuning for rendered tablature without having to re-enter music information.
### Setup
First, some attributions. Steps like these are not required, but shown in the first example for more completeness.
```{r general}
library(tabr)
hdr <- list(
title = "Hard to Handle",
subtitle = "from The Black Crowes - Shake Your Money Maker",
composer = "Words and music by Allen Jones, Alvertis Bell and Otis Redding"
)
ppr <- list(linewidth = 220)
labs <- c("(Drums)", "Gtr. 1 (slight dist.)")
```
### Transcribe and plot
Next, the actual music snippet. Create a music object and pipe it to an applicable plot function. String numbers are not specified here so they default to the lowest frets.
```{r music, fig.width=10, fig.height=3.5}
x <- "b,16 b, d# e8 f#~16 f#~2 f#8 e16 d e8 d16"
x <- paste("r1 r2 r8", x, "b,~16 b,~2 b,8", x, "r8")
as_music(x, key = "b", tempo = "4 = 102", labels = labs) %>%
plot_music_guitar(header = hdr, paper = ppr)
```
## Change tuning
Changing the string tuning of the guitar affects the tablature staff, but the changes are handled for you. The change can be seen on string 5.
```{r openG, fig.width=10, fig.height=2.5}
as_music(x, key = "b", tempo = "4 = 102", labels = labs) %>%
plot_music_guitar("openG", paper = ppr)
```
This example only scratches the surface, but much can be done with minimal code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment