CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2023
    Posts
    4

    code to generate a sine wave

    Could somebody recommend a c++ download to generate a sine wave and play through my PC sound card. I am a complete beginner at this. I have a PC with Visual Studio, a mouse, a keyboard and rudimentary programming knowledge.

  2. #2
    Join Date
    Nov 2018
    Posts
    115

    Re: code to generate a sine wave

    > a c++ download to generate a sine wave and play through my PC sound card
    So how much do you want to skip the actual learning?

    Just downloading an answer, even if you study the source code in detail, is at best 5% as effective as spending a couple of weeks busting a gut getting to grips with all the problems you're likely to face along the way.

    Just reading code is like going to a restaurant, reading the menu and believing you can cook a meal.
    You can't.

  3. #3
    Join Date
    Dec 2023
    Posts
    4

    Re: code to generate a sine wave

    Quote Originally Posted by salem_c View Post
    > a c++ download to generate a sine wave and play through my PC sound card
    So how much do you want to skip the actual learning?

    Just downloading an answer, even if you study the source code in detail, is at best 5% as effective as spending a couple of weeks busting a gut getting to grips with all the problems you're likely to face along the way.

    Just reading code is like going to a restaurant, reading the menu and believing you can cook a meal.
    You can't.
    Thanks for your response.

    My principal problem is the sound card. I've, already managed to code a sine wave. Or at least I believe I have, using a pulse code modulation procedure and mapping out the sine wave with multiple samples etc.
    There are many examples of this across the net.
    I have no understanding of the requirements for converting to analogue sound through my speaker system. That's the problem I need help with.

  4. #4
    Join Date
    Dec 2023
    Posts
    4

    Re: code to generate a sine wave

    I tried a reply with reply with quote without really understanding what that was. Now I've spotted reply to thread, so I'll use this in future.

    Source code shouldn't be a big issue. I've already written code that generates a sine wave using pulse code modulation technique and this works by printing out an endless stream of numbers that correspond. My problem is specifically getting that through the sound card to a produce a pure tone. I simply don't know how to do it. If I can download the answer I might be able to notice the sine wave code and therefore recognise the rest of it.

  5. #5
    Join Date
    Dec 2023
    Posts
    4

    Re: code to generate a sine wave

    I'm looking for first steps, the road forward, the tunnel, the light at the end and the desdination. Can you help.

  6. #6
    Join Date
    Nov 2018
    Posts
    115

    Re: code to generate a sine wave

    Quote Originally Posted by frust1 View Post
    I've already written code that generates a sine wave using pulse code modulation technique and this works by printing out an endless stream of numbers that correspond.
    That's a good start.

    Perhaps these will help you.
    https://stackoverflow.com/questions/...ugh-speakers-c
    https://stackoverflow.com/questions/...sing-win32-api

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

Featured