Audacity 3.3.1 Resampling or Changing the Number of Samples in Waveform

I have used Audacity for years and recently upgraded to 3.3.1.
One use I have for Audacity is to change the number of samples in waveform to give me a specific number of samples per cycle of the wave and the export as text for playing in a C - Array on a microcontroller. This used to be so simple with the older versions.
For instance to keep simple… If from Menu, Generate, Tone … a sinewave tone 100 Hz for 0.1 Seconds, I should have 10 cycles of the waveform and if the sample rate is 44100, I should have total of 4410 samples or 441 samples per cycle. To play this waveform in a microcontroller I may want to create an Array of 256 samples for each cycle because the buffer size is 256 or multiples of it. So in “old Audacity” I would select the 441 samples for 1 cycle, then pick Copy. … (the 441 samples are now on my clipboard), I would then close the Track showing the waveform and open a new track with the sample rate set at (44100 x 256 / 441) = 25600 rate. I then paste the clipboard into the new track and I end up with 256 samples for the 1 cycle of the sinewave. I then use Menu, Tools, Sample Data Export and export this 256 samples to a text file and create the audio array in my micro program. The method of changing the project samplerate has changed from the main screen to going back into preferences each time and I have tried various options of what should I do first but I always now end up with the wrong numbers of samples.
I was wondering if someone could help please and detail the order or procedure for doing an exercise like this.
I know that in my example above I dont have to actually do this because all I have to do is generate a tone of 172.26 Hz and I will have 256 samples per cycle at 44100 rate. But I am not always doing this I could be recording or playing any shape of waveform or frequency and want to convert it to 256 samples per cycle or any number or cycles per cycle.

I have checked a bit further on how the last post actually seems to operate…
When I open Audacity and check preferences it says Project rate 44100 with no auio files opened.
If I generate a tone as my last post I get 4410 samples for 10 cycles eg. 441 samples per cycle.
I Zoom in and select and copy 1 cycle of 441 samples, then close that track.
I then go to Edit Preferences and set Project from 44100 to (44100 x 256 / 441) = 25600.
Then I Add New Mono track, it opens and shows sample rate of 25600 OK on the track.
I then Edit, Paste the 441 samples copied from clipboard and it shows as 256 samples in the track and shows as 1 cycle OK.
So it seems to work OK, same as before update if Audacity is opened at 44100 and copy is done as at 44100 and calculation for new rate is based on 44100.
Also need to set new rate in Preferences before new track is added… ( No Good to open new track and change rate from the track options. )
Then paste the copied 441 wave into new rate track.

The problem seems to be when I open a track that is at a rate other than 44100. If I open a track that has already been saved at say 48000 the track says 48000 on it and if I go into Preferences I see that it has changed the Project rate itself to 48000.

So to test that… I First opened Audacity and checked Prefs. was at 44100. Then opened the Track file. The track showed 48000, then checked Prefs. and it said 48000 Project rate. So Audacity changed it in Prefs. itself.
I then Zoomed in and selected and copied 1 cycle (129 samples for 1 cycle of this file). The track rate still showed 48000. I then closed the track.
I then calculated new rate as ( 44100 x 256 /129 ) = 87516. Prefs were still at 48000 so changed this to 87516.
Then Menu, Tracks, Add New Mono … Track now shows 87516. I then Pasted the clipboard 129 sample copy into the new track and got 256 samples (255 to be exact prob rounding).
So it seems to work providing all worked as if at 44100 even the rate of the file opened is different.

This is a change from the older versions and very confusing, now that the Project rate is not on the main screen and the Track rate shows different than what the calculation are based on… It is definately not a good improvement or a good upgrade…??

Just wondering if someone can give some help on this problem Please…
OR is this posted in the wrong forum… I thought this was “Audacity Help Forum”
Is there any articles in the Manual or online that I can read up on how to do this on this new upgrade version 3.3.1 … ???

This topic was automatically closed after 30 days. New replies are no longer allowed.