Audacity Guitar Notes + Scriping

Hey guys, first time using Audacity as a developer. I’m currently working on a project to turn my guitar into an interface for chess (so playing the G note 4 times selects g4). I’ve found that simply recording my needed notes, then doing Normalize → Plot spectrum finds me the correct note of the string played if I just find the highest peak. Any idea on where I start with actually passing this data through to my program? I’ll just need to write it to a file so I was wondering if I should be making a plugin that somehow access normalize and plot spectrum or if scriping in audacity is capable of doing this or if I’m doing it the worst way possible? Thanks for the help!

I presume that you realise that Audacity does not do real time processing? Audacity cannot process audio on the fly - you have to record or import the audio first, and then process it. Does that undermine your idea of using Audacity for this task?

Yeah I realize this but fortunately it is still acceptable for what I want to create, just not realtime like my original intention. I originally meant to do this in a software such as Guitar Rig but there was no way of actually getting the data from Guitar Rig even if it displayed it. Now it will simply be a matter of recording and …running the script? (if it is possible to do this with scripting in Audacity for each move) which will be a bit tedious but the goal of the project is just to actually get the interface up and running even if not real time. Any ideas on how to do it, or at least any specific tutorials that can help? :c I was a bit lost looking around at a way to do it.

I wrote a “pitch detect” plug-in using “Nyquist” scripting language. That may be a good starting point.
The plug-in is available here: http://wiki.audacityteam.org/wiki/Nyquist_Analyze_Plug-ins#Pitch_Detect
Installation instructions: http://wiki.audacityteam.org/wiki/Download_Nyquist_Plug-ins#Installing_Plug-ins
Some information about writing Nyquist scripts and plug-ins: http://wiki.audacityteam.org/wiki/Nyquist_Plug-ins_Reference

Thanks a lot of the help. Just one question before I start diving really deep into all of the reading. Is there a way to call the other built in effects installed in Audacity such as Normalize from Nyquist? I read the brief tutorial earlier but that only included built in functions such as multiply and add which manipulated sound. Sorry if these answers are extremely obvious and nooby :stuck_out_tongue:.

No, but you can do it the other way round. You can set up a “Chain” of Audacity commands and include one or more Nyquist effects in that chain. See here about Chains: http://manual.audacityteam.org/o/man/chains_for_batch_processing_and_effects_automation.html

Ah that is fantastic. And I just tried out the plug-in you developed and it works perfectly for everything I need. Thank you for everything, just saved me several not so fun hours of work. :stuck_out_tongue: Now to just figure out how to detect how many notes I have in a specific recording and I’m good to go, but I’ll do that on my own since Nyquist seems fun. Thanks again.

I think it’s fun :stuck_out_tongue:

We also have a board on this forum specifically for things to do with Nyquist programming. http://forum.audacityteam.org/viewforum.php?f=39
Feel free to ask questions on that board, and / or share the results of your Nyquist programming.

Hey steve,

I have edited your plugin quite a bit to output the data to a txt file that my chess program now reads in for input, but I was still having issues finding out a way to actually get audacity to recognize how many notes I’ve played. I’ve attached a sample wav of how all of my recordings generally are for the program, but reading through all the Nyquist documentation i’m still not sure how to actually get it to recognize the notes i’ve played. I thought of analyzing and counting each time the program goes over a certain amplitude threshold but have not found a way of actually computing that in Nyquist. Sorry again for bothering you. Any hints on where to begin?

P.S: wasn’t sure whether to post this here or just create a new topic in the Nyquist forums.

Have a look at the “Silence Finder” plug-in (SilenceMarker.ny in the Audacity plug-ins folder).

I’ve moved this topic to the Nyquist forum.

Queens Rook 5 ?