Page 1 of 4 1234 LastLast
Results 1 to 40 of 181

Thread: Sugestions or Comments about my Sound Tutorial

Hybrid View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Sugestions or Comments about my Sound Tutorial

    The tutorial (under construction):
    http://www.vbforums.com/showthread.php?t=388562

    Please post any sugestions or comments about my tutorial here.

    What would you like to see in my tutorial ? (keep in mind that it is about sound using DirectXSound)

    Any comments about what I already have ? something that needs more explaining, or not clear enough ?
    Did I make any mistakes in that thread ? am I saying something that is not true/wrong ?

    Keep in mind that it is under construction, and it will be for a long time. I'm doing this in my free time (at work, and home).

  2. #2
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,728

    Re: Sugestions or Comments about my Sound Tutorial

    You said,
    Quote Originally Posted by CVMichael
    Title: VB6.0 – Sound and DirectXSound Tutorial
    I thought you would cover non-Dx sound too.

    Will you cover MIDI ? That's what I'm interested in.

    I wish for a good (preferebly non-Dx) MIDI tutorial. But the way you started, I guess DirectX woun't be too hard.

    I want to build a software synthesizer that can save compositions as MIDI files.

    P.S. Why that dummy file is there ?
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Sugestions or Comments about my Sound Tutorial

    Sorry, I don't know anything about MIDI, so I won't cover it.

    About the dummy file: vbforums.com will display the attached picture in the attachment section if there is only one picture attached. If there is more than one picture, it won't display any of them. This way i'm tricking it into not displaying the picture, because I don't want to display it there, I want to display the picture at the beginning of the post.

    The non-DX sound, I mean wave files, creating and modifying sounds directly in the Byte (or Integer) arrays, as opposed to modify the sound in the DX buffer, or DX functions.
    Last edited by CVMichael; Feb 22nd, 2006 at 06:18 PM.

  4. #4
    Lively Member rm_03's Avatar
    Join Date
    Aug 2004
    Posts
    92

    Re: Sugestions or Comments about my Sound Tutorial

    "What is sound ?":
    What about frequencies, and their representation as samples?

    "Sound format":
    Samplerate - I think you should also explain the Nyquist frequency.

    "How to read or write to a wave file ?":
    I thought those headers were called chunks.
    Also your WaveReadFormat function may not work for all wavs,
    there could also be other chunks (for example comments) before
    the data chunk, or the data could be compressed, so the format
    chunk could be much bigger.

    I'm excited about the more advaned topics like tone recognition
    and resampling. Will you also cover the FFT and digital filters (IIR, FIR)?

    For the ACM encoder, I could give you a class I've written,
    if you're interested.

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Sugestions or Comments about my Sound Tutorial

    Quote Originally Posted by rm_03
    "What is sound ?":
    What about frequencies, and their representation as samples?
    I can explain about frequencies... but I'm not sure what you mean by "and their representation as samples"
    Quote Originally Posted by rm_03
    "Sound format":
    Samplerate - I think you should also explain the Nyquist frequency.
    I don't know anything about Nyquist frequency, I heared before about Nyquist theorem. But as I was saying don't know anything about it.
    Maybe you can exaplain it, and I'll put it in the tutorial (giving credit to you for that part of course)
    Quote Originally Posted by rm_03
    "How to read or write to a wave file ?":
    I thought those headers were called chunks.
    Yea... I do have a "ChunkHeader" structure there...
    Quote Originally Posted by rm_03
    Also your WaveReadFormat function may not work for all wavs,
    there could also be other chunks (for example comments) before
    the data chunk, or the data could be compressed, so the format
    chunk could be much bigger.
    That's what this code does (From the WaveReadFormat):
    VB Code:
    1. ' Ignore chunks until we get to the "data" chunk.
    2.     Get #InFileNum, , chunk
    3.     Do While chunk.lType <> &H61746164
    4.         For i = 1 To chunk.lLen
    5.             Get #InFileNum, , by
    6.         Next
    7.         Get #InFileNum, , chunk
    8.     Loop
    Quote Originally Posted by rm_03
    Will you also cover the FFT and digital filters (IIR, FIR)?
    I was thinking to write something about FFT, but I have only little experience with it.
    And I don't know about filters, but I'm excited to learn. And when I know something then i'll put it in the tutorial.
    I was actually looking for a long time for code (or formulas) about digital filters, but I could not find anything usefull.
    Quote Originally Posted by rm_03
    For the ACM encoder, I could give you a class I've written,
    if you're interested.
    I saw you code already, not long before you posted it in the CodeBank, but one problem I found with it is that it does not convert in real time, you have to give it a wave file, and then it will convert to MP3.
    I want to do this in real time, the code that I will explaing in the tutorial will be for both actually, for real time, and separate converting wave file to MP3 file.
    Last edited by CVMichael; Feb 23rd, 2006 at 01:21 PM.

  6. #6
    Lively Member rm_03's Avatar
    Join Date
    Aug 2004
    Posts
    92

    Re: Sugestions or Comments about my Sound Tutorial

    I can explain about frequesncies... but I'm not sure what you mean by "and their representation as samples"
    Basic stuff like how does a frequency at 10 Hz with the amplitude 16000 look like, and how to use sample points to create such a frequency.

    Nyquist frequency
    Never heard of the "Nyquist theorem" , but the Nyquist frequency (the highest possible freq) would
    be samplerate / 2, because you need at least 2 sample points for a frequency.

    That's what this code does (From the WaveReadFormat):
    Oops, didn't see that, sorry

    I was actually looking for a long time for code (or formulas) about digital filters, but I could not find anything usefull.
    Have you visited MusicDSP yet?
    http://www.musicdsp.org/archive.php?classid=3
    "RBJ Audio-EQ-Cookbook" is a good resource for various IIR filters.

    I'd love to see that tutorial grow, there's nothing comparable to it in the VB world yet.

  7. #7
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: Sugestions or Comments about my Sound Tutorial

    It looks good so far.

    You can put the image attachment in a post in the Support Images forum, and just link to it.


    The only comment I have is the "Sound format: What is ..." section seems to run-on, I'd prefer to see it either as a list, or with each item (eg: Block Align) underlined and/or bold to make them stand out.

  8. #8

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Sugestions or Comments about my Sound Tutorial

    Thanks...

    OK... I'll do that (underlineing, and bold)

    I also want to make some animated GIFs for the next section, but I'm having trouble finding a good and free GIF maker program.
    http://www.vbforums.com/showthread.php?t=388956

    I tried one (IrfanView 3.98) from download.com and I found the interface so difficult, I could not figure out how to even make a simple GIF, so I just un-installed it.

  9. #9
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: Sugestions or Comments about my Sound Tutorial

    I saw a post last week linking to a good simple one - but have no idea what it was called or which thread it was in tho

  10. #10
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: Sugestions or Comments about my Sound Tutorial

    I've seen a few "using sound in VB" type tutorials, but certainly nothing this complete - although I must admit I haven't looked particularly hard!

    It looking to me as if your tutorial will become a must-bookmark page.

  11. #11
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: Sugestions or Comments about my Sound Tutorial

    That is becoming one huge thread!! It may be better if it was split across a few threads (Basic/Medium/Advanced?), with an Index thread to link them together - it's up to you tho, it's just a thought!

    Another thing, instead of having the images uploaded into the thread itself, you can create a thread in the Support Images forum which contains them (as I do for the FAQs). You could also do this with the other attachments if you like.

  12. #12
    New Member Inuya5ha's Avatar
    Join Date
    Mar 2006
    Location
    AR
    Posts
    7

    Regarding the audio tutorial under construction

    It seems the audio tutorial here contains the following error in the first WaveReadFormat() routine:

    VB Code:
    1. If header.lFormatLength < 16 Then Exit Function

    header.lFormatLength holds 16 for either 8, 16 or 32 bits WAVE files.

    The correct procedure would be to ask for the WaveFormat wBitsPerSample value, but we cannot simply "replace" it here since "Dim WaveFmt As WaveFormat" is declared in another different function named Create_Wave_File_Example(). (or, this lFormatLength might have nothing to do with the actual WAV bits and be a totally different parameter not explained in the tutorial)

    Anyway, I have joined both WaveReadFormat and Create_Wave_File in one, in a function that simply retrieves True if the file is useable and False if not, and shows a messagebox when not. The function only let pass 16bit files, and I also use the WavDataStart variable to store the position of the actual WAV audio data start.

    VB Code:
    1. Public Function CheckWaveFile(ByVal sFileName As String) as Boolean
    2. 'Returns True if file is PCM WAVE and and 16-bit
    3.  
    4. Dim wHeader As FileHeader
    5. Dim wFormat As WaveFormat
    6. Dim wChunk As ChunkHeader
    7. Dim lDataLength As Long
    8. Dim wB as Byte
    9. Dim wL as Long
    10.  
    11.     WavNum = FreeFile
    12.     Open sFileName For Binary Access Read As #WavNum
    13.    
    14.     Get #WavNum, 1, wHeader
    15.    
    16.     If wHeader.lRiff <> &H46464952 Then GoTo InvalidFile   ' Check for "RIFF" tag and exit if not found.
    17.     If wHeader.lWave <> &H45564157 Then GoTo InvalidFile   ' Check for "WAVE" tag and exit if not found.
    18.     If wHeader.lFormat <> &H20746D66 Then GoTo InvalidFile ' Check for "fmt " tag and exit if not found.
    19.    
    20.     Get #WavNum, , wFormat ' Retrieve format.
    21.    
    22.     If wFormat.wBitsPerSample <> 16 Then GoTo InvalidFile ' check if file is 16-bit
    23.    
    24.     ' Seek to next chunk by discarding any format bytes.
    25.     For wL = 1 To wHeader.lFormatLength - 16
    26.         Get #WavNum, , wB
    27.     Next
    28.    
    29.     ' Ignore chunks until we get to the "data" chunk.
    30.     Get #WavNum, , wChunk
    31.     Do While wChunk.lType <> &H61746164
    32.         For wL = 1 To wChunk.lLen
    33.             Get #WavNum, , wB
    34.         Next
    35.         Get #WavNum, , wChunk
    36.     Loop
    37.    
    38.     WavDataStart = LOF(WavNum) - wChunk.lLen + 1 'get position of audio data start
    39.     WavBytesPerSec = wFormat.nAvgBytesPerSec
    40.     WavBytesPerSample = (wFormat.wBitsPerSample / 8) * wFormat.nChannels
    41.    
    42.     'Debug.Print "wav data start = " & WavDataStart
    43.     'Debug.Print "bytes per second = " & WavBytesPerSec
    44.        
    45.     Close #WavNum
    46.    
    47.     Exit Function
    48.    
    49. InvalidFile:
    50.     MsgBox "Failed to load selected wave file. Only 16-bit PCM WAV (uncompressed) files are supported.", vbCritical, App.ProductName
    51.     Close #WavNum
    52.    
    53. End Function

    The tutorial so far is great and very clear, good work.

  13. #13
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Sugestions or Comments about my Sound Tutorial

    Inuya5ha:

    CVMichael has asked the comments/suggestions/etal be posted here so they are all in one place for him to look at. Therefore, I've merged the thread you posted in ClassicVb with this one.

    Thanks for your feedback.
    Last edited by Hack; Mar 21st, 2006 at 02:26 PM.

  14. #14

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Sugestions or Comments about my Sound Tutorial

    Thanks for merging Hack.

    Inuya5ha, the variable that returns how many bits the wave has is wFormat.wBitsPerSample.

    So, to complete your function, put this line at the end of the function (Just before the "Exit Function" statement).
    VB Code:
    1. CheckWaveFile = wFormat.wBitsPerSample = 16

  15. #15

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Sugestions or Comments about my Sound Tutorial

    Ow... I just noticed that you have the right code in the function:
    VB Code:
    1. If wFormat.wBitsPerSample <> 16 Then GoTo InvalidFile ' check if file is 16-bit
    I don't understand what is the problem then ?

    Why do you mention about header.lFormatLength, when you do have the right code ?

    header.lFormatLength just returns the length of the structure, wich is always the same.

  16. #16
    Junior Member
    Join Date
    Mar 2006
    Posts
    23

    Re: Sugestions or Comments about my Sound Tutorial

    I have a question about your attached oscilloscope program
    I understand as much as I can from the code but I could not understant where is the call to this function "DirectSoundRecord_GotWaveData"
    It seems that we are calling this function after specific time...
    where are we calling this function and how to change this specific time???

  17. #17

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Sugestions or Comments about my Sound Tutorial

    GotWaveData is an event that comes from the DirectSound form (frmDX_Record.frm).

    If you want to change the interval that event is called, you have to change the buffer size, and that is done in the Initialize function.
    Look at the line in red:
    VB Code:
    1. If HalfBufferLen <= 0 Then
    2.             ' make half of the buffer to be 100 ms
    3.             [COLOR=Red]HalfBuffLen = .lAvgBytesPerSec / 10[/COLOR]
    4.         Else
    5.             ' using a "custom" size buffer
    6.             HalfBuffLen = HalfBufferLen
    7.         End If
    From that line the program chooses how big the buffer is, therefore how often the GotWaveData is called.

  18. #18
    Junior Member
    Join Date
    Mar 2006
    Posts
    23

    Re: Sugestions or Comments about my Sound Tutorial

    Thanks

  19. #19
    College Grad!!! Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,339

    Re: Sugestions or Comments about my Sound Tutorial

    I don't have time to read this whole thread but I do have some comments and suggestions.

    I know you are trying to make it easier to understand for us DS noobs, but your split buffer tutorial can't even read all the wave files! Just 16 bit stereo I think. So you are gonna need to add some code to support all wavs like one of your tutorials have. Not to mention not have it load a wav whenever it finishes like it currently is doing. And unfortunately, your "support all wavs code" doesn't have a sample project, so I don't know what to do with it really.

    I would also like you to add these tutorials:

    • How to reverse the sounds so you can play it backwards.
    • Allow more splits in the buffer
    • Add special effects like chorus, flange, reverb, etc.
    • How to equalize the sound.
    • Play only the bass or treble portion of the sound.
    • Changing the volumn of the buffer as well as the master volumn.
    • How to crossfade.
    • And we end the tutorial with a much more improved scratching program.


    I also would like to see a DirectSound module engine with all the tools you need to manipulate, record, play, pause, stop, etc., sounds. Otherwise I'm gonna be borrowing code from your scratching prog to make one on my own. Messed up on the last one cause the sound was skipping or jumping a little bit.

  20. #20
    New Member
    Join Date
    Mar 2007
    Posts
    11

    Question How to adjust mic input level?

    Hi CVMichael,
    First let me say a big thank you for the exellent vb6 tone record and analyse app. It was very interesting and just what I was looking for.
    I have adapted it and now have it all working and it is brilliant!

    I have one small problem left however, I need to adjust the mic record level in the vb6 app. My plan is to adjust the level until I get a good signal (i.e. I can analyse a tone which is being played and get the correct number).

    I have looked at technet, etc. but cannot find anywhere how to adjust the mic level. Can you help please?

    Many thanks

    Steve

  21. #21

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: How to adjust mic input level?

    Quote Originally Posted by steve6375
    I have one small problem left however, I need to adjust the mic record level in the vb6 app. My plan is to adjust the level until I get a good signal (i.e. I can analyse a tone which is being played and get the correct number).
    Unfortunatelly, I don't know how to do that either, but if you do find code on how to change the rec volume, then I'm pretty sure I can figure out how to auto change to optimal level...

  22. #22
    New Member
    Join Date
    Mar 2007
    Posts
    11

    Re: Sugestions or Comments about my Sound Tutorial

    Thanks for the reply.
    I found this -http://www.codeguru.com/csharp/csharp/cs_graphics/sound/article.php/c10931/ but am not at all sure about translating it to vb6...

  23. #23

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Sugestions or Comments about my Sound Tutorial

    Quote Originally Posted by steve6375
    Thanks for the reply.
    I found this -http://www.codeguru.com/csharp/csharp/cs_graphics/sound/article.php/c10931/ but am not at all sure about translating it to vb6...
    Actually, that does not help, but the link within it does: http://www.borg.com/~jglatt/tech/mixer.htm

    But I don't have time to learn how to use the API's and make an application for this. Maybe if you find code using the APIs listed there ?

  24. #24
    New Member
    Join Date
    Apr 2007
    Posts
    1

    Re: Sugestions or Comments about my Sound Tutorial

    About Tone Recognition, see this code... Is simple and functional... Easy !

    http://www.planet-source-code.com/vb...65667&lngWId=1

  25. #25

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Sugestions or Comments about my Sound Tutorial

    Quote Originally Posted by Robertovo
    About Tone Recognition, see this code... Is simple and functional... Easy !

    http://www.planet-source-code.com/vb...65667&lngWId=1
    rm_03 already posted code for the Goertzel algorithm in this thread at post #18

    And if you look at this thread http://www.vbforums.com/showthread.php?t=459138 at post #10, you will see I posted an application that will detect some frequencies
    Last edited by CVMichael; Apr 11th, 2007 at 07:21 AM.

  26. #26
    New Member
    Join Date
    Sep 2007
    Posts
    1

    Exclamation Re: Sugestions or Comments about my Sound Tutorial

    It was a nice and good reference on recording sound mix source. but I have found a big bug in your recording source code. That is a runtime error if you record over 2 gbytes, it will show an error of a bad record number.
    How can I solve this problem ? I saw that it is an vb automation error.

    have a nice day .... and post your reply as soon as possible. plz...^^

  27. #27

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Sugestions or Comments about my Sound Tutorial

    Quote Originally Posted by windowbase
    It was a nice and good reference on recording sound mix source. but I have found a big bug in your recording source code. That is a runtime error if you record over 2 gbytes, it will show an error of a bad record number.
    How can I solve this problem ? I saw that it is an vb automation error.

    have a nice day .... and post your reply as soon as possible. plz...^^
    Welcome to the forums

    About your problem: I would be surprized if it didn't give you an error...

    The program is made with VB functions. Internally VB keeps track of file position using a Long data type... A long data type has a maximum of 2^31=2,147,483,648 bytes... that's 2 GBytes.

    If you want it to work with more than 2 GBytes, then change all the functions for file processing to API functions.

    I don't want to change the code for file processing to API becuase the code is about sound processing, not file processing...

    I never would have thought that anyone would record for that long anyways...

    If you want to record for that long, then I think it is better to save it encoded to MP3 directly, you can record much longer like that.

    For recording directly to MP3, take a look at this thread:
    MP3 Encoder with Blade encoder
    This project is not using API also, but because it's recording to MP3, you can record up to 37 hours (using encoding 128bps) for a 2 GByte file.
    Last edited by CVMichael; Sep 16th, 2007 at 08:56 PM.

  28. #28
    New Member
    Join Date
    Mar 2007
    Posts
    11

    Re: Sugestions or Comments about my Sound Tutorial

    Are you trying to create a file larger tha 2GB on A FAT32 volume? If so it won't work - you need an NTFS volume.

  29. #29
    Fanatic Member EntityX's Avatar
    Join Date
    Feb 2007
    Location
    Omnipresence
    Posts
    798

    Re: Sugestions or Comments about my Sound Tutorial

    Only 1,824 views and 41 ( now 42 ) replies since the 17th of this month. Why so unpopular?
    Make as many mistakes as you can as quickly as you can. We want to make sure that we make a great enough number of mistakes in a given amount of time so that we can be successful.

    "Persistence is the magic of success." Paramahansa Yogananda

  30. #30

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Sugestions or Comments about my Sound Tutorial

    I guess not many people like to play with sound ?

  31. #31
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Sugestions or Comments about my Sound Tutorial

    Hi Michael. It's been about a month since I downloaded Direct_Sound, so this is long overdue.

    Great Job!

    Yesterday, I read your tutorial. I won't pretend to understand all the code but it will become more apparent as I use and manipulate your code in my own projects. You deserve a ...
    Big thumbs up!!!
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

  32. #32

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Sugestions or Comments about my Sound Tutorial

    Thank you CDRIVE, I'm glad it helped you.

    I wish I had more time to write about all the things I know about sound, but my current job & life style does not give me enough free time for this.

  33. #33
    New Member
    Join Date
    Oct 2008
    Posts
    1

    Re: Sugestions or Comments about my Sound Tutorial

    Hey CVMicheal!

    I don't know if you are like this or not, but whenever I buy a new game or some kind of electronic device, I tend to read/skim the instruction manual (mainly look at the pictures) just to get a feel for what I'm getting involved with.

    I have not read your tutorial... or even clicked the link yet. But I'm about to, and after reading this entire thread, I'm very excited to read the tutorial.

    I'm an electrical engineering student currently starting my junior year and I can see alot of similarities in what I take in my classes (mainly math) and what I have seen in the code examples. I have a special project in mind where I need to detect sound frequencies from a microphone and I think I can actually do it... or at least get a better understanding with this tutorial.

    So, just wanted to say hi and let you know that I am greatly looking forward to reading your tutorial.

    Thanks in advance! Cheers!

    - Zero

  34. #34

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Sugestions or Comments about my Sound Tutorial

    Hi Zero, and welcome to the forums

    Detecting frequencies is not covered in my tutorial, but there is code right here in this thread that can detect frequencies, thanks to rm_03.

    You still need to know how to record sound to be able to do it, and that you can learn from my tutorial.


    By the way guys, I forgot to say this before, I also posted my sound tutorial on CodeGuru, here:
    http://www.codeguru.com/vb/gen/vb_mu...php/c15297__1/

  35. #35
    New Member
    Join Date
    Oct 2014
    Posts
    1

    Re: Sugestions or Comments about my Sound Tutorial

    VB6.0 – Sound and DirectXSound Tutorial

    Hi, I hope, that I'm on the right path...and thank you for that fine tutorial!
    My problem is, that I cannot record in higher resolution than 16bit, stereo 44100Hz, I sucessfully wrote a sound generator using "play wave" that makes a sound in highest resolution (my onboard-soundsystem supplies wave up to 192KHz and 24Bit) by writing header with "extended-format". But I never suceeded to apply same header to "wave_sound_record" Can you please give me a kick :-) thanx a lot!
    vb6zip

  36. #36
    New Member
    Join Date
    Sep 2008
    Posts
    14

    Re: Sugestions or Comments about my Sound Tutorial

    Hi CVMichael. Bless you for having gone to the trouble of sharing the intricacies of DirectSound programming with us all. I am well on the way to completing a project based on your explanations and example code, however am stuck on one little thing (well I hope it's little!). In your 'Simple DirectSound' example, you make this statement:

    DsBuffer.SetCurrentPosition 0
    'You can use the SetCurrentPosition to jump around a sound file as you like; which can be useful

    I'd like a user to be able to select where to start sound play from. I'm hoping this can be accomplished via a slider on the form, the length of which always represents 100% of the sound length in the buffer, and wherever the slider knob is positioned, indicates to the user where in the sound duration the sound will start from. To do this, I would need to know how many bytes are in the buffer for the loaded sound, correct?

    If so, can you please suggest what procedure, function to use to determine how many bytes are taken by the sound in the buffer, so that instead of Sound(Index).DSBuffer.SetCurrentPosition 0, I can specify Sound(Index).DSBuffer.SetCurrentPosition X, where X is the number of bytes equivalent to where the slider is positioned?

    Thankyou so much

  37. #37
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: Sugestions or Comments about my Sound Tutorial

    Michael,

    Love the tutorial. Thanks!

    I am trying to make a "recording studio" on my PC for my son. I have recorded various sounds (.wav's) from my Yamaha key. What I want to do is create buttons that play them, and the ability to record what's been played. So...I will NOT be recording from an external device, but rather from the sounds that are already part of my app. Any quick tips on how to go about this? Does my question make sense?

    Thanks!

    Bryce

  38. #38

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Sugestions or Comments about my Sound Tutorial

    Hi Bryce, welcome to the forums

    Well, there are 3 ways to record that I can think of...

    1) is to record the actions, for example, save in a file like this:
    time difference from last action
    what button was clicked
    time difference from last action
    what button was clicked
    ... and so on

    When you play back,
    wait for amount of time
    simulate pressing the button
    wait for amount of time
    simulate pressing the button
    ... and so on

    This method will create the smallest size of file possible. becuase you are saving only the actions done not the actual sounds.

    2) Create the wave file as you go
    Well, I don't know how you play the wave sounds right now, so my answer depends on that.
    If you send me your project (you already know my e-mail), I can see what is the best way to do this.

    3) The way I said before in the e-mail I sent you, simply record...
    But I think you have the impression that recording can be done only from outside sources, and that is wrong.

    All you have to do is tell Windows / sound card where to record FROM

    You do this by going into your sound volume, and change to recording, then choose the source:
    See this: http://www.vbforums.com/showpost.php...55&postcount=4

    In your case you have to choose either "record master" or "wave"

  39. #39
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: Sugestions or Comments about my Sound Tutorial

    Michael,

    Thanks for the reply.

    You're right, I was a bit confused (your point #3). Thanks for clarifying that!

    I really like your option #1, given the "light" nature of it. I'll give it a go.

    Thanks again!

    Bryce

  40. #40
    New Member
    Join Date
    Oct 2008
    Posts
    1

    Re: Sugestions or Comments about my Sound Tutorial

    Although being new to sound engineering so to speak, I am not new to VB and I thought the tutorial was very kool, understandable and helped me quite a bit. I am working with a control from MultiMedia Softlabs Soind recorder and Sound Editor and so far it seems pretty easy to use, but your tutorial helped me to understand more of what it was doing under the covers. I would like to use this control and then your tutorial so that I could read the file in memory byte by byte to get the highest peak values (db level) so that I can normalize the file. If you know anything about this tool would be great.

Page 1 of 4 1234 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width