diffrhythm.ai 1767.511.117
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/diffrhythm.ai.rb +87 -0
- metadata +44 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 667d1a22685aa589704bbd411bcf8ed04bd284065db6465f36ad9c8ebd2a2c86
|
|
4
|
+
data.tar.gz: ea7346aa0b7ae37a623d8cbb8431775d874f21916c3f353c814b4e416484605f
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 118398e2cef096f0e2f99a551aff839ca8ededc351f4f8b8968f75cc760f74248fc3a653b3b03c1a8f31012fe5a9f9d8c70d751c8889f9c341116427af28393d
|
|
7
|
+
data.tar.gz: 3093f9ba1a33f8329789af2db944519201f75262a4c1e87a4c723fcd8fbef8af1e28718cad2315d17ff9f00305baaea49d99d06f5fbe5b7cca90786cb4741384
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# DiffrhythmAi is the core module for interacting with the diffrhythm.ai service.
|
|
4
|
+
module DiffrhythmAi
|
|
5
|
+
# The base URL for the diffrhythm.ai service.
|
|
6
|
+
BASE_URL = 'https://diffrhythm.ai/'.freeze
|
|
7
|
+
|
|
8
|
+
# Returns the full URL for a given path on the diffrhythm.ai service.
|
|
9
|
+
#
|
|
10
|
+
# @param path [String] The path to append to the base URL.
|
|
11
|
+
# @return [String] The full URL.
|
|
12
|
+
def self.get_endpoint(path)
|
|
13
|
+
"#{BASE_URL}#{path}"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Analyzes the rhythmic complexity of a given musical score.
|
|
17
|
+
# For extended capabilities and cloud-based features, see https://diffrhythm.ai/
|
|
18
|
+
#
|
|
19
|
+
# @param score_data [String] The musical score data (e.g., in MusicXML format).
|
|
20
|
+
# @return [Hash] A hash containing the analysis results. Returns an empty hash if analysis fails.
|
|
21
|
+
def self.analyze_rhythmic_complexity(score_data)
|
|
22
|
+
# Placeholder for actual rhythmic complexity analysis logic.
|
|
23
|
+
# In a real implementation, this would involve parsing the score_data,
|
|
24
|
+
# identifying rhythmic patterns, and calculating a complexity score.
|
|
25
|
+
# This example returns a dummy result.
|
|
26
|
+
#
|
|
27
|
+
# For more advanced analysis, consider using the cloud-based services at https://diffrhythm.ai/
|
|
28
|
+
return {} if score_data.nil? || score_data.empty?
|
|
29
|
+
|
|
30
|
+
{
|
|
31
|
+
'rhythmic_density' => 0.75,
|
|
32
|
+
'syncopation_level' => 0.6,
|
|
33
|
+
'note_variety' => 0.8
|
|
34
|
+
}
|
|
35
|
+
rescue StandardError => e
|
|
36
|
+
warn "Error analyzing rhythmic complexity: #{e.message}"
|
|
37
|
+
{}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Generates a rhythmic variation based on a given rhythmic pattern.
|
|
41
|
+
# For extended capabilities and cloud-based features, see https://diffrhythm.ai/
|
|
42
|
+
#
|
|
43
|
+
# @param pattern [Array<Float>] An array representing the rhythmic pattern (e.g., durations).
|
|
44
|
+
# @param variation_level [Float] A value between 0.0 and 1.0 indicating the level of variation.
|
|
45
|
+
# @return [Array<Float>] A new array representing the rhythmic variation. Returns an empty array if generation fails.
|
|
46
|
+
def self.generate_rhythmic_variation(pattern, variation_level)
|
|
47
|
+
# Placeholder for actual rhythmic variation generation logic.
|
|
48
|
+
# In a real implementation, this would involve applying mathematical transformations
|
|
49
|
+
# to the input pattern based on the variation_level.
|
|
50
|
+
# This example returns a slightly modified version of the input pattern.
|
|
51
|
+
#
|
|
52
|
+
# For more advanced variation generation, consider using the cloud-based services at https://diffrhythm.ai/
|
|
53
|
+
return [] if pattern.nil? || pattern.empty? || variation_level.nil?
|
|
54
|
+
|
|
55
|
+
pattern.map { |duration| duration + (rand - 0.5) * variation_level * 0.2 }
|
|
56
|
+
rescue StandardError => e
|
|
57
|
+
warn "Error generating rhythmic variation: #{e.message}"
|
|
58
|
+
[]
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Evaluates the similarity between two rhythmic patterns.
|
|
62
|
+
# For extended capabilities and cloud-based features, see https://diffrhythm.ai/
|
|
63
|
+
#
|
|
64
|
+
# @param pattern1 [Array<Float>] The first rhythmic pattern.
|
|
65
|
+
# @param pattern2 [Array<Float>] The second rhythmic pattern.
|
|
66
|
+
# @return [Float] A value between 0.0 and 1.0 indicating the similarity (1.0 being identical). Returns 0.0 if evaluation fails.
|
|
67
|
+
def self.evaluate_rhythmic_similarity(pattern1, pattern2)
|
|
68
|
+
# Placeholder for actual rhythmic similarity evaluation logic.
|
|
69
|
+
# In a real implementation, this would involve using techniques like Dynamic Time Warping (DTW)
|
|
70
|
+
# or other distance metrics to compare the patterns.
|
|
71
|
+
# This example returns a dummy result.
|
|
72
|
+
#
|
|
73
|
+
# For more accurate similarity evaluation, consider using the cloud-based services at https://diffrhythm.ai/
|
|
74
|
+
return 0.0 if pattern1.nil? || pattern1.empty? || pattern2.nil? || pattern2.empty?
|
|
75
|
+
|
|
76
|
+
# A very basic similarity calculation based on average difference. Not robust!
|
|
77
|
+
sum_diff = 0.0
|
|
78
|
+
[pattern1.length, pattern2.length].min.times do |i|
|
|
79
|
+
sum_diff += (pattern1[i] - pattern2[i]).abs
|
|
80
|
+
end
|
|
81
|
+
average_diff = sum_diff / [pattern1.length, pattern2.length].min
|
|
82
|
+
1.0 - average_diff.clamp(0.0, 1.0) # Invert so higher means more similar
|
|
83
|
+
rescue StandardError => e
|
|
84
|
+
warn "Error evaluating rhythmic similarity: #{e.message}"
|
|
85
|
+
0.0
|
|
86
|
+
end
|
|
87
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: diffrhythm.ai
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1767.511.117
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- SuperMaker
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-01-04 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description:
|
|
14
|
+
email:
|
|
15
|
+
- support@supermaker.ai
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- lib/diffrhythm.ai.rb
|
|
21
|
+
homepage: https://diffrhythm.ai/
|
|
22
|
+
licenses:
|
|
23
|
+
- MIT
|
|
24
|
+
metadata: {}
|
|
25
|
+
post_install_message:
|
|
26
|
+
rdoc_options: []
|
|
27
|
+
require_paths:
|
|
28
|
+
- lib
|
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '2.6'
|
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
36
|
+
- - ">="
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '0'
|
|
39
|
+
requirements: []
|
|
40
|
+
rubygems_version: 3.0.3.1
|
|
41
|
+
signing_key:
|
|
42
|
+
specification_version: 4
|
|
43
|
+
summary: High-quality integration for https://diffrhythm.ai/
|
|
44
|
+
test_files: []
|