Skip to content

Commit

Permalink
Update CHANGELOG.md, VERSION, and camelot_wheel_xxx.js
Browse files Browse the repository at this point in the history
  • Loading branch information
regorxxx committed Jun 7, 2021
1 parent 7c4d6cd commit f97931c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 9 deletions.
22 changes: 16 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,40 @@

## [Table of Contents]
- [Unreleased](#unreleased)
- [1.1.1](#111---2021-06-07)
- [1.1.0](#110---2021-05-03)
- [1.0.0](#100---2021-05-02)

## [Unreleased][]
### Added
### Changed
### Removed
### Fixed

## [1.1.1] - 2021-06-07
### Added
### Changed
### Removed
### Fixed
- Pattern creation: not really random due to using sort + random method. Using an array shuffle now instead.

## [1.1.0] - 2021-05-03
### Added
- Method for pattern creation from harmonic mixing.
- Method for pattern application to keys.

### Changed
- Bugfix at keyNotation for self mapped keys.

### Removed
### Fixed
- keyNotation for self mapped keys was wrong.

## [1.0.0] - 2021-05-02
### Added
- First release.

### Changed

### Removed
### Fixed

[Unreleased]: https://github.com/regorxxx/Camelot-Wheel-Notation/compare/v1.1.0...HEAD
[Unreleased]: https://github.com/regorxxx/Camelot-Wheel-Notation/compare/v1.1.1...HEAD
[1.1.1]: https://github.com/regorxxx/Camelot-Wheel-Notation/compare/v1.1.0...v1.1.1
[1.1.0]: https://github.com/regorxxx/Camelot-Wheel-Notation/compare/v1.0.0...v1.1.0
[1.0.0]: https://github.com/regorxxx/Camelot-Wheel-Notation/compare/16b9932...v1.0.0
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.1.0
v1.1.1
20 changes: 18 additions & 2 deletions camelot_wheel_xxx.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,24 @@ function createHarmonicMixingPattern(playlistLength) {
Object.keys(movements).forEach((key) => {
pattern = pattern.concat(Array(Math.ceil(playlistLength * movements[key] / 100)).fill(key));
});
pattern.sort(() => Math.random() - 0.5);
if (pattern.length > playlistLength) {pattern.length = playlistLength;} // finalPlaylistLength is always <= PlaylistLength
// Sort randomly
const result = [];
const len = pattern.length;
for (let i = len - 1; i >= 0; i--) {
const r = Math.floor(Math.random() * (i + 1));
for (let j = 0, k = 0; j <= len - 1; j++) {
if (typeof result[j] === 'undefined') {
if (k === r) {
result[j] = pattern[i];
break;
}
k++;
}
}
}
pattern = result;
// Cut to desired length and output
if (len > playlistLength) {pattern.length = playlistLength;} // finalPlaylistLength is always <= PlaylistLength
return pattern;
}

Expand Down

0 comments on commit f97931c

Please sign in to comment.