Pseudo or even real Real Time Clock
-
kozikowski
- Posts: 71538
- Joined: Thu Aug 02, 2007 5:57 pm
- Operating System: macOS 10.13 High Sierra
Pseudo or even real Real Time Clock
I wonder how terrible it would be to provide a Project option to grab the computer time at the beginning of a recording and save it as one of the files in _DATA (or somewhere). Time-of-day is not an unknown request and is a major problem with people trying to convert Audacity into a surveillance recorder. Or more to the point. I have personally make a number of recordings in an afternoon it would have been nice to go back and from the producer's notes, find the audio at 15:47 on Tuesday.
Yes, certainly you can whip out your scratch pad, Uni-Ball pen and calculator and figure it out eventually using the file stamps (... put down the three and carry the one which puts you past midnight, so you subtract 12 hours except in Arizona which doesn't use Daylight Savings ....)
....or you could tell Audacity to start the timeline from the that tiny time file in the project folder.
Not that I'm not advocating trying to track real time over an editing session. That can be a nightmare even with SMPTE time and good management.
No limits. Like what would happen if you had two timelines like a Time Of Day time line underneath the label track?
Any ideas at all. Every video recorder on earth can do this before breakfast.
Koz
Yes, certainly you can whip out your scratch pad, Uni-Ball pen and calculator and figure it out eventually using the file stamps (... put down the three and carry the one which puts you past midnight, so you subtract 12 hours except in Arizona which doesn't use Daylight Savings ....)
....or you could tell Audacity to start the timeline from the that tiny time file in the project folder.
Not that I'm not advocating trying to track real time over an editing session. That can be a nightmare even with SMPTE time and good management.
No limits. Like what would happen if you had two timelines like a Time Of Day time line underneath the label track?
Any ideas at all. Every video recorder on earth can do this before breakfast.
Koz
Re: Pseudo or even real Real Time Clock
and yet it is virtually unheard of in audio editors.kozikowski wrote:Any ideas at all. Every video recorder on earth can do this before breakfast.
As you've noticed, another good reason to have access to the time: http://forum.audacityteam.org/viewtopic ... 02#p227702
On Linux it would be very easy for Audacity to be aware of the time.
At the command line:
Code: Select all
~$ date --rfc-3339=ns
2013-11-05 07:34:44.313825506+00:00It becomes wrong as soon as you do anything to the audio?kozikowski wrote:Like what would happen if you had two timelines like a Time Of Day time line underneath the label track?
What happens if you change the sample rate? What happens to the time line and what happens in the Selection Toolbar?
Would it be enough if you could (manually) offset time zero on the timeline?
And/or, check the time when you press record (even if you don't have a watch, most computers display a clock), then Ctrl+B and type in the current time?
If the start time is known then it would be trivial to generate a label track with times displayed at intervals.
When we get version 4 Nyquist plug-ins, if the start time is known then it should be possible to label, or otherwise display the time at any arbitrary point on a track.
"Append Date and Time to File Name [X]" ?kozikowski wrote:I have personally make a number of recordings in an afternoon it would have been nice to go back and from the producer's notes, find the audio at 15:47 on Tuesday.
Learn more about Nyquist programming at audionyq.com
Re: Pseudo or even real Real Time Clock
I just wrote this exact code for a client. WxWidgets does not make it easy to turn the time and date into a string. If you'd like to look at the code in action or the source let me know and I will post the link to download the executable and/or the source code.steve wrote: "Append Date and Time to File Name [X]" ?
-
kozikowski
- Posts: 71538
- Joined: Thu Aug 02, 2007 5:57 pm
- Operating System: macOS 10.13 High Sierra
Re: Pseudo or even real Real Time Clock
Any timeline gets messed up when you start "doing things" to the audio.
The film people have edge codes, literally numbers printed on the edge of the film. You print the Camera Negative (and then lock it up). You beat up and cut the print (multiple times if needed) until everybody likes the movie, and then you go back and copy down all the edge codes. That's what you use to cut the negative -- or later, that's what you use to cut the image of the negative into the final movie. Nobody cuts prints any more, either, that happens inside an Avid movie video editor. The classic clapboard? that's proof positive that you got the right take. Editing movies is bookkeeping and each frame is accounted for down to 1/24 of a second (in the US).
I'm trying to remember how Final Cut Pro does (did) it. There was a show timeline and somehow you could tell the time associated with the clips you were editing. It is required that you be able to answer some very simple questions very rapidly. "Is that the 3 O'Clock take from Wednesday?" That can not be a 'stump the band' question.
Pure guesswork tells me that Broadcast WAV has the ability to carry burned-in time. I don't actually know that, but I know people who develop this stuff.
How about this. The timeline starts at Midnight like always, but there is an extra time window down at the bottom of the work surface and it reads clip time of day. A Recording Start would go look for the system clock. If the clip arrives with no burned-in time, that window starts from midnight -- or maybe it asks you if you know the start time of the clip.
I know it's easy to imagine nightmares with this, but just when you think it can't get any worse...
Regard Sony videotape machine-to-machine editing. Tapes carry two times, a track along one edge that works any time the tape is in motion, and the same time burned into the video data for when the tape is still-framed or stopped. There was a mode you could get into during editing where the two times would very gradually become unlocked as you edited. Eventually, the error would become so great that you would play one time and the tape would switch to an obviously different time when you stopped. Some edits were listed in one time and some in the other. Eventually, I found a Sony corporate production editor who had the "Secret Oral Teachings" and knew the menu item which fixed that.
When it was working right, it was easy. The playback tape had the clip time. The clip tapes could have hour listings. Tape number four started at 3:58:00:00 and rolled to 4 at first picture. The master record machine had the midnight or standard timeline (which actually started at 58:00:00). First picture at midnight -- all zeros.
~~
I suppose it would be a killer if the Project not only forgot UNDO when you turned the computer off, but forgot the times, too. This has to be burned into the Project. My head hurts. I'm going to bed.
Koz
The film people have edge codes, literally numbers printed on the edge of the film. You print the Camera Negative (and then lock it up). You beat up and cut the print (multiple times if needed) until everybody likes the movie, and then you go back and copy down all the edge codes. That's what you use to cut the negative -- or later, that's what you use to cut the image of the negative into the final movie. Nobody cuts prints any more, either, that happens inside an Avid movie video editor. The classic clapboard? that's proof positive that you got the right take. Editing movies is bookkeeping and each frame is accounted for down to 1/24 of a second (in the US).
I'm trying to remember how Final Cut Pro does (did) it. There was a show timeline and somehow you could tell the time associated with the clips you were editing. It is required that you be able to answer some very simple questions very rapidly. "Is that the 3 O'Clock take from Wednesday?" That can not be a 'stump the band' question.
Pure guesswork tells me that Broadcast WAV has the ability to carry burned-in time. I don't actually know that, but I know people who develop this stuff.
How about this. The timeline starts at Midnight like always, but there is an extra time window down at the bottom of the work surface and it reads clip time of day. A Recording Start would go look for the system clock. If the clip arrives with no burned-in time, that window starts from midnight -- or maybe it asks you if you know the start time of the clip.
I know it's easy to imagine nightmares with this, but just when you think it can't get any worse...
Regard Sony videotape machine-to-machine editing. Tapes carry two times, a track along one edge that works any time the tape is in motion, and the same time burned into the video data for when the tape is still-framed or stopped. There was a mode you could get into during editing where the two times would very gradually become unlocked as you edited. Eventually, the error would become so great that you would play one time and the tape would switch to an obviously different time when you stopped. Some edits were listed in one time and some in the other. Eventually, I found a Sony corporate production editor who had the "Secret Oral Teachings" and knew the menu item which fixed that.
When it was working right, it was easy. The playback tape had the clip time. The clip tapes could have hour listings. Tape number four started at 3:58:00:00 and rolled to 4 at first picture. The master record machine had the midnight or standard timeline (which actually started at 58:00:00). First picture at midnight -- all zeros.
~~
I suppose it would be a killer if the Project not only forgot UNDO when you turned the computer off, but forgot the times, too. This has to be burned into the Project. My head hurts. I'm going to bed.
Koz
Re: Pseudo or even real Real Time Clock
Except for the standard one, which does not care what you do to the audio, it always starts at 0 and progresses uniformly 1, 2,3...kozikowski wrote:Any timeline gets messed up when you start "doing things" to the audio.
interesting. So you'd like time stamps on each audio clip?kozikowski wrote:The film people have edge codes,...
In the "BEXT Chunk" it can carry a 64 bit number that is the number of samples since midnight. Useful for some professional applications, but rather harder for the average user than adding 8 hours 45 minutes to the time line if the recording began at 8:45.kozikowski wrote:Pure guesswork tells me that Broadcast WAV has the ability to carry burned-in time. I don't actually know that, but I know people who develop this stuff.
Oh yeskozikowski wrote:I know it's easy to imagine nightmares with this,
No, please, let's not.kozikowski wrote:Regard Sony videotape machine-to-machine editing....
There are lots of things that could be done if Audacity recorded system time in the recording, but I think that is a major part of the problem.
While time stamps are obviously an essential feature of surveillance recorders and video editors, imho it is far from essential for a program like Audacity.
If we were to have time stamps I'd expect them to be irrelevant to 99.9% of users, but for the remaining fraction of 1 percent, I'd expect that one person would want a new time line, another will want a "real time clock" in the selection bar, another will want SMPTE time code, another will want "samples since midnight", another will want time and date according to the Gregorian calendar, another will want date according to the Hijri calendar, another will want Unix time, another will want "system time" and "sample time", another will want UT, another will want time zone adjustment, another will want automatic file naming, another will want....
Learn more about Nyquist programming at audionyq.com
Re: Pseudo or even real Real Time Clock
I'd be interested in seeing the code Edgar.Edgar wrote:I just wrote this exact code for a client. WxWidgets does not make it easy to turn the time and date into a string. If you'd like to look at the code in action or the source let me know and I will post the link to download the executable and/or the source code.
Learn more about Nyquist programming at audionyq.com
Re: Pseudo or even real Real Time Clock
Here you go, the first function, FillDateTime(…), is the work horse which shows how to extract all the time/date information using wxWidgets; the other function, OnAudioBiocolorExport(), shows it in action:steve wrote:I'd be interested in seeing the code Edgar.Edgar wrote:I just wrote this exact code
Code: Select all
void FillDateTime(wxString & pString2Fill, bool pFillWithDate, bool pFillWithTime, bool pLeadingUnderscore/* = false*/) {
if (!pFillWithDate && !pFillWithTime)
return;
if (pLeadingUnderscore)
pString2Fill.Append(wxT("_"));
wxDateTime dateTime;
dateTime.SetToCurrent();
int hour = dateTime.GetHour();
int minute = dateTime.GetMinute();
int second = dateTime.GetSecond();
wxString fileTime;
wxString intrim;
if (pFillWithDate) {
int year = dateTime.GetYear();
int month = dateTime.GetMonth();
int day = dateTime.GetDay();
fileTime.Printf(wxT("%d"), year);
fileTime.Append(wxT("-"));
intrim.Printf(wxT("%d"), ++month);//month is a zero indexed value
fileTime.Append(intrim);
fileTime.Append(wxT("-"));
intrim.Printf(wxT("%d"), day);
fileTime.Append(intrim);
}
if (pFillWithTime) {
if (pFillWithDate)
fileTime.Append(wxT("_"));
intrim.Printf(wxT("%d"), hour);
fileTime.Append(intrim);
fileTime.Append(wxT("-"));
intrim.Printf(wxT("%d"), minute);
fileTime.Append(intrim);
fileTime.Append(wxT("-"));
intrim.Printf(wxT("%d"), second);
fileTime.Append(intrim);
}
pString2Fill.Append(fileTime);
}
bool AudacityProject::OnAudioBiocolorExport() {
AudacityApp * app = (AudacityApp *)(&wxGetApp());
wxString fileFormat(app->GetFileFormat());
if (fileFormat.IsEmpty())
fileFormat = wxT("WAV");
else if (!fileFormat.CmpNoCase(wxT("FLAC")))
fileFormat = wxT("FLAC");
else
fileFormat = wxT("WAV");
wxString fileNamePrefix(app->GetFileNamePrefix());
//build file name
wxString filename(app->GetFolderLocation());
if (filename.IsEmpty())
filename = wxT("C:\");
//insure this is a valid folder and user has write permission
if (!wxDir::Exists(filename)) {
if (!wxFileName::Mkdir(filename, 0777, wxPATH_MKDIR_FULL)) {
wxString message;
message.Printf(_("Destination directory %s could not be created! Cannot export audio."), filename);
wxMessageBox(message);
return false;
}
}
else {
//folder exists can we write to it?
if (!wxFileName::IsDirWritable(filename)) {
wxString message;
message.Printf(_("Destination directory %s is write protected or does not have sufficient free space! Trying the root of the C drive."), filename);
wxMessageBox(message);
filename = wxT("C:\");
if (!wxFileName::IsDirWritable(filename)) {
message.Printf(_("Cannot write to the root of the C drive, there might not be sufficient free space! Cannot export audio."));
wxMessageBox(message);
return false;
}
}
}
if (filename.Last() != wxFileName::GetPathSeparator())
filename.Append(wxFileName::GetPathSeparator());
if (!fileNamePrefix.IsEmpty()) {
filename.Append(fileNamePrefix);
filename.Append(wxT("_"));
}
wxString dateTime;
if (app->GetHasCustomFileName()) {
//build user supplied filename
filename.Append(app->GetCustomFileName());
if (app->GetWantsDateSuffix() || app->GetWantsTimeSuffix()) {
FillDateTime(dateTime, app->GetWantsDateSuffix(), app->GetWantsTimeSuffix(), true);
filename.Append(dateTime);
}
}
else {
//build default filename
FillDateTime(dateTime);
filename.Append(dateTime);
}
if (fileFormat == wxT("FLAC"))
filename.Append(wxT(".flac"));
else
filename.Append(wxT(".wav"));
Exporter e;
return e.Process(this, 2, fileFormat, filename, false, 0.0, mTracks->GetEndTime());
}Re: Pseudo or even real Real Time Clock
Thanks Ed.
Learn more about Nyquist programming at audionyq.com
-
kozikowski
- Posts: 71538
- Joined: Thu Aug 02, 2007 5:57 pm
- Operating System: macOS 10.13 High Sierra
Re: Pseudo or even real Real Time Clock
I bet saving a WAV file is relevant to 99% of users.I'd expect them to be irrelevant to 99.9% of users
"I really wanted an Audacity Project but I keep getting this stupid WAV file..."
Koz
Re: Pseudo or even real Real Time Clock
We usually see the reverse problem don't we? "How do I save one file and not hundreds of little fragments", or, "listen to my recording: mytune.aup", but we're discussing that issue over there -> http://forum.audacityteam.org/viewtopic ... 40&t=75376kozikowski wrote:"I really wanted an Audacity Project but I keep getting this stupid WAV file..."
... back on topic... what exactly is your "feature request"? You want a button that changes the start of the time-line from "0.0" to "Now"?
Learn more about Nyquist programming at audionyq.com