![]() |
soundkarte ohne bass.dll
Hallo ihr!
wie kann man die soundkarte ohne bass.dll ansprechen und manipulieren? wäre nett wenn ihr da ein paar sources hättet! thx for all! |
Re: soundkarte ohne bass.dll
mache es so:
Delphi-Quellcode:
Ein Beispiel:const Mono : Word = $0001; RiffId : string = 'RIFF'; WaveId : string = 'WAVE'; FmtId : string = 'fmt '; DataId : string = 'data'; type TWaveFile = class WaveFormatEx : TWaveFormatEx; MS : TMemoryStream; TempInt, DataCount, RiffCount : integer; SoundValue : byte; w : double; // omega ( 2 * pi * frequency) duration : integer; samplerate : integer; constructor Create; procedure AddHeader(HSampleRate,HDuration:Integer); procedure AddData (Freq,HDuration:Integer); procedure SaveToFile(FileName:String); procedure Play; destructor Free; end; constructor TWaveFile.Create; begin inherited Create; MS := TMemoryStream.Create; samplerate := 11025; end; destructor TWaveFIle.Free; begin MS.Free; end; procedure TWaveFile.AddHeader(HSampleRate,HDuration:integer); begin duration := hduration; samplerate := HSampleRate; with WaveFormatEx do begin wFormatTag := WAVE_FORMAT_PCM; nChannels := Mono; nSamplesPerSec := SampleRate; wBitsPerSample := $0008; nAvgBytesPerSec := nSamplesPerSec * nBlockAlign; nBlockAlign := (nChannels * wBitsPerSample) div 8; cbSize := 0; end; with MS do begin {Calculate length of sound data and of file data} DataCount := (Duration * SampleRate) div 1000; // sound data RiffCount := Length(WaveId) + Length(FmtId) + SizeOf(DWord) + SizeOf(TWaveFormatEx) + Length(DataId) + SizeOf(DWord) + DataCount; // file data {write out the wave header} Write(RiffId[1], 4); // 'RIFF' Write(RiffCount, SizeOf(DWord)); // file data size Write(WaveId[1], Length(WaveId)); // 'WAVE' Write(FmtId[1], Length(FmtId)); // 'fmt ' TempInt := SizeOf(TWaveFormatEx); Write(TempInt, SizeOf(DWord)); // TWaveFormat data size Write(WaveFormatEx, SizeOf(TWaveFormatEx)); // WaveFormatEx record Write(DataId[1], Length(DataId)); // 'data' Write(DataCount, SizeOf(DWord)); // sound data size end; end; procedure TWaveFile.AddData(Freq,HDuration:integer); var i :integer; begin w := 2 * Pi * Freq; // omega for i := 0 to hduration*samplerate div 1000 - 1 do begin // wt = w *i /SampleRate SoundValue := 127 + trunc(127 * sin(i * w / SampleRate)); MS.Write(SoundValue, SizeOf(Byte)); end; end; procedure TWavefile.SaveToFile(FileName:String); begin MS.Seek(0, soFromBeginning); MS.SaveToFile(Filename); end; procedure TWaveFile.Play; begin sndPlaySound(MS.Memory, SND_MEMORY or SND_SYNC); end; Du möchtest eine Frequenz erzeugen von 400 hz und 1 sekunde dann
Delphi-Quellcode:
ich hoffe das ist was du meinst!
wavefile := TWaveFile.Create;
wavefile.addheader(44100,1000); wavefile.adddata(400,1000); wavefile.play; Was willst du genau machen? |
Re: soundkarte ohne bass.dll
hi igel, ich wollte eine mp3 abspielen und sie manipulieren indem ich bestimmte frequenzen nicht spiele, kannste mir da helfen?
|
Re: soundkarte ohne bass.dll
Dann solltest du dich zunächst über das mp3-Dateiformat informieren, und zudem die Mathematik dahinter verstehen (FFT). Dann musst du die Files komplett von Hand dekodieren, in einen geeignet großen Buffer schreiben und dass dann evtl. mit o.g. Möglichkeit abspielen. Je nach Kenntnis von Delphi, höherer Mathematik, Datenstrukturen und in deinem Fall auch die Theorie hinter Filtern kann es schon sehr lange dauer bis man auch nur ansatzweise zu einem Ergebnis kommt ;). Allein der Aufbau von mp3s ist heftig, und das dekodieren - da reden wir erstmal nicht drüber =)
|
Re: soundkarte ohne bass.dll
thx for all
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:19 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz