Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PitchAnalyser #2388

Merged
merged 1 commit into from
Jul 8, 2020
Merged

PitchAnalyser #2388

merged 1 commit into from
Jul 8, 2020

Conversation

sksum
Copy link
Member

@sksum sksum commented Jul 6, 2020

Implemented the correct way to interpret pitchAnalyser.getValues() .

increasing frequency bins makes it Precise (not accurate).
@sksum
Copy link
Member Author

sksum commented Jul 6, 2020

[[0,["start",{"id":1593955808991,"collapsed":false,"xcor":0,"ycor":0,"heading":0,"color":10,"shade":60,"pensize":5,"grey":185.71428571428572}],377,126,[null,3,null]],[1,["pitchness",{"value":null}],479,199,[2]],[2,"print",405,199,[3,1,4]],[3,"forever",391,167,[0,2,null]],[4,["newnote",{"collapsed":false}],405,231,[2,5,8,9]],[5,"divide",507,231,[4,6,7]],[6,["number",{"value":1}],593,231,[5]],[7,["number",{"value":8}],593,263,[5]],[8,"vspace",419,263,[4,10]],[9,"hidden",405,357,[4,null]],[10,"rest2",419,295,[8,null]]]

I used this setup for testing

@pikurasa
Copy link
Collaborator

pikurasa commented Jul 8, 2020

It works great!

I made two tuners:

  1. A 440 as default (specified by box as 110):
