Audio plugins. Mapping MIDI to audio files - c++

I am a reasonably experienced programmer who is pretty inexperienced with C++ and brand new to creating plugins.
Thus far I have looked into http://martinfinke.de/blog/tags/making_audio_plugins.html but it seems incredibly dated, I'm hitting a whole load of compilation issues and don't know where to get the legacy SDKs which would mean I had the exact same set up that the author is using.
I have also looked into JUCE but there isn't a vast amount of resources out there that I can find.
What I am trying to do is create a plugin, VST only for now (will look at compatibility with other vendors later) which simply maps a MIDI input to an audio file which my partner, who is a sound engineer, has already created. We have enough samples for randomising and also various velocities

I highly recommend just working your way through the JUCE Tutorials or watching through the JUCE videos by The Audio Programmer on Youtube to get you started on JUCE. Whilst the first tutorials do not produce audio plugins, the components used within them are crucial 'building blocks' to creating a full plugin.
When you're happy with creating basic GUI elements and how audio can be played/ synthesised within both the Audio App and Audio Plug-In projects, I recommend you try building the smallest part of your plugin you can and, getting that working and slowly building upon it. I suggest starting with how to load an audio file into the buffer (take a look at the looping audio tutorial) as once that is complete it is just a case of using the tutorials again to create and handle the MIDI data.

Related

How can I control and receive video stream from SITL drone using px4,gazebo and C++ without using ROS?

I want to program a drone to fly with a C++ project using image processing analysis in real-time (using OpenCV). I want to do it with PX4, Gazebo simulator. The final goal is to run the project on a real
drone using Jetson-Nano and Pixhawk drone.
I have 2 main problems.
I can't manage to get the video stream of the px4 drone models without using ROS. I have followed this official guide to install the relevant software (Gazebo, Px4, GCS).
For python we have Drone-kit library to control the drone, but I want to use C++ for my project. what are the alternatives tools instead of the Drone-kit to control drones with C++ and how I can receive the video stream from the gazebo px4 drone?
After that I tried to search for information online for hours and go through the documentations, I could not find a suitable guide or solution.
thanks.
Posting this as an answer after details in the comments made things more clear.
For an application like this ROS should most definitely be used. It comes with a wide range of pre-built packages and tools to enable easy localization and navigation. When looking at UAVs the MoveIt! package is a good place to look. It handles 3D navigation and has a few UAV implementations already. The Hector Quadcopter package is another good option for something like SLAM.

Techniques to master about implementing a network player

