Autor Beitrag
Hendrik
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 324



BeitragVerfasst: Fr 11.06.04 22:37 
Hi!

Ich dachte eigentlich, dass es das Thema mit der Frage nach der Bestimmung der Länge einer Wavedatei schon mehrmals gegen hätte, aber dem scheint nach meiner Suche hier nicht so zu sein. Deshalb frage ich einfach nochmal nach : Wie kann ich denn die Länge einer Wavedatei in ms abfragen?

Gruß
Hendrik
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: Sa 12.06.04 17:14 
Code den ich benutze dafür, von [url]www.swissdelphicenter.ch[/url]
So steht er dort:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
uses 
  MPlayer, MMsystem; 

type 
  EMyMCIException = class(Exception); 
  TWavHeader = record 
    Marker1: array[0..3] of Char; 
    BytesFollowing: Longint; 
    Marker2: array[0..3] of Char; 
    Marker3: array[0..3] of Char; 
    Fixed1: Longint; 
    FormatTag: Word; 
    Channels: Word; 
    SampleRate: Longint; 
    BytesPerSecond: Longint; 
    BytesPerSample: Word; 
    BitsPerSample: Word; 
    Marker4: array[0..3] of Char; 
    DataBytes: Longint; 
  end; 

procedure TForm1.Button1Click(Sender: TObject); 
var 
  Header: TWavHeader; 
begin 
  with TFileStream.Create('C:\SomeFile.wav', fmOpenRead) do 
    try 
      ReadBuffer(Header, SizeOf(Header)); 
    finally 
      Free; 
    end; 
  ShowMessage(FloatToStr((Int64(1000) * header.DataBytes div header.BytesPerSecond) / 1000)); // ohne dieses /1000 dann haste die ms.
end;
galagher
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2562
Erhaltene Danke: 46

Windows 10 Home
Delphi 10.1 Starter, Lazarus 2.0.6
BeitragVerfasst: Do 16.09.04 17:32 
Karlson hat folgendes geschrieben:
Code den ich benutze dafür, von [url]www.swissdelphicenter.ch[/url]


Hallo, kann mir bitte jemand helfen, die erhaltene Zahl in Minuten und Sekunden umzuwandeln?
Es gibt im Net einige Möglichkeiten, aber KEINE(!) ermittelt die korrekte Dauer einer WAV-Datei. Wäre mir eine grosse Hilfe! Danke!!!

_________________
gedunstig war's - und fahle wornen zerschellten karsig im gestrock. oh graus, es gloomt der jabberwock - und die graisligen gulpen nurmen!
Wishmaster
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34



BeitragVerfasst: Di 21.09.04 00:52 
About ATL
The ATL provides programming tools for Borland Delphi 3, 4, 5, 6, 7.

The pack includes several components described below
AAC - for manipulating with AAC file information
APE Tag - for manipulating with APE Tags
CDDA Track - for getting information for CDDA track
FLAC - for manipulating with FLAC file information
fpl - reads foobar2000 playlist files (*.fpl)
ID3v1 - for manipulating with ID3v1 tags
ID3v2 - for manipulating with ID3v2 tags
Monkey - for manipulating with Monkey's Audio file information
MPEG Audio - for manipulating with MPEG audio file information
Musepack - for manipulating with Musepack file information
Ogg Vorbis - for manipulating with Ogg Vorbis file information
OptimFROG - for manipulating with OptimFROG file information
TwinVQ - for extracting information from TwinVQ file header
Vorbis Comment - for manipulating with Vorbis Comments
WAV - for manipulating with WAV files
WavPack - for manipulating with WAVPack Files
WMAfile - for extracting information from WMA file header


mac.sourceforge.net/atl/

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
function  DurationMinSec(Secunden : string) : string;
var Min, Sec : integer;
    SecToTime : string;
begin
   Min:=   StrToInt(Secunden) div 60;
   Sec:=   StrToInt(Secunden) - Min * 60;
   SecToTime:= Format('%2d:%.2d', [Min, Sec]);
   result:=  SecToTime;
end;
galagher
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2562
Erhaltene Danke: 46

Windows 10 Home
Delphi 10.1 Starter, Lazarus 2.0.6
BeitragVerfasst: Di 21.09.04 18:01 
Wishmaster hat folgendes geschrieben:
mac.sourceforge.net/atl/


Genial! Danke! Das habe ich gesucht! :D

_________________
gedunstig war's - und fahle wornen zerschellten karsig im gestrock. oh graus, es gloomt der jabberwock - und die graisligen gulpen nurmen!