Problem with last sample

Effects, Recipes, Interfacing with other software, etc.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
Post Reply
pranavj
Posts: 8
Joined: Tue Jun 29, 2010 7:12 am
Operating System: Please select

Problem with last sample

Post by pranavj » Mon Jul 12, 2010 4:59 pm

Hi

(I'm not sure whether this question is related to audio processing.)
1. When I generate (say) 3 samples of tone (or noise for that matter) in Audacity, the waveform shows a connecting line only until second sample. Why is it not connected to the third sample?

2. What is the time of the first sample? Is it 0 or 1/Sampling_Rate or something else?

Thanks.

Regards,
Pranav

steve
Site Admin
Posts: 80751
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Problem with last sample

Post by steve » Mon Jul 12, 2010 9:33 pm

If you generate 3 samples, you should get one sample at the beginning (t=0), a second sample at 1/(sample rate), and a third sample at 2/(sample rate)

Just tested on Audacity 1.3.12 (Linux) and it works as expected.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

pranavj
Posts: 8
Joined: Tue Jun 29, 2010 7:12 am
Operating System: Please select

Re: Problem with last sample

Post by pranavj » Tue Jul 13, 2010 9:13 am

Thank you for your time on this trivial question but please see the screen-shot attached. I have kept the cursor at 3rd sample (using -> arrow keys on keyboard) and the waveform doesn't seem to connect to it. What am I doing wrong?

I'm using Audacity 1.3.12 (beta, on Windows).

Regards,
Pranav
Attachments
13july_2010_1.JPG
Sceenshot of 3 sample tone, cursor at 3rd sample
13july_2010_1.JPG (67.43 KiB) Viewed 804 times

Trebor
Posts: 9852
Joined: Sat Dec 27, 2008 5:22 pm
Operating System: Windows 8 or 8.1

Re: Problem with last sample

Post by Trebor » Tue Jul 13, 2010 2:16 pm

pranavj wrote:When I generate (say) 3 samples of tone (or noise for that matter) in Audacity, the waveform shows a connecting line only until second sample.
Why is it not connected to the third sample?
If you zoom-in really close (as you have done) so you can see individual samples, (the dots on the waveform line),
there is sometimes a gap one sample wide on the waveform display without a line connecting two parts ...
Audacity gap one sample wide #.gif
Audacity gap one sample wide #.gif (35.69 KiB) Viewed 796 times
This apparent break in the line usually doesn’t affect the sound: the break is graphical rather than an actual discontinuity in the waveform.

steve
Site Admin
Posts: 80751
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Problem with last sample

Post by steve » Tue Jul 13, 2010 4:39 pm

The first sample is at time = 0.00000 (if you look closely at the extreme left edge of the track you can see a dot - or is it half a dot :) )
So this first sample you could say is the 0'th sample. If you generate 1 sample, this will be the one and only dot.

You can also see the 2nd and 3rd samples, and your cursor is at the position of the 4th sample.
It's a bit like birthdays; on your 3rd birthday you are in your 4th year. Your first actual birthday is the day that you are born - your 0'th birthday, after which you are into your first year. Similarly, the first sample is at time = 0, the second sample is positioned 1 sample period after 0, and the third sample is positioned 2 periods after 0. Your cursor is positioned 3 periods after 0 (as indicated by the number at the bottom), which is where the 4th sample would go if there was one.

The box at the bottom is a "time" counter. Usually you have it set to seconds, or some other obvious unit of time. When set to "Samples", it is still measuring time periods, but in this case the time period is "sample periods". Just as you would expect seconds to count up from 0, so too the sample periods count up from 0.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

pranavj
Posts: 8
Joined: Tue Jun 29, 2010 7:12 am
Operating System: Please select

Re: Problem with last sample

Post by pranavj » Wed Jul 14, 2010 5:29 am

stevethefiddle wrote:The first sample is at time = 0.00000 (if you look closely at the extreme left edge of the track you can see a dot - or is it half a dot )So this first sample you could say is the 0'th sample. If you generate 1 sample, this will be the one and only dot.
Yes, thanks to both of you, I get it now. It was just that my cursor always went one sample ahead (even when I generate a single sample, the cursor can still go to right by 1/Sampling_Rate) of the last sample that caused confusion.

Post Reply