bird-sanctuary / bluejay-rtttl-parse

A JavaScript library for parsing Nokia Ring Tone Text Transfer Language (RTTTL)
2 stars 2 forks source link

Fix the failing unit tests for when Octave=3 #10

Open saidinesh5 opened 3 years ago

saidinesh5 commented 3 years ago

The Rtttl specification doesn't seem to support multiple dots and octaves other than 4,5,6,7 But since Bluejay ESCs can play Octave 3 notes, it may be worth it to try fixing unit tests for those notes.

This is hard because we seem to be losing a lot of precision when trying to calculate Temp4 value.

PhilippMolitor commented 2 years ago

Is there any reason why it does not go below E in O3? I'd really like to create a very deep sounding ESC tune on my 2807 motors.

saidinesh5 commented 2 years ago

Hi, Yes we currently use 8 bits for storing frequency value in bluejay's RTTTL representation,

and D3 (146.83 Hz) becomes:

> _calculateBluejayTemp3FromFrequency(146.83)
259

Which won't fit in those 8 bits. @matthiasvr might have an idea on how to get around that issue - We can implement some kind of transpose functionality in another setting?

P.S This issue is about something else though.. (RTTTL -> Bluejay data -> RTTL) conversion fails for 3rd octave notes

PhilippMolitor commented 2 years ago

Thanks for the easy explanation!

saidinesh5 commented 2 years ago

Do hop on the bluejay discord if you want to follow this issue. I pinged Matthias about being able to transpose the beep frequency to play lower octaves. If it works out, we can have more interesting tunes.