Skip to content

Commit

Permalink
Merge pull request #6 from UtaUtaUtau/dev
Browse files Browse the repository at this point in the history
Fix pitchbend interpreter off-by-one error with RLE packets
  • Loading branch information
UtaUtaUtau authored Jul 23, 2024
2 parents 3d898f7 + b5122ce commit 7d7d9ea
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 17 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ jobs:
tag_name: '${{ steps.getversion.outputs.releaseVersion }}'
body: |
A stable build of straycat-rs.
### Changes
##[${{ steps.getversion.outputs.version }}] - xxxx-xx-xx
### Added
### Changed
### Fixed
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
# Changelog

## [1.0.9] - 2024-07-23

### Fixed
- Fixed error with interpreting pitchbends that causes pitch errors around overlap areas.

## [1.0.8] - 2024-07-23

### Changed
- Add checksum hashes for each release by @layetri in https://github.com/UtaUtaUtau/straycat-rs/pull/4 (thank you again!)

## [1.0.6] - 2024-07-23

### Changed
- Add GitHub Actions for CI by @layetri in https://github.com/UtaUtaUtau/straycat-rs/pull/1 (thank you!)

## [1.0.1] - 2024-07-23

### Fixed
Expand All @@ -18,6 +34,9 @@

- Initial release 🎉

[1.0.9]: https://github.com/UtaUtaUtau/straycat-rs/compare/v1.0.8...v1.0.9
[1.0.8]: https://github.com/UtaUtaUtau/straycat-rs/compare/v1.0.6...v1.0.8
[1.0.6]: https://github.com/UtaUtaUtau/straycat-rs/compare/v1.0.1...v1.0.6
[1.0.1]: https://github.com/UtaUtaUtau/straycat-rs/compare/v1.0.0...v1.0.1
[1.0.0]: https://github.com/UtaUtaUtau/straycat-rs/compare/v1.0.0-alpha...v1.0.0
[1.0.0-alpha]: https://github.com/UtaUtaUtau/straycat-rs/releases/tag/v1.0.0-alpha
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "straycat-rs"
version = "1.0.8"
version = "1.0.9"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# straycat-rs
# straycat-rs ![build](https://github.com/UtaUtaUtau/straycat-rs/actions/workflows/build.yml/badge.svg)
A Rust port of straycat, a WORLD-based UTAU resampler

# How to use
Expand Down
28 changes: 15 additions & 13 deletions src/pitchbend/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,24 @@ pub fn pitch_string_to_midi<S: AsRef<str>>(pitch_string: S) -> Result<Vec<f64>>
let mut pitchbend: Vec<i16> = Vec::new();

let pitch_rle: Vec<&str> = pitch_string.split("#").collect();
for i in 0..pitch_rle.len() / 2 {
let pair = &pitch_rle[i * 2..i * 2 + 2];
let mut stream = to_int12_stream(pair[0])?;
let last_point = stream[stream.len() - 1];
let rle: usize = pair[1].parse()?;
pitchbend.append(&mut stream);
for _ in 1..rle {
pitchbend.push(last_point);
for chunk in pitch_rle.chunks(2) {
println!("{:?}", chunk);
let mut stream = to_int12_stream(chunk[0])?;
let last_point = if stream.len() > 0 {
let temp = stream[stream.len() - 1];
pitchbend.append(&mut stream);
Some(temp)
} else {
None
};
if chunk.len() == 2 {
let rle: usize = chunk[1].parse()?;
for _ in 0..rle {
pitchbend.push(last_point.unwrap_or(0))
}
}
}

if pitch_rle.len() % 2 == 1 {
let mut stream = to_int12_stream(pitch_rle[pitch_rle.len() - 1])?;
pitchbend.append(&mut stream);
}

let ref_pitch = pitchbend[0];
let flat_pitch = pitchbend.iter().all(|x| *x == ref_pitch);

Expand Down

0 comments on commit 7d7d9ea

Please sign in to comment.