Skip to content

Commit

Permalink
documentation and small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernd committed Jan 18, 2024
1 parent 9a25413 commit 82fc06b
Show file tree
Hide file tree
Showing 39 changed files with 355 additions and 140 deletions.
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

# TODO: move to site -> part of mkdoc
examples_generated := examples
img_doc := docs/img


default: test clean prepare examples doc
default: test clean prepare examples

prepare:
#pass
Expand All @@ -24,8 +24,11 @@ examples: clean prepare
doc: clean prepare
## todo: not working yet
## python3 -m docgen.guitar_6string_e-standard_all_scales_all_roots $(doc_generated)
mkdocs build
python3 -m examples.guitar_fretboard_chord_Cmaj_pitchclasses $(img_doc)
python3 -m examples.guitar_fretboard_scale_major_pentatonic_c $(img_doc)
mkdocs serve

clean:
-rm $(img_doc)/*.svg
-rm $(examples_generated)/*.svg
-rm $(examples_generated)/*.txt
3 changes: 3 additions & 0 deletions docs/chord.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# trallala.core.chords.Chord

::: trallala.core.chords.Chord
3 changes: 3 additions & 0 deletions docs/chromaticscale.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# trallala.core.scales.ChromaticScale

::: trallala.core.scales.ChromaticScale
30 changes: 30 additions & 0 deletions docs/definitions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Supported musical definitions

The musical definitions are done specificaly for a defined chromatic scale.
By default (and this is currently the only supported chromatic scale),
`12 equal temperament` is used.

Additional chromaticscales can be supported by

1. adding the required definitions to the config files below
2. defining a compatible temperament class for the usage in an
chromatic scale object

## Intervals
Defined in `trallala/config_intervals.py`
```python
--8<-- "trallala/config_intervals.py"
```

## Scales
Defined in `trallala/config_scales.py`
```python
--8<-- "trallala/config_scales.py"
```

## Chords
Defined in `trallala/config_chords.py`
```python
--8<-- "trallala/config_chords.py"
```

17 changes: 0 additions & 17 deletions docs/examples.md

This file was deleted.

15 changes: 15 additions & 0 deletions docs/explanation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
This part of the project documentation focuses on an
**understanding-oriented** approach. You'll get a
chance to read about the background of the project,
as well as reasoning about how it was implemented.

> **Note:** Expand this section by considering the
> following points:
- Give context and background on your library
- Explain why you created it
- Provide multiple examples and approaches of how
to work with it
- Help the reader make connections
- Avoid writing instructions or technical descriptions
here
3 changes: 3 additions & 0 deletions docs/fretboard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# trallala.instruments.guitar.FretBoard

::: trallala.instruments.guitar.FretBoard
3 changes: 3 additions & 0 deletions docs/guitar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# trallala.instruments.guitar.Guitar

::: trallala.instruments.guitar.Guitar
4 changes: 4 additions & 0 deletions docs/howto.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This part of the project documentation focuses on a
**problem-oriented** approach. You'll tackle common
tasks that you might have, with the help of the code
provided in this project.
13 changes: 13 additions & 0 deletions docs/howto_chord_diagram.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Create a chord diagram

Create a chord diagram with all possible voicings.

## Code

``` python
--8<-- "examples/guitar_fretboard_chord_Cmaj_pitchclasses.py"

```

## Result
![Cmaj](img/guitar_fretboard_chord_Cmaj_pitchclasses.svg)
13 changes: 13 additions & 0 deletions docs/howto_scale_diagram.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Create a scale diagram

Create a scale diagram with all possible positions.

## Code

``` python
--8<-- "examples/guitar_fretboard_scale_major_pentatonic_c.py"

```

## Result
![Cmaj](img/guitar_fretboard_scale_major_pentatonic_c.svg)
29 changes: 17 additions & 12 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
# Welcome to MkDocs
# Introduction

For full documentation visit [mkdocs.org](https://www.mkdocs.org).
This site contains the documentation for the `trallala` project.
`trallala` is a library aiming to provide a more
computer science oriented view on music theory. e.g., everything in
`trallala` can work with semitone steps to archieve an array-like access to
and definition of music objects. The usage of intervals is possible but optional.

## Commands
## Table of Contents

* `mkdocs new [dir-name]` - Create a new project.
* `mkdocs serve` - Start the live-reloading docs server.
* `mkdocs build` - Build the documentation site.
* `mkdocs -h` - Print help message and exit.
1. [Tutorials](tutorials.md)
2. [Howto Guides](howto.md)
3. [Reference](reference.md)
4. [Explanation](explanation.md)

## Project layout
## Content

mkdocs.yml # The configuration file.
docs/
index.md # The documentation homepage.
examples.md # Other markdown pages, images and other files.
::: trallala

## Links
1. [Git](https://github.com/bw0x00/music_theory/)
2. [Issues](https://github.com/bw0x00/music_theory/issues)
3 changes: 3 additions & 0 deletions docs/interval.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# trallala.core.intervals.Interval

::: trallala.core.intervals.Interval
4 changes: 4 additions & 0 deletions docs/note.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# trallala.core.notes.Note

::: trallala.core.notes.Note

4 changes: 4 additions & 0 deletions docs/pitchclass.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# trallala.core.notes.PitchClass

::: trallala.core.notes.PitchClass

4 changes: 4 additions & 0 deletions docs/reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This part of the project documentation focuses on
an **information-oriented** approach. Use it as a
reference for the technical implementation of the
`calculator` project code.
5 changes: 5 additions & 0 deletions docs/scale.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# trallala.core.scales.Scale

::: trallala.core.scales.Scale


16 changes: 16 additions & 0 deletions docs/tutorials.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
This part of the project documentation focuses on a
**learning-oriented** approach. You'll learn how to
get started with the code in this project.

> **Note:** Expand this section by considering the
> following points:
- Help newcomers with getting started
- Teach readers about your library by making them
write code
- Inspire confidence through examples that work for
everyone, repeatably
- Give readers an immediate sense of achievement
- Show concrete examples, no abstractions
- Provide the minimum necessary explanation
- Avoid any distractions
8 changes: 0 additions & 8 deletions examples/guitar_fretboard_all_notes_e-standard.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ def main():
root_color="red", notes_color='green')
print(svg,file=f)

x = "_chord_Cmaj_pitchclasses"
print("".join((dirname,"/", filename, x, ".svg> Fretbaord Chord->PitchClasses SVG'" )) )
with open("/".join((dirname, "".join( (filename, x,".svg") )))
,'w') as f:
svg = g.fretboard.svg(chords.Chord(chord='major',root='c'),
root_color="red", notes_color='green')
print(svg,file=f)

x = "_scale_c_major_pentatonic"
print("".join((dirname,"/", filename, x, ".svg> Fretbaord C major Pentatonic SVG'" )) )
with open("/".join((dirname, "".join( (filename, x,".svg") )))
Expand Down
6 changes: 0 additions & 6 deletions examples/guitar_fretboard_all_notes_e-standard.txt

This file was deleted.

5 changes: 0 additions & 5 deletions examples/guitar_fretboard_all_notes_e-standard_chord_Cmaj.svg

This file was deleted.

This file was deleted.

Loading

0 comments on commit 82fc06b

Please sign in to comment.