I have a final project abount database design this semester. And my teacher gives us many tasks for alternatives, such as Student Information Management System, Airline Reservation System and so on. However, I want to design such a player that it allows users to upload their own works and share together. Of course it also provides download service. I'm a sophomore this year. I'm familiar with c++ programming, but do not know much about network programming. Furthermore, I learnt T-SQL this semester and also did some works on MySQL in java(course in this semester, too). My idea is here (I have drew a picture):http://tmjfzy.blog.163.com/blog/static/66447025201242553045/
I need some advice about network programming. Could you give me some to help me realize my imagination? Thank you :-).
So, you're basically reinventing YouTube but with dedicated client?
Actually it's very easy to start without any clients or C++ : all you need is a server with MySQL, Apache and PHP. I recommend WAMP server if you're on Windows. FlowPlayer is a flash video player quite easy to integrate, but today using HTML5 video features should be a better idea. I believe you can have the reference Web system up and running in about 3 to 6 days.
(I'm also a C++ programmer and I had no problem with learning enough HTML, PHP and JavaScript to do very similar thing ).
Once you have a system up and running (possibly with limitation on video file format) you can design and implement API. From server side it's nothing more than PHP files, just returning data in your format of choice (eg. JSon, XML) instead of generating HTML.
With server-side API done, you can start working on client. Registration, login, upload from file and download to file should go first. Once the client can get the video files, you can implement a player. A streaming player goes next. If you encounter problems with playing back the video files, this is good moment to break compatibility with web version and change video file format. Now that you know what playback formats are supported, you might implement converting before upload. (Conversion makes sense if you want to have all files on server in one format. Otherwise it's not really usefull: if a client can convert a video, it should be able to play it back. This means all other clients also should understand the format and be able to play it back.)
At this point you can consider rewriting the server. Or other student can be writing the server in the same time as you're busy with client.
Having working Apache-PHP reference all the time makes such parallelism a breeze.
All the above requires using HTTP as underlying protocol. I think Qt has built in support. If not you can use some library (like cURL) or implement it from scratch on sockets.
Eventually streaming, like RTP+RTSP, can be added for playback.
If you feel really adventurous, you can start designing your own protocol, but this is the very last step, after having both own client and own server working flawlessly on hand-implemented HTTP.

Simple C++ Sound API

My commercial embedded C++ Linux project requires playing wav files and tones at individual volume levels concurrently. A few examples of the sounds:
• “Click” sounds each time user presses screen played at a user-specified volume
• Warning sounds played at max-volume
• Warning tones requested by other applications at app-specified volume level (0-100%)
• Future support for MP3 player and/or video playback (with sound) at user-specified volume. All other sounds should continue while song/video is playing.
We're using Qt as our UI framework which has QtMultimedia and Phonon support. However, I heard the former has spotty sound support on Linux and the latter is an older version and may be deprecated in an upcoming Qt release.
I've done some research and here are a few APIs I've come across:
KDE Phonon
SFML
PortAudio
SDL_Mixer
OpenAL Soft
FMOD (though I'd prefer to avoid license fees)
ALSA (perhaps a bit too low-level...)
Other considerations:
Cross-platform isn't required but preferred. We'd like to limit dependencies as much as possible. There is no need for advanced features like 3D audio or special effects in the foreseeable future. My team doesn't have much audio experience so ease-of-use is important.
Are any of these overkill for my application? Which seems like the best fit?
Update:
It turns out we were already dependent on SDL for other reasons so we decided on SDL_Mixer. For other Embedded applications, however, I'd take a long at the PortAudio/libsndfile combo as well due to their minimal dependencies.
libao is simple, cross-platform, Xiphy goodness.
There's documentation too!
Usage is outlined here - simple usage goes like this:
Initialize (ao_initialize())
Call ao_open_live() or ao_open_file()
Play sound using ao_play()
Close device/file using ao_close() and then ao_shutdown() to clean up.
Go for PortAudio. For just plain audio without unneeded overhead such as complex streaming pipelines, or 3D, it is the best lib out there. In addition you have really nice cross-platform support. It is used by several professional audio programs and has really high quality.
i have used SDL_Mixer time and time again, lovely library, it should serve well for your needs, the license is flexible and its heavily documented. i have also experimented with SFML, while more modern and fairly documented, i find it a bit bulky and cumbersome to work with even tho both libraries are very similar. imo SDL_Mixer is the best.
however you might also want to check out this one i found a few weeks ago http://www.mpg123.de/, i haven't delved too much into it, but it is very lightweight and again the license is flexible.
There is a sound library called STK that would meet most of your requirements:
https://ccrma.stanford.edu/software/stk/faq.html
Don't forget about:
FFmpeg: is a complete, cross-platform solution to record, convert and stream audio and video.
GStreamer: is a library for constructing graphs of media-handling components. The applications it supports range from simple Ogg/Vorbis playback, audio/video streaming to complex audio (mixing) and video (non-linear editing) processing.

Sound output through M-Audio ProFire 610

I got an assignment at work to create a system which will be able to direct sound to different output channels of our sound card. We are using M-Audio ProFire 610, which has 8 channel output and connects through FireWire. We are also using a Mac Mini as our host server and I'm gonna be working in Xcode.
This is the diagram of what I am building:
diagram http://img121.imageshack.us/img121/7865/diagramy.png
At first I thought that Java will be enough for this project, however later on I discovered that Java is not able to push sound to other than default output channels of the sound card so I decided to switch to C++. The problem is that I am a web developer and I don't have any experience in this language whatsoever - that is why I am looking for help from more experienced developers.
I found a Core Audio Primer for ios4 but not sure how much of it I can use for my project. I find it a bit confusing, too.
What steps should I take to complete this assignment? What frameworks should I use? Any code examples? I am looking for any help, hints, tips - well anything that will help me complete this project.
If you're just looking for audio pass-through, you might want to look at something that's already been built, like Jack which creates a software audio device that looks and works just like a real one (you can set it as default output for your app) and then allows you to route each channel anywhere you want (including to other applications).
If you want/need to make your own, definitely go with C++, for which there are many many tutorials (I learned from cplusplus.com). CoreAudio is the low-level C/C++ interface as Justin mentioned, but it's really hard to learn and use. A much simpler API is provided by PortAudio, for which I've worked a bit on the Mac implementation. Look at the tutorials there, make something similar for default input and output, and then to do the channel mapping use PaMacCore_SetupChannelMap, which is described here. You'll need to call it twice, once for the input stream and once for the output stream. Join the mailing list for PortAudio if you need more advice! Good luck!
the primary APIs are at CoreAudio/AudioHardware.h
most of the samples/supporting code provided by apple is in C++. however, the APIs are totally C (don't know if that helps you or not).
you'll want to access the Hardware Abstraction Layer (aka HAL), more details in this doc:
http://developer.apple.com/documentation/MusicAudio/Conceptual/CoreAudioOverview/CoreAudioOverview.pdf
for (a rather significant amount of) additional samples/usage, see $DEVELOPER_DIR/Extras/CoreAudio/

Receive mic input and process

I am writing a small program in C++ that receives mic input and does some simple live audio processing. I have been looking around and the only things I have been able to find that work on Linux are PortAudio, QAudioInput, and fmod.
I am trying to stay away from any super low level programming and use a minimal amount of lines.
Which one of these would fit my needs best?
Check out JUCE. Juce will build on many platforms. JUCE does a lot more than just audio, but it was made with audio programmers in mind. Look at he JUCE demo application and then just chop up the source code from the audio demo to suit your needs. The API documentation is really good also. The abstraction from the low level stuff is good.