dulvui / pocket-broomball

The world's first broomball video game, made with Godot Engine for iOS, Android and Web
https://simondalvai.org/games/pocket-broomball
GNU Affero General Public License v3.0
31 stars 7 forks source link

'musical mode' which makes the hits only operate within the c major scale (randomly) #11

Closed RustoMCSpit closed 12 months ago

dulvui commented 1 year ago

Thanks for your suggestion! How would this work? I'm not a music expert so I don't know exactly what c major is.

RustoMCSpit commented 1 year ago

Thanks for your suggestion! How would this work? I'm not a music expert so I don't know exactly what c major is.

In the 3rd octave, the hertz values for the notes of the C major scale are approximately:

C: 261.63 Hz D: 293.66 Hz E: 329.63 Hz F: 349.23 Hz G: 392.00 Hz A: 440.00 Hz B: 493.88 Hz

In the 4th octave, the hertz values for the notes of the C major scale are approximately:

C: 523.25 Hz D: 587.33 Hz E: 659.26 Hz F: 698.46 Hz G: 783.99 Hz A: 880.00 Hz B: 987.77 Hz

Hope that helps! 🎵

RustoMCSpit commented 1 year ago

game/src/actors/ball/HitSound.gd

you'd have to use a list with the above values rather than pitch_scale = rand_range (0.8, 1.2)

so for example pitch_scale = cMajor[rand_range(0, 13)]

RustoMCSpit commented 1 year ago

is that good?

dulvui commented 1 year ago

@RustoMCSpit What would the values of the cMajor Array be?

RustoMCSpit commented 1 year ago

@RustoMCSpit What would the values of the cMajor Array be?

i posted them in the above comment, those are the hertz values

RustoMCSpit commented 1 year ago

@RustoMCSpit What would the values of the cMajor Array be?

both the third and fourth octaves of the C major scale in a GDScript array:

var cMajorScale = [261.63, 293.66, 329.63, 349.23, 392.00, 440.00, 493.88, 523.25, 587.33, 659.25, 698.46, 783.99, 880.00, 987.77]

RustoMCSpit commented 1 year ago
var cMajorScale = [
    # Third Octave
    261.63, # C
    293.66, # D
    329.63, # E
    349.23, # F
    392.00, # G
    440.00, # A
    493.88, # B

    # Fourth Octave
    523.25, # C
    587.33, # D
    659.25, # E
    698.46, # F
    783.99, # G
    880.00, # A
    987.77  # B
]
dulvui commented 1 year ago

Awesome thank you! I'll integrate your code asap and deploy a test version to itch.io, so you can hear if it sounds correctly. Probably by tomorrow night, I'll be able to deploy the test version.

RustoMCSpit commented 1 year ago

Awesome thank you! I'll integrate your code asap and deploy a test version to itch.io, so you can hear if it sounds correctly. Probably by tomorrow night, I'll be able to deploy the test version.

could you upload a pre-release into github as well

RustoMCSpit commented 1 year ago

this mode could be expanded in tournaments with key changes but maybe thats for a later day

dulvui commented 12 months ago

@RustoMCSpit I tried now but using this values are too big to be used as pitch. The tone is simply and its not producing any sound anymore. I taught a bit about the idea of a musical mode, and to be honest in my opinion it doesn't fit in the game, since its a sports game and players might not understand what this musical mode would be. Thank you anyway for your feedback and for the other valuable tips like changing pith of the sound.

RustoMCSpit commented 12 months ago

@RustoMCSpit I tried now but using this values are too big to be used as pitch.

the value are in the hertz unit, what unit did you input? these values are sang by low voiced to mid voiced singers, they arent 'high'

RustoMCSpit commented 12 months ago

var cMajorScale = [

MIDI note values

# Third Octave
24, # C
26, # D
28, # E
29, # F
31, # G
33, # A
35, # B

# Fourth Octave
36, # C
38, # D
40, # E
41, # F
43, # G
45, # A
47  # B

]

RustoMCSpit commented 12 months ago

the above is using midi, not hertz

dulvui commented 12 months ago

I used them as pitch. Godot has now option to put midi or hertz values This are the values that can be set image

RustoMCSpit commented 12 months ago

what unit does 'pitch scale' operate in?

RustoMCSpit commented 12 months ago

if we're wrong the devs will correct us

dulvui commented 12 months ago

It is a simple multiplicator of thr pitch. A value of 2 means double pitch.

RustoMCSpit commented 12 months ago

It is a simple multiplicator of thr pitch. A value of 2 means double pitch.

right so that'd be an octave, one sec this is still technically do-able

RustoMCSpit commented 12 months ago

the converted list using the pitch multiplier system:


var cMajorScale = [
    # Third Octave
    1.0,    # C
    1.12246,    # D
    1.25992,    # E
    1.33484,    # F
    1.49831,    # G
    1.68179,    # A
    1.88775,    # B

    # Fourth Octave
    2.0,    # C
    2.24492,    # D
    2.51984,    # E
    2.66817,    # F
    2.99662,    # G
    3.36358,    # A
    3.7755     # B
]