how can I cut audio to create a new audio? - c#

I want to cut some pieces of an audio to create a new audio with this pieces. What library should I use to get it?
I would like to do it with DirectSound, but I donĀ“t get with it.
Can anybody gives a clue to me about this or says me a library for c# to use?

Take a look at NAudio.
Another option is to use the command line SoX and shell out to it.

Related

How to wrapper ffmpeg to convert video in c#

I want convert video from .wmv to .mp4 in c#. I was search around google and the result is ffmpeg library. But i don't know use it in c#. Please show me solution or source demo for this problem.
There is a number of .NET wrapper libraries for ffmpeg. A quick search gives these results:
Video Converter for .NET
fflib.net
AVBlocks
Another approach may be simply calling the ffmpeg executable from within your application and providing the proper command line arguments. Here is an example
Also, your question could be framed a bit better. Check out how to ask a question

How to make a customized video

I'd like to be able to write some code so that given a name and a video, I can personalize the video with that person's name in it.
Eg, I want to send my family's Christmas message which is a video of us doing silly things and with a video overlay that says Merry Christmas, !
Ideally, I'd like to do this in C#.NET but am open to other technologies if they exist.
Many thanks.
The ffmpeg utility (https://www.ffmpeg.org) can do this type of thing - you should be able to find examples if you Google text or video overlays with ffmpeg:
Overlaying images on a video:
https://video.stackexchange.com/a/12111
https://superuser.com/a/683696
Overlaying text:
https://stackoverflow.com/a/10919953/334402
https://superuser.com/a/701206 (includes a watermark)
The above are all done on the command line. To include them into your c# program you can:
invoke the command line from your program
use a c# wrapper around the ffmpeg command line functionality
Directly use the libraries that ffmpeg uses
The best compromise may be the wrapper option. These exist for different languages and environments, but some examples for c#:
http://www.codeproject.com/Articles/774093/Another-FFmpeg-exe-Csharp-Wrapper
http://www.ffmpeg-csharp.com (this one is not free so check the licence...)

Video editing without media library

Is there a way to edit videos using c# without using a media library eg. Microsoft Expression Encoder etc.
Just need to be able to cut out unwanted parts or insert other videos into a specified time of the original video.
Can I edit the raw video file by perhaps converting it into a binary file and then cutting/pasting the code?
Most video formats have a container and a codec--that might be a good place to start
http://www.pitivi.org/manual/codecscontainers.html
If one were interested in implementing a program modifying video sans libraries a good place to start might be looking at the existing open source video libraries(eg FFMPEG https://www.ffmpeg.org/download.html ) as a reference
No there is no way to edit a video without using anything that would be considered a "library". You either must write your "library" or use a existing 3rd party one.
The only thing that could possibly not be thought of as a "library" is a full external tool that does what you want and your code would just be a front end GUI for it. For example writing a GUI front end for FFmpeg.

Retrieve some part of video without using software. Is it possible?

I am working on a project which is related to videos.
I need to cut part of a video (I want to retrieve that part of video which lies from 00:30:00 to 00:40:00).
I have searched about it and found it can be done by using ffmpeg (This is a command line tool which is used to edit and convert videos.) But I don't want to use any tool.
Is it possible to do this with code, rather then with another tool?
If what you actually want is to build the capability to cut samples out of existing video material into a .net program the splicer project might be what you're looking for.

Sound chords in C#?

I've tried using Console.Beep() at low millisecond rates two play two frequencies 'at once', but the pause between beeps ruins it. I have tried researching it but I've found nothing, and don't know where to start, aside from DirectSound, which I'm looking in to. All I need is to make a program that plays two or more frequencies simultaneously out of one speaker, in C#.
Thanks.
I suggest you look at DirectSound, which has nice .NET bindings. You can use two (or more) Buffer objects and invoke their Play methods to play them simultaneously.
This tutorial shows how to implement a simple drum machine in C# by synthesising sounds on the fly. Hope it helps.
Try looking at using MIDI. This example should get you started. It uses a MIDI library that several people recommend highly.
Console.Beep() is synchronous and does not return until the sound is finished.
Try Simple DirectMedia Layer (SDL.net).
Here's some very simple sample code that will let you play a WAV or MIDI file. This way you can write your code once then just maintain the wav or mid file if you want to make changes to the sound effect.
Play Any Sound File - C# ( Uses DirectX 9.0 for Managed Code )
If you know the frequencies beforehand you can synthesize them into a wave file (audacity or another similar program) and then play the wave file with the SoundPlayer class.
string path = /*path goes here*/;
player = new SoundPlayer(path);
player.Play();
If you need to synthesize them at runtime you would have to write the file by hand. Here's a SO question that you can reference to build the wave files.

Categories