[[0,["start",{"id":1594209344572,"collapsed":false,"xcor":0,"ycor":-448.541748046875,"heading":0,"color":-10,"shade":50,"pensize":5,"grey":100}],443,98,[null,66,null]],[1,"settimbre",457,203,[15,2,77,3]],[2,["voicename",{"value":"guitar"}],608,203,[1]],[3,"hidden",457,298,[1,81]],[4,"forever",1182,603,[80,5,null]],[5,"print",1196,635,[4,6,8]],[6,["pitchness",{"value":13.458251953125}],1270,635,[5]],[7,["pitchness",{"value":13.458251953125}],1356,699,[13]],[8,"setxy",1196,667,[5,9,13,14]],[9,["number",{"value":0}],1270,667,[8]],[10,["height",{"value":924}],1442,731,[11]],[11,"divide",1356,731,[13,10,12]],[12,["number",{"value":2}],1442,763,[11]],[13,"minus",1270,699,[8,7,11]],[14,"vspace",1196,730,[8,null]],[15,"penup",457,171,[66,1]],[16,"setxy",1510,589,[43,17,18,36]],[17,["number",{"value":0}],1584,589,[16]],[18,"minus",1584,621,[16,22,19]],[19,"divide",1670,653,[18,20,21]],[20,["height",{"value":924}],1756,653,[19]],[21,["number",{"value":2}],1756,685,[19]],[22,["number",{"value":0}],1670,621,[18]],[23,"vspace",1510,684,[36,24]],[24,"forward",1510,716,[23,27,40]],[25,["storein2",{"value":"box"}],1278,327,[60,26,null]],[26,["number",{"value":110}],1384,327,[25]],[27,["namedbox",{"value":"box"}],1589,716,[24]],[28,["storein2",{"value":"box"}],1510,1001,[53,30,32]],[29,["namedbox",{"value":"box"}],1702,1001,[30]],[30,"multiply",1616,1001,[28,29,31]],[31,["number",{"value":2}],1702,1033,[30]],[32,"vspace",1510,1033,[28,null]],[33,"divide",1670,812,[38,34,35]],[34,["height",{"value":924}],1756,812,[33]],[35,["number",{"value":2}],1756,844,[33]],[36,"vspace",1510,652,[16,23]],[37,["y",{"value":378}],1670,780,[38]],[38,"plus",1584,780,[40,37,33]],[39,"vspace",1510,843,[42,47]],[40,"show",1510,748,[24,41,38,42]],[41,["number",{"value":24}],1584,748,[40]],[42,"vspace",1510,811,[40,39]],[43,"until",1496,526,[76,44,16,null]],[44,["greater",{"value":true}],1591,526,[43,45,46]],[45,["namedbox",{"value":"box"}],1656,526,[44]],[46,["height",{"value":924}],1656,558,[44]],[47,["newnote",{"collapsed":false}],1510,875,[39,48,51,53]],[48,"divide",1612,875,[47,49,50]],[49,["number",{"value":1}],1698,875,[48]],[50,["number",{"value":4}],1698,907,[48]],[51,"vspace",1524,907,[47,52]],[52,"hertz",1524,939,[51,54,null]],[53,"hidden",1510,1001,[47,28]],[54,["namedbox",{"value":"box"}],1598,939,[52]],[55,["newnote",{"collapsed":false}],1264,200,[63,56,59,62]],[56,"divide",1366,200,[55,57,58]],[57,["number",{"value":1}],1452,200,[56]],[58,["number",{"value":4}],1452,232,[56]],[59,"vspace",1278,232,[55,60]],[60,"pitch",1278,264,[59,65,61,25]],[61,["number",{"value":1}],1352,296,[60]],[62,"hidden",1264,389,[55,null]],[63,"input",1264,168,[68,64,55]],[64,["text",{"value":"Input a value"}],1338,168,[63]],[65,["inputvalue",{"value":null}],1352,264,[60]],[66,["storein2",{"value":"box"}],457,139,[0,67,15]],[67,["number",{"value":110}],563,139,[66]],[68,"print",1264,136,[72,69,63]],[69,["text",{"value":"Select a pitch (letter name or solfege)"}],1338,136,[68]],[70,["action",{"collapsed":false}],1250,95,[null,71,72,null]],[71,["text",{"value":"Pitch Select"}],1382,104,[70]],[72,"hidden",1264,136,[70,68]],[73,["nameddo",{"value":"Pitch Select"}],1040,146,[null,null]],[74,["action",{"collapsed":true}],1482,485,[null,75,76,null]],[75,["text",{"value":"Print Pitch-Points on Screen"}],1614,494,[74]],[76,"hidden",1496,526,[74,43]],[77,["nameddo",{"value":"Print Pitch-Points on Screen"}],471,235,[1,null]],[78,["action",{"collapsed":false}],1168,562,[null,79,80,null]],[79,["text",{"value":"Detect Pitch"}],1300,571,[78]],[80,"hidden",1182,603,[78,4]],[81,["nameddo",{"value":"Detect Pitch"}],457,298,[3,null]]]
  1. User selects pitch they want to tune
