Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

How to create music in C++ from scratch (MIDI file format) / C++11 variadic templates example

c++

c++11

c++0x

gcc

linux

live

computer

programming

midi

example

source

code

chord

melody

note

music

synthesis

track

Автор: Bisqwit

Загружено: 21 окт. 2010 г.

Просмотров: 92 479 просмотров

Описание:

In this tool-assisted education video, I demonstrate how to write a program that creates a MIDI file from scratch. Some basics on how to write music in a computer program are shown. You see me type every line.

Twitter:   / realbisqwit  
Patreon:   / bisqwit   (alternatives at https://iki.fi/bisqwit/donate.html)
Twitch:   / realbisqwit  
Homepage: https://iki.fi/bisqwit/

MIDI is described in detail in Wikipedia, but put very shortly (and not entirely accurately), its best analogy is in sheet music rather than in an mp3 file. To play MIDI files, you need a synthesizer. There are computer synthesizer programs for various operating systems. In this video, I used an AdLib synthesizer for DOS that I wrote once -- apologies about that -- because I still could not figure out how to record audio from Linux synced to DOSBox's speed, or how to hook TiMidity++ into DOSBox, and DOSBox does not yet even emulate MPU-401 to begin with.
The loopBegin and loopEnd tags are only supported by two MIDI players that I know: FMDRV, which I have created (seen in this video), and Final Fantasy VII by Square Enix. I hold it in a standard's esteem.

Also, as a peculiar quirk, I happen to be running Linux under DOS in this video. I wrote a Linux emulator for DOS using Borland C++ ;-)
Actually, what I wrote is just a (very fast and accurate) terminal emulator; the "simulated" Linux is actually the host computer under which the DOSBox instance runs.
The MHz/GHz rating at the bottom of the screen is the speed by which the CPU emulated by DOSBox runs. I adjust it occasionally during the recording (to make it possible for me to type a long piece of text in a very short time), and the rating is updated in real time.
Also, it is only faintly seen, but I launch a FreeDOS shell at one point. It is why you see two different kind of "DIR" responses in the video.
My editor of choice is neither Vi nor Emacs, but Joseph Allen's Joe. Normally I use 256-color xterm, but here I am running under 16-color DOS and VGA text mode, so the 256-colorness is only emulated by dynamically remapping the palette on demand.
As another peculiar quirk, my Linux "emulator" sets up a 51-line text mode by adding one extra line of text to the screen. Incidentally, I discovered, this mode has a screen resolution of 720x408, which makes it very close to the aspect ratio of 16:9 with square pixels. Hence I set the video aspect ratio to 16:9 rather than VGA's actual ratio, 4:3.

This is the first programming example for which I did not print a script beforehand. I planned and created this entirely in one evening. Therefore there is no PDF to download. But you can download the MIDI file produced by the program, here: https://bisqwit.iki.fi/jutut/kuvat/pr... (it is my original composition).
The source code that I typed in this video can be downloaded here:
https://bisqwit.iki.fi/jutut/kuvat/pr...

You can find the DOSBox Linux terminal hack here:
-- https://bisqwit.iki.fi/src/patch-dosb... -- This patch must be applied into DOSBox.
-- https://bisqwit.iki.fi/src/linux_for_... -- This is the terminal program that is run in DOSBox. Note that it uses hard-coded Finnish keyboard layout. It requires that DOSBox is patched using the above patch.

How to create music in C++ from scratch (MIDI file format) / C++11 variadic templates example

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

Offloading & CUDA: Parallelism in C++ #3/3 (also OpenMP, OpenACC, GPU & Coprocessors like Xeon Phi)

Offloading & CUDA: Parallelism in C++ #3/3 (also OpenMP, OpenACC, GPU & Coprocessors like Xeon Phi)

Programming Arduino in C++11 -- ROM dumping

Programming Arduino in C++11 -- ROM dumping

Но что такое нейронная сеть? | Глава 1. Глубокое обучение

Но что такое нейронная сеть? | Глава 1. Глубокое обучение

Writing a Tetris clone in GW-BASIC -- Tandy 1000 programming example

Writing a Tetris clone in GW-BASIC -- Tandy 1000 programming example

SIMD and Vectorization: Parallelism in C++ #1/3 (multitasking on single core)

SIMD and Vectorization: Parallelism in C++ #1/3 (multitasking on single core)

Programming ▫️ Coding ▫️ Hacking ▫️ Designing Music 🦠

Programming ▫️ Coding ▫️ Hacking ▫️ Designing Music 🦠

How I got Mario in That Editor — And how Norton Got 🐁

How I got Mario in That Editor — And how Norton Got 🐁

ВОССТАНОВЛЕНИЕ НЕРВНОЙ СИСТЕМЫ 🌸 Нежная музыка, успокаивает нервную систему и радует душу #6

ВОССТАНОВЛЕНИЕ НЕРВНОЙ СИСТЕМЫ 🌸 Нежная музыка, успокаивает нервную систему и радует душу #6

Mega Hits 2024 🌱 The Best Of Vocal Deep House Music Mix 2024 🌱 Summer Music Mix 2024 #268

Mega Hits 2024 🌱 The Best Of Vocal Deep House Music Mix 2024 🌱 Summer Music Mix 2024 #268

Justified Programming — Reason Parameters That Answer “Why”

Justified Programming — Reason Parameters That Answer “Why”

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]