Autor Beitrag
Jakob_Ullmann
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1747
Erhaltene Danke: 15

Win 7, *Ubuntu GNU/Linux*
*Anjuta* (C, C++, Python), Geany (Vala), Lazarus (Pascal), Eclipse (Java)
BeitragVerfasst: So 09.03.08 13:28 
Hi,

ich habe mir www.swissdelphicente.../showcode.php?id=132 durchgelesen. Außerdem noch das Buch "Das große Win32 API Band 4". Beide Varianten habe ich probiert. Nun habe ich eine kleine Wave-Datei mit Winamp abgespielt und mein Progrämmchen in Bewegung gesetzt und nach der Aufnahme alles wiedergegeben. Ich hab es zwar gehört - jedoch stimmt die Qualität nicht ganz! Ich höre mehr rauschen als Musik und leise war es auch! Code:

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:
34:
35:
36:
37:
38:
// Record:
procedure TForm1.ToolButton7Click(Sender: TObject);
begin
  mciSendString('OPEN NEW TYPE WAVEAUDIO ALIAS mysound', nil, 0, Handle);
  mciSendString('SET mysound TIME FORMAT MS',
    nil, 0, Handle);
  mciSendString('RECORD mysound', nil, 0, Handle);
  TrackBar1.Max := 0;
  Timer1.Enabled := true;  { Enabled wurde am Anfang auf False gesetzt }
end;

// Timer:
procedure TForm1.Timer1Timer(Sender: TObject);
begin
  TrackBar1.Max := TrackBar1.Max + 1;
end;

// Stop:
procedure TForm1.ToolButton9Click(Sender: TObject);
begin
  TrackBar1.Visible := True;
  Timer1.Enabled := False;
  try
    mciSendString(PChar('stop mysound'), nil, 0, Handle);
  except
    ShowMessage('Fehler!');
  end;
end;

// Play:
procedure TForm1.ToolButton8Click(Sender: TObject);
begin
  try
    mciSendString(PChar('play mysound from 0 to '+IntToStr(TrackBar1.Max * 1000)), nil, 0, 0);
  except
    ShowMessage('Fehler!');
  end;
end;


Was muss ich machen, damit ich eine gute Qualität habe? So eine, wie ich auch bei z. B. Audacity habe, wenn ich Sounds aufnehme?

EDIT: Hab's:

'BITSPERSAMPLE 16 ' + // 8 Bit
'CHANNELS 1 ' + // MONO
'SAMPLESPERSEC 44000 ' + // 44 KHz
'BYTESPERSEC 88250', // 8000 Bytes/s
turboPASCAL
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 193
Erhaltene Danke: 1

Win XP / Vischda
D6 PE / D2005 PE
BeitragVerfasst: So 09.03.08 15:58 
z. B. so:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
var
  bitspers, {...} : string;
  mciStr: string;
 
begin
// ...

bitspers        := IntToStr(16);
mono_or_stereo  := IntToStr(2);  // 1 = mono 2 = stereo
samples_per_sec := IntToStr(44100);

mciSendString('OPEN NEW TYPE WAVEAUDIO ALIAS mysound', '', 0, handle);

mciStr := 'SET mysound TIME FORMAT MILLISECONDS BITSPERSAMPLE ' + bitspers +
          ' CHANNELS ' + mono_or_stereo +
          ' SAMPLESPERSEC ' + samples_per_sec +
          ' BYTESPERSEC ' + samples_per_sec;

mciSendString(PCHAR(mciStr), '', 0, handle);

mciSendString('RECORD mysound // ...

_________________
Nein, ich bin nicht der turboPASCAL aus der DP, ich seh nur so aus... :P