# Music submission #1

Open
wants to merge 4 commits into
from

## Conversation

Projects
None yet
2 participants
Owner

### Jingxiang6 commented Dec 30, 2018

 No description provided.
``` Music submission ```
``` 5c83634 ```

### thejohnfreeman requested changes Dec 30, 2018

music/helpers.c Outdated
 { semitones = 0 + 12 * (note[2] - '0' - 4) - 1; } else if (note[1] != '#' && note[1] != 'b')

#### thejohnfreeman Dec 30, 2018

Collaborator

There is a way to make these if-statements simpler. See if you can find it.

 { semitones = -2 + 12 * (note[1] - '0' - 4); } }

#### thejohnfreeman Dec 30, 2018

Collaborator

The branches on each note repeat a bunch of common subexpressions. See if you can factor them out into variables.

 else { return false; }

#### thejohnfreeman Dec 30, 2018

Collaborator

You can make this if-statement much simpler.

### Jingxiang6 added some commits Jan 4, 2019

``` Update helpers.c ```
``` 77691ac ```
``` Update helpers.c ```
``` d5a3b6e ```

### thejohnfreeman requested changes Jan 4, 2019

 @@ -27,7 +27,7 @@ int frequency(string note) { semitones = 0 + 12 * (note[2] - '0' - 4) - 1; } else if (note[1] != '#' && note[1] != 'b') else { semitones = 0 + 12 * (note[1] - '0' - 4);

#### thejohnfreeman Jan 4, 2019

Collaborator

The indentation on this line and some other lines is off.

 @@ -27,7 +27,7 @@ int frequency(string note) { semitones = 0 + 12 * (note[2] - '0' - 4) - 1; } else if (note[1] != '#' && note[1] != 'b') else

#### thejohnfreeman Jan 4, 2019

Collaborator

What happens if `note[1] == '#'`?

``` Update helpers.c ```
``` 375e50d ```