[[0,["start",{"id":1594209344572,"collapsed":false,"xcor":0,"ycor":-393.3629150390625,"heading":0,"color":-10,"shade":50,"pensize":5,"grey":100}],443,98,[null,70,null]],[1,"settimbre",457,203,[15,2,74,3]],[2,["voicename",{"value":"guitar"}],608,203,[1]],[3,"hidden",457,298,[1,78]],[4,"forever",1182,603,[77,5,null]],[5,"print",1196,635,[4,6,8]],[6,["pitchness",{"value":68.6370849609375}],1270,635,[5]],[7,["pitchness",{"value":68.6370849609375}],1356,699,[13]],[8,"setxy",1196,667,[5,9,13,14]],[9,["number",{"value":0}],1270,667,[8]],[10,["height",{"value":924}],1442,731,[11]],[11,"divide",1356,731,[13,10,12]],[12,["number",{"value":2}],1442,763,[11]],[13,"minus",1270,699,[8,7,11]],[14,"vspace",1196,730,[8,null]],[15,"penup",457,171,[70,1]],[16,"setxy",1510,589,[42,17,18,35]],[17,["number",{"value":0}],1584,589,[16]],[18,"minus",1584,621,[16,22,19]],[19,"divide",1670,653,[18,20,21]],[20,["height",{"value":924}],1756,653,[19]],[21,["number",{"value":2}],1756,685,[19]],[22,["number",{"value":0}],1670,621,[18]],[23,"vspace",1510,684,[35,24]],[24,"forward",1510,716,[23,26,39]],[25,["storein2",{"value":"box"}],1264,358,[61,79,null]],[26,["namedbox",{"value":"box"}],1589,716,[24]],[27,["storein2",{"value":"box"}],1510,1001,[52,29,31]],[28,["namedbox",{"value":"box"}],1702,1001,[29]],[29,"multiply",1616,1001,[27,28,30]],[30,["number",{"value":2}],1702,1033,[29]],[31,"vspace",1510,1033,[27,null]],[32,"divide",1670,812,[37,33,34]],[33,["height",{"value":924}],1756,812,[32]],[34,["number",{"value":2}],1756,844,[32]],[35,"vspace",1510,652,[16,23]],[36,["y",{"value":183}],1670,780,[37]],[37,"plus",1584,780,[39,36,32]],[38,"vspace",1510,843,[41,46]],[39,"show",1510,748,[24,40,37,41]],[40,["number",{"value":24}],1584,748,[39]],[41,"vspace",1510,811,[39,38]],[42,"until",1496,526,[73,43,16,null]],[43,["greater",{"value":true}],1591,526,[42,44,45]],[44,["namedbox",{"value":"box"}],1656,526,[43]],[45,["height",{"value":924}],1656,558,[43]],[46,["newnote",{"collapsed":false}],1510,875,[38,47,50,52]],[47,"divide",1612,875,[46,48,49]],[48,["number",{"value":1}],1698,875,[47]],[49,["number",{"value":4}],1698,907,[47]],[50,"vspace",1524,907,[46,51]],[51,"hertz",1524,939,[50,53,null]],[52,"hidden",1510,1001,[46,27]],[53,["namedbox",{"value":"box"}],1598,939,[51]],[54,["newnote",{"collapsed":false}],1264,200,[62,55,58,61]],[55,"divide",1366,200,[54,56,57]],[56,["number",{"value":1}],1452,200,[55]],[57,["number",{"value":4}],1452,232,[55]],[58,"vspace",1278,232,[54,59]],[59,"pitch",1278,264,[58,64,60,null]],[60,["number",{"value":2}],1352,296,[59]],[61,"hidden",1264,358,[54,25]],[62,"input",1264,168,[65,63,54]],[63,["text",{"value":"Input a value"}],1338,168,[62]],[64,["inputvalue",{"value":"G"}],1352,264,[59]],[65,"print",1264,136,[69,66,62]],[66,["text",{"value":"Select a pitch (letter name or solfege)"}],1338,136,[65]],[67,["action",{"collapsed":false}],1250,95,[null,68,69,null]],[68,["text",{"value":"Pitch Select"}],1382,104,[67]],[69,"hidden",1264,136,[67,65]],[70,["nameddo",{"value":"Pitch Select"}],457,139,[0,15]],[71,["action",{"collapsed":false}],1482,485,[null,72,73,null]],[72,["text",{"value":"Print Pitch-Points on Screen"}],1614,494,[71]],[73,"hidden",1496,526,[71,42]],[74,["nameddo",{"value":"Print Pitch-Points on Screen"}],471,235,[1,null]],[75,["action",{"collapsed":false}],1168,562,[null,76,77,null]],[76,["text",{"value":"Detect Pitch"}],1300,571,[75]],[77,"hidden",1182,603,[75,4]],[78,["nameddo",{"value":"Detect Pitch"}],457,298,[3,null]],[79,["outputtools",{"value":"pitch in hertz"}],1370,358,[25]]]

@pikurasa
Copy link
Collaborator

pikurasa commented Jul 8, 2020

@walterbender this patch works pretty well. I think we can pull in the changes.

@walterbender walterbender merged commit 3a2e885 into sugarlabs:master Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants