I use Audacity on a Mac, and I’m blind, so I use it with VoiceOver. I’m working on a project that involves tone generation but in a very specific way, and I’m looking for suggestions for how best to go about it.
Basically, I am creating simulations of tree-cricket songs at different temperatures. Most tree crickets sing long trills consisting of a pure-toned pip repeated a certain number of times per second. The frequency (kHz) of the tone and the pulse rate (Hz) vary with temperature.
I need to be able to generate a tone at a very specific frequency (say, 2.45 kHZ), which I have already figured out how to do. What I don’t yet know how to do is to turn it into a pip that will repeat the exact number of times per second I want (say 24 pulses per second). I don’t want the pips to bleed into each other, but to remain distinct. Here, here and here are a few examples of the kind of sound I want to simulate.
To be clear, I’m not simulating these particular recordings; my data for frequency and pulse rate is coming from an Excel spreadsheet.
Also, please keep in mind that I am blind and thus can’t use a mouse, relying on my screen reader and keyboard for everything. As a consequence, even though this forum is Audacity-specific, if anyone thinks I might have an easier time doing this with something else (say GarageBand), please do let me know.
The “Four-spotted tree cricket” you linked to mainly consists of a series of sine sweeps (chips) from ~3900Hz down to~ 3500Hz in ~27milliseconds, so it 's not a “pure tone” of constant pitch:
the 400Hz difference (3900-3500) is audibly noticeable,
(and I have the advantage of seeing it on Audacity’s spectrogram).
Audacity has a generate-chirp option in the generate menu, which can give a passable imitation, e.g. here is synthesized “pure” sine, then synthesized chirps, then the real cricket …
The real McCoy has more complexity & noise.
There are also 66 ms pulses at ~9.6kHz separated by 180ms.
That something people could count: ~4 times per second.
Thanks for all this. I did not realize they were sweeps, so thanks for enlightening me. The simulations I want to make would however be based only on one frequency, because the Excel data I have only uses one frequency for each point. That may be a flaw in the data, but I’m not sure we have more accurate measurements for the vast majority of our data points…
The purpose of the simulations is mostly to allow me to translate numbers on a graph into sound my ears can interpret. While the difference between pure sine vs. sweeps is there, on listening to the synthesized sounds I’m not sure it would affect the quality of the simulations too terribly much. They aren’t meant to be super accurate, only to give an idea of a subjective pitch ratio between kHz and Hz, because that’s how my brain thinks.
So once I generate the pure tone or chirp, how do I control exactly how often it repeats per second? Right now I have to ballpark while trimming, but doing that while blind leads to a lot of inaccuracy…
There’s a thing in Audacity called Nyquist prompt, that can convert code into sound.
e.g. the code below creates a 3700Hz sine wave, amplitude-modulated by a 18.5Hz triangle wave, twice (for extra pointiness)
You have to generate some silence/audio first, then select that audio, then apply Nyquist prompt with the code above pasted into it to produce the tone.
The tone is not as good as my first attempt which I made using tools with GUIs, (like Audacity’s spectral edit tools), not Nyquist code.
This sounds like it could be a good solution for my needs, thank you! I will play around with it. You mentioned the spectral editing tools gave you better results - any chance I could use that accessibly? From a quick glance at the manual I rather doubt it, but the code you suggested may work well enough.
Nyquist code can do everything the graphic-interface tools can do,
but I don’t know enough about Nyquist to translate them into code.
A steep narrow bandpass filter is required remove everything outside +/-500Hz of the 3700Hz tone generated by the code above, (so it better matches the actual cricket)
Thanks again for the explanation of this. If @Steve wants to jump in that’s cool, otherwise I’ll play around with the above. I think that should serve my purpose fine.
Also, I wasn’t even going to ask this initially, but is there a way with Nyquist to generate simulations of sounds like these? The fourth sound file on that page is the clearest example of the chirps grouped in 2-3- or 2-3-3 patterns of pulses that I might want to try and simulate.
Probably just my own coding incompetence, but when I attempt to paste in your code I get this error message:
Nyquist Prompt: Error in Nyquist code
Your code looks like SAL syntax, but there is no ‘return’ statement.
For SAL, use a return statement such as:
return track * 0.1
or for LISP, begin with an open parenthesis such as:
(mult track 0.1)
.
The code I posted works for me verbatim in Audacity2 & Audacity3, (on Windows).
but it looks like I have added one too many close-brackets at the end,
it should end with 3 close- brackets, (rather than 4) …
Can modulate on & off with rectangular pulses. In Nyquist code you can specify the “duty cycle” of pulses : i.e. the ratio of off-to-on, e.g. on for 25% of a 1Hz cycle …
I use Audacity 3.4.2 on Mac. It certainly looks to me like I’m pasting code into the right box, at least from what the VoiceOver screen reader is telling me. I did notice the close bracket issue, but still got that same error after having corrected it. I have tried both generating a sine tone and silence in which to paste the code, then Cmd-A for select all, then open Nyquist Prompt and paste.
Thanks for telling me about the rectangular pulses.
The syntax error message you posted confirms you’ve got the right box:
only the Nyquist prompt window shows that message.
I know there can be problems pasting text between different operating-systems:
sometimes character-encoding does not match.
(I’ve experienced this between Windows & Linux, but I don’t speak Mac).
I’ve copied the code from my post and pasted it into Notepad++ which shows all the characters, and there are no hidden characters.
My second code has “.25”, (no leading zero). However for me “0.25” produces the same result: both generate the same audio. second code in UTF-8 text file.txt (87 Bytes)
I’ve even updated to Audacity 3.4.2: the second Nyquist code works there (on Windows 8).
So, still no dice. I get the same error message. I’m now thinking perhaps I ought to create a separate topic on the MacOS forum and see if others know anything?
Also, when I try just typing it in directly, as soon as I hit the space bar it thinks I’m done inputting the code. I thought this was a VoiceOver thing (it doesn’t like Audacity’s text boxes), but it did the same thing when I turned VoiceOver off.
This is frustrating, but thanks for working through it with me.
@kozikowski is the only Audacity forum leader I’m sure is on a Mac.
They may be able to determine if the Nyquist Code I posed in this thread works in Audacity on a Mac.