Added a default website

This commit is contained in:
fls 2026-07-15 13:44:55 -03:00
parent d3d55f96f7
commit 1a8c9147b8
34 changed files with 2420 additions and 0 deletions

25
404.html Normal file
View File

@ -0,0 +1,25 @@
---
permalink: /404.html
layout: page
---
<style type="text/css" media="screen">
.container {
margin: 10px auto;
max-width: 600px;
text-align: center;
}
h1 {
margin: 30px 0;
font-size: 4em;
line-height: 1;
letter-spacing: -1px;
}
</style>
<div class="container">
<h1>404</h1>
<p><strong>Page not found :(</strong></p>
<p>The requested page could not be found.</p>
</div>

33
Gemfile Normal file
View File

@ -0,0 +1,33 @@
source "https://rubygems.org"
# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#
# bundle exec jekyll serve
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
gem "jekyll", "~> 4.4.1"
# This is the default theme for new Jekyll sites. You may change this to anything you like.
gem "minima", "~> 2.5"
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
# gem "github-pages", group: :jekyll_plugins
# If you have any plugins, put them here!
group :jekyll_plugins do
gem "jekyll-feed", "~> 0.12"
end
# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
# and associated library.
platforms :mingw, :x64_mingw, :mswin, :jruby do
gem "tzinfo", ">= 1", "< 3"
gem "tzinfo-data"
end
# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1", :platforms => [:mingw, :x64_mingw, :mswin]
# Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem
# do not have a Java counterpart.
gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby]

250
Gemfile.lock Normal file
View File

@ -0,0 +1,250 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.9.0)
public_suffix (>= 2.0.2, < 8.0)
base64 (0.3.0)
bigdecimal (4.1.2)
colorator (1.1.0)
concurrent-ruby (1.3.7)
csv (3.3.5)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
eventmachine (1.2.7)
ffi (1.17.4)
ffi (1.17.4-aarch64-linux-gnu)
ffi (1.17.4-aarch64-linux-musl)
ffi (1.17.4-arm-linux-gnu)
ffi (1.17.4-arm-linux-musl)
ffi (1.17.4-arm64-darwin)
ffi (1.17.4-x86-linux-gnu)
ffi (1.17.4-x86-linux-musl)
ffi (1.17.4-x86_64-darwin)
ffi (1.17.4-x86_64-linux-gnu)
ffi (1.17.4-x86_64-linux-musl)
forwardable-extended (2.6.0)
google-protobuf (4.35.1)
bigdecimal
rake (~> 13.3)
google-protobuf (4.35.1-aarch64-linux-gnu)
bigdecimal
rake (~> 13.3)
google-protobuf (4.35.1-aarch64-linux-musl)
bigdecimal
rake (~> 13.3)
google-protobuf (4.35.1-arm64-darwin)
bigdecimal
rake (~> 13.3)
google-protobuf (4.35.1-x86-linux-gnu)
bigdecimal
rake (~> 13.3)
google-protobuf (4.35.1-x86-linux-musl)
bigdecimal
rake (~> 13.3)
google-protobuf (4.35.1-x86_64-darwin)
bigdecimal
rake (~> 13.3)
google-protobuf (4.35.1-x86_64-linux-gnu)
bigdecimal
rake (~> 13.3)
google-protobuf (4.35.1-x86_64-linux-musl)
bigdecimal
rake (~> 13.3)
http_parser.rb (0.8.1)
i18n (1.15.2)
concurrent-ruby (~> 1.0)
jekyll (4.4.1)
addressable (~> 2.4)
base64 (~> 0.2)
colorator (~> 1.0)
csv (~> 3.0)
em-websocket (~> 0.5)
i18n (~> 1.0)
jekyll-sass-converter (>= 2.0, < 4.0)
jekyll-watch (~> 2.0)
json (~> 2.6)
kramdown (~> 2.3, >= 2.3.1)
kramdown-parser-gfm (~> 1.0)
liquid (~> 4.0)
mercenary (~> 0.3, >= 0.3.6)
pathutil (~> 0.9)
rouge (>= 3.0, < 5.0)
safe_yaml (~> 1.0)
terminal-table (>= 1.8, < 4.0)
webrick (~> 1.7)
jekyll-feed (0.17.0)
jekyll (>= 3.7, < 5.0)
jekyll-sass-converter (3.1.0)
sass-embedded (~> 1.75)
jekyll-seo-tag (2.9.0)
jekyll (>= 3.8, < 5.0)
jekyll-watch (2.2.1)
listen (~> 3.0)
json (2.21.1)
kramdown (2.5.2)
rexml (>= 3.4.4)
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.4)
listen (3.10.0)
logger
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.7.0)
mercenary (0.4.0)
minima (2.5.2)
jekyll (>= 3.5, < 5.0)
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (7.0.5)
rake (13.4.2)
rb-fsevent (0.11.2)
rb-inotify (0.11.1)
ffi (~> 1.0)
rexml (3.4.4)
rouge (4.7.0)
safe_yaml (1.0.5)
sass-embedded (1.101.0)
google-protobuf (~> 4.31)
rake (>= 13)
sass-embedded (1.101.0-aarch64-linux-android)
google-protobuf (~> 4.31)
sass-embedded (1.101.0-aarch64-linux-gnu)
google-protobuf (~> 4.31)
sass-embedded (1.101.0-aarch64-linux-musl)
google-protobuf (~> 4.31)
sass-embedded (1.101.0-arm-linux-androideabi)
google-protobuf (~> 4.31)
sass-embedded (1.101.0-arm-linux-gnueabihf)
google-protobuf (~> 4.31)
sass-embedded (1.101.0-arm-linux-musleabihf)
google-protobuf (~> 4.31)
sass-embedded (1.101.0-arm64-darwin)
google-protobuf (~> 4.31)
sass-embedded (1.101.0-riscv64-linux-android)
google-protobuf (~> 4.31)
sass-embedded (1.101.0-riscv64-linux-gnu)
google-protobuf (~> 4.31)
sass-embedded (1.101.0-riscv64-linux-musl)
google-protobuf (~> 4.31)
sass-embedded (1.101.0-x86_64-darwin)
google-protobuf (~> 4.31)
sass-embedded (1.101.0-x86_64-linux-android)
google-protobuf (~> 4.31)
sass-embedded (1.101.0-x86_64-linux-gnu)
google-protobuf (~> 4.31)
sass-embedded (1.101.0-x86_64-linux-musl)
google-protobuf (~> 4.31)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
unicode-display_width (2.6.0)
webrick (1.9.2)
PLATFORMS
aarch64-linux-android
aarch64-linux-gnu
aarch64-linux-musl
arm-linux-androideabi
arm-linux-gnu
arm-linux-gnueabihf
arm-linux-musl
arm-linux-musleabihf
arm64-darwin
riscv64-linux-android
riscv64-linux-gnu
riscv64-linux-musl
ruby
x86-linux-gnu
x86-linux-musl
x86_64-darwin
x86_64-linux-android
x86_64-linux-gnu
x86_64-linux-musl
DEPENDENCIES
http_parser.rb (~> 0.6.0)
jekyll (~> 4.4.1)
jekyll-feed (~> 0.12)
minima (~> 2.5)
tzinfo (>= 1, < 3)
tzinfo-data
wdm (~> 0.1)
CHECKSUMS
addressable (2.9.0) sha256=7fdf6ac3660f7f4e867a0838be3f6cf722ace541dd97767fa42bc6cfa980c7af
base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd
bundler (4.0.15) sha256=a4ceb882fe94a0e0ac63cd0813932bbfd631a14e5ac0b7975189b19a4d28d9e7
colorator (1.1.0) sha256=e2f85daf57af47d740db2a32191d1bdfb0f6503a0dfbc8327d0c9154d5ddfc38
concurrent-ruby (1.3.7) sha256=4412caec3a5ea2e5fdc52076724c071a81f2c0593d83b2ac8cbb8ca63b3151b0
csv (3.3.5) sha256=6e5134ac3383ef728b7f02725d9872934f523cb40b961479f69cf3afa6c8e73f
em-websocket (0.5.3) sha256=f56a92bde4e6cb879256d58ee31f124181f68f8887bd14d53d5d9a292758c6a8
eventmachine (1.2.7) sha256=994016e42aa041477ba9cff45cbe50de2047f25dd418eba003e84f0d16560972
ffi (1.17.4) sha256=bcd1642e06f0d16fc9e09ac6d49c3a7298b9789bcb58127302f934e437d60acf
ffi (1.17.4-aarch64-linux-gnu) sha256=b208f06f91ffd8f5e1193da3cae3d2ccfc27fc36fba577baf698d26d91c080df
ffi (1.17.4-aarch64-linux-musl) sha256=9286b7a615f2676245283aef0a0a3b475ae3aae2bb5448baace630bb77b91f39
ffi (1.17.4-arm-linux-gnu) sha256=d6dbddf7cb77bf955411af5f187a65b8cd378cb003c15c05697f5feee1cb1564
ffi (1.17.4-arm-linux-musl) sha256=9d4838ded0465bef6e2426935f6bcc93134b6616785a84ffd2a3d82bc3cf6f95
ffi (1.17.4-arm64-darwin) sha256=19071aaf1419251b0a46852abf960e77330a3b334d13a4ab51d58b31a937001b
ffi (1.17.4-x86-linux-gnu) sha256=38e150df5f4ca555e25beca4090823ae09657bceded154e3c52f8631c1ed72cf
ffi (1.17.4-x86-linux-musl) sha256=fbeec0fc7c795bcf86f623bb18d31ea1820f7bd580e1703a3d3740d527437809
ffi (1.17.4-x86_64-darwin) sha256=aa70390523cf3235096cf64962b709b4cfbd5c082a2cb2ae714eb0fe2ccda496
ffi (1.17.4-x86_64-linux-gnu) sha256=9d3db14c2eae074b382fa9c083fe95aec6e0a1451da249eab096c34002bc752d
ffi (1.17.4-x86_64-linux-musl) sha256=3fdf9888483de005f8ef8d1cf2d3b20d86626af206cbf780f6a6a12439a9c49e
forwardable-extended (2.6.0) sha256=1bec948c469bbddfadeb3bd90eb8c85f6e627a412a3e852acfd7eaedbac3ec97
google-protobuf (4.35.1) sha256=a3a6471331d918f58dfa4d014a8f6286f0af2cf4840216bde52fcf2ea3fe3726
google-protobuf (4.35.1-aarch64-linux-gnu) sha256=50ca44d0eeff3f8475e630a1accdd974256f3510694d574e2c9d6119ea8bc9e1
google-protobuf (4.35.1-aarch64-linux-musl) sha256=d5c65cef6bd6498a9e5ed5f88cf6cf7e341c10b0a005e32137d5d1a2b6e8c18a
google-protobuf (4.35.1-arm64-darwin) sha256=d9c957df04fa89c749fa9a72a7b383eb4296efc9b2303dc6fd6fbe39c698ad6b
google-protobuf (4.35.1-x86-linux-gnu) sha256=cc7492566b27ad8b5dfa3a7b6f9b11e905050cc53c2fa8ff22de375a9e7a70fb
google-protobuf (4.35.1-x86-linux-musl) sha256=ab403790b59e4dc588ffbed1eaacf05d4ca2f0d12ac9c13d6c64e69380d8c99e
google-protobuf (4.35.1-x86_64-darwin) sha256=66b62b4df00931018a692806df66393efa960d6d2b7da69735187249f950d3ee
google-protobuf (4.35.1-x86_64-linux-gnu) sha256=c786439087512a3fbd199e9897d265b855f951d4027e218ea55e858d45969edd
google-protobuf (4.35.1-x86_64-linux-musl) sha256=91890eb0002934a339fdb7d77a147c46b7474b6799db27872b747b905837f744
http_parser.rb (0.8.1) sha256=9ae8df145b39aa5398b2f90090d651c67bd8e2ebfe4507c966579f641e11097a
i18n (1.15.2) sha256=00f9eb62412fe593b2a65a97daa75300d37abb8f7202ec748e94b6d46a9dd1b5
jekyll (4.4.1) sha256=4c1144d857a5b2b80d45b8cf5138289579a9f8136aadfa6dd684b31fe2bc18c1
jekyll-feed (0.17.0) sha256=689aab16c877949bb9e7a5c436de6278318a51ecb974792232fd94d8b3acfcc3
jekyll-sass-converter (3.1.0) sha256=83925d84f1d134410c11d0c6643b0093e82e3a3cf127e90757a85294a3862443
jekyll-seo-tag (2.9.0) sha256=0260015a8e1df9bf195cdfb0c675b7b2883fd8cbf12556e1c1cbe36a831c6852
jekyll-watch (2.2.1) sha256=bc44ed43f5e0a552836245a54dbff3ea7421ecc2856707e8a1ee203a8387a7e1
json (2.21.1) sha256=13a43df75d95641443f5702dff350f237164a9d811ff0f2c2800d4d980220583
kramdown (2.5.2) sha256=1ba542204c66b6f9111ff00dcc26075b95b220b07f2905d8261740c82f7f02fa
kramdown-parser-gfm (1.1.0) sha256=fb39745516427d2988543bf01fc4cf0ab1149476382393e0e9c48592f6581729
liquid (4.0.4) sha256=4fcfebb1a045e47918388dbb7a0925e7c3893e58d2bd6c3b3c73ec17a2d8fdb3
listen (3.10.0) sha256=c6e182db62143aeccc2e1960033bebe7445309c7272061979bb098d03760c9d2
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
mercenary (0.4.0) sha256=b25a1e4a59adca88665e08e24acf0af30da5b5d859f7d8f38fba52c28f405138
minima (2.5.2) sha256=9c434e3b7bc4a0f0ab488910438ed3757a0502ff1060d172f361907fc38aa45a
pathutil (0.16.2) sha256=e43b74365631cab4f6d5e4228f812927efc9cb2c71e62976edcb252ee948d589
public_suffix (7.0.5) sha256=1a8bb08f1bbea19228d3bed6e5ed908d1cb4f7c2726d18bd9cadf60bc676f623
rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
rb-fsevent (0.11.2) sha256=43900b972e7301d6570f64b850a5aa67833ee7d87b458ee92805d56b7318aefe
rb-inotify (0.11.1) sha256=a0a700441239b0ff18eb65e3866236cd78613d6b9f78fea1f9ac47a85e47be6e
rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142
rouge (4.7.0) sha256=dba5896715c0325c362e895460a6d350803dbf6427454f49a47500f3193ea739
safe_yaml (1.0.5) sha256=a6ac2d64b7eb027bdeeca1851fe7e7af0d668e133e8a88066a0c6f7087d9f848
sass-embedded (1.101.0) sha256=57dbc3409e2c0a2c581a4c9945c2bd72ec88e71ec98017bd02dd1da8a76b22f4
sass-embedded (1.101.0-aarch64-linux-android) sha256=ad0a35c6ff5cdc4e31c5d8261a768ef460c6c7d1458081183e42170e1474c4b5
sass-embedded (1.101.0-aarch64-linux-gnu) sha256=8f6926349e880dbb4fda75fb182086fb60aa821b756bcbfc8e5b2b23b1f269d6
sass-embedded (1.101.0-aarch64-linux-musl) sha256=0a02b4b75db305160db1b0512f040762242128a9b5c01b0fa7a504f2b24557f2
sass-embedded (1.101.0-arm-linux-androideabi) sha256=88e762531f90d4a2eef55ffafeba337585e1bb24b22307ebd7fe5505de9a4476
sass-embedded (1.101.0-arm-linux-gnueabihf) sha256=358df7f98d13ff53739ebc45f5c5acd4dd96833bf87f39c74d11f798081d4158
sass-embedded (1.101.0-arm-linux-musleabihf) sha256=d993a3ad017250d46d1312bc10cfded5ab4585906d37a60a56494bd662182d3a
sass-embedded (1.101.0-arm64-darwin) sha256=9fed684380b49499dfc856aba0d026a0748f924bd78044ffff2bae1537aea73e
sass-embedded (1.101.0-riscv64-linux-android) sha256=1bd35527e1ca24af6aa2ba9db797bc9b72331ebbec9ff6e99ea02b24f83b3da1
sass-embedded (1.101.0-riscv64-linux-gnu) sha256=7805a249ed4c31b58b2f7d054d14f0ed24c61a836f579cd76ed2367088142bcf
sass-embedded (1.101.0-riscv64-linux-musl) sha256=8bd60eb9ebe6f9f2740a4e9ddb792a3db1fbba282e3375103844b4979eb7c731
sass-embedded (1.101.0-x86_64-darwin) sha256=20ff4afd7c052b3f8d7b4abe511e8114985a07dff7616750a43ee1fc2759fb28
sass-embedded (1.101.0-x86_64-linux-android) sha256=472b72114ededa00a22e13553dd31f98d1a92d52bdbe2e738a4dbac2dd50c779
sass-embedded (1.101.0-x86_64-linux-gnu) sha256=ff48452b2351eaaf4e6e02f59de0e9e35f6f163e8456d520db49b4d87cf73c27
sass-embedded (1.101.0-x86_64-linux-musl) sha256=2286feef3c7a8d9bbb075aa1651e1a81942aca1213f7c2d30cc1d6f4eb5b4104
terminal-table (3.0.2) sha256=f951b6af5f3e00203fb290a669e0a85c5dd5b051b3b023392ccfd67ba5abae91
unicode-display_width (2.6.0) sha256=12279874bba6d5e4d2728cef814b19197dbb10d7a7837a869bab65da943b7f5a
webrick (1.9.2) sha256=beb4a15fc474defed24a3bda4ffd88a490d517c9e4e6118c3edce59e45864131
BUNDLED WITH
4.0.15

67
_config.yml Normal file
View File

@ -0,0 +1,67 @@
# Welcome to Jekyll!
#
# This config file is meant for settings that affect your whole blog, values
# which you are expected to set up once and rarely edit after that. If you find
# yourself editing this file very often, consider using Jekyll's data files
# feature for the data you need to update frequently.
#
# For technical reasons, this file is *NOT* reloaded automatically when you use
# 'bundle exec jekyll serve'. If you change this file, please restart the server process.
#
# If you need help with YAML syntax, here are some quick references for you:
# https://learn-the-web.algonquindesign.ca/topics/markdown-yaml-cheat-sheet/#yaml
# https://learnxinyminutes.com/docs/yaml/
#
# Site settings
# These are used to personalize your new site. If you look in the HTML files,
# you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
# You can create any custom variable you would like, and they will be accessible
# in the templates via {{ site.myvariable }}.
title: Diretório de exemplos de computação musical
#email: your-email@example.com
description: >- # this means to ignore newlines until "baseurl:"
Este site guarda exemplos de código de computação musical. Aproveite!
baseurl: "" # the subpath of your site, e.g. /blog
url: "" # the base hostname & protocol for your site, e.g. http://example.com
#twitter_username: jekyllrb
#github_username: jekyll
# Build settings
theme: minima
plugins:
- jekyll-feed
collections:
examples:
output: true
defaults:
- scope:
path: "" # Applies across the directory
type: "examples" # The plural label of your collection
values:
layout: "code" #null # Sets the default HTML layout
render_code: true # Example custom variable
processed: true
permalink: /:collection/:path.html
# Exclude from processing.
# The following items will not be processed, by default.
# Any item listed under the `exclude:` key here will be automatically added to
# the internal "default list".
#
# Excluded items can be processed by explicitly listing the directories or
# their entries' file path in the `include:` list.
#
# exclude:
# - .sass-cache/
# - .jekyll-cache/
# - gemfiles/
# - Gemfile
# - Gemfile.lock
# - node_modules/
# - vendor/bundle/
# - vendor/cache/
# - vendor/gems/
# - vendor/ruby/

76
_examples/c/2wav.c Normal file
View File

@ -0,0 +1,76 @@
---
author: "Flávio Schiavoni"
description: Hey!
---
/*
Criado por {{ page.author }}
Disponível em {{ page.url }}
*/
#include <sys/stat.h>
#include <string.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <fcntl.h>
int main(int argc, char ** argv){
if(argc < 4){
printf("Usage:\n");
printf("%s sample_rate bit_depth\n", argv[0]);
exit(0);
}
char * filename = malloc(strlen(argv[1]));
strcpy(filename, argv[1]);
struct stat st;
stat(filename, &st);
uint32_t size = st.st_size; //limita o tamanho do arquivo!
printf("filesize: %d\n", size);
// Read file data
char * buffer = 0;
FILE * f = fopen (filename, "rb");
buffer = malloc(size);
fread (buffer, 1, size, f);
fclose (f);
char * newfilename = malloc(strlen(argv[1] + 4));
strcpy(newfilename, filename);
strcat(newfilename, ".wav");
FILE *fp = fopen(newfilename,"wb+");
fwrite("RIFF", 1, 4, fp);
int newsize = size + 32; // file size - 8
fwrite(&newsize, 1, sizeof(newsize), fp);
fwrite("WAVE", 1, 4, fp);
fwrite("fmt ", 1, 4, fp);
int flag = 16; // chunk size
fwrite(&flag, 1, 4, fp);
flag = 1; // compression code
fwrite(&flag, 1, 2, fp);
flag = 1; // number of channels
fwrite(&flag, 1, 2, fp);
flag = atoi(argv[2]); // sample rate
fwrite(&flag, 1, 4, fp);
flag = flag * atoi(argv[3]) / 8; // bytes per second
fwrite(&flag, 1, 4, fp);
flag = atoi(argv[3]) / 8; // block align
fwrite(&flag, 1, 2, fp);
flag = atoi(argv[3]); // significant bits per sample
fwrite(&flag, 1, 2, fp);
fwrite("data", 1, 4, fp);
fwrite(&size, 1, 4, fp);
fwrite(buffer, 1, size, fp);
fclose(fp);
}

71
_examples/c/alsamidi.c Normal file
View File

@ -0,0 +1,71 @@
---
author: "Flávio Schiavoni"
description: O bladi!
---
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <alsa/asoundlib.h>
int keep_walking;
static void sigint_handler(int i){
keep_walking = 0;
}
int main(int argc, char *argv[]) {
int note_time = 1000000; // 1 segundo (em microsegundos)
// Pega o Ctrl+C ou signal de Kill para a aplicação.
signal(SIGINT, &sigint_handler);
signal(SIGTERM, &sigint_handler);
keep_walking = 1;
// Crio o dispositivo MIDI
snd_seq_t *seq_handle;
int portid;
if (snd_seq_open(&seq_handle, "hw", SND_SEQ_OPEN_DUPLEX, 0) < 0) {
fprintf(stderr, "Error opening ALSA sequencer.\n");
exit(1);
}
snd_seq_set_client_name(seq_handle, "My App Midi");
if ((portid = snd_seq_create_simple_port(seq_handle, "My Midi Port",
SND_SEQ_PORT_CAP_READ|SND_SEQ_PORT_CAP_SUBS_READ,
SND_SEQ_PORT_TYPE_APPLICATION)) < 0) {
fprintf(stderr, "Error creating sequencer port.\n");
exit(1);
}
snd_seq_event_t ev;
snd_seq_ev_clear(&ev);
snd_seq_ev_set_source(&ev, 0);
snd_seq_ev_set_subs(&ev);
snd_seq_ev_set_direct(&ev);
while (keep_walking) {
// Note on
snd_seq_ev_set_noteon(&ev, 0, 60, 127);
snd_seq_event_output(seq_handle, &ev);
snd_seq_drain_output(seq_handle);
// Duration
usleep(note_time);
// Note off
snd_seq_ev_set_noteoff(&ev, 0, 60, 0);
snd_seq_event_output(seq_handle, &ev);
snd_seq_drain_output(seq_handle);
// Duration
usleep(note_time / 6);
}
snd_seq_close(seq_handle);
return 0;
}

86
_examples/c/alsamidi2.c Normal file
View File

@ -0,0 +1,86 @@
---
author: "Flávio Schiavoni"
description: Obla !
---
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <alsa/asoundlib.h>
extern struct timespec timespec_diff(struct timespec start, struct timespec end);
extern double timespec_millis(struct timespec time);
snd_seq_t *open_seq();
void midi_action(snd_seq_t *seq_handle);
int keep_walking;
static void sigint_handler(int i){
keep_walking = 0;
}
int main(int argc, char *argv[]) {
int note_on_time = 1000000; // 1 segundo
int note_off_time = 1000000; // 1 segundo (em microsegundos)
signal(SIGINT, &sigint_handler);
signal(SIGTERM, &sigint_handler);
keep_walking = 1;
// Crio o dispositivo MIDI
snd_seq_t *seq_handle;
int portid;
if (snd_seq_open(&seq_handle, "hw", SND_SEQ_OPEN_DUPLEX, 0) < 0) {
fprintf(stderr, "Error opening ALSA sequencer.\n");
exit(1);
}
snd_seq_set_client_name(seq_handle, "Teclado");
if ((portid = snd_seq_create_simple_port(seq_handle, "keyb",
SND_SEQ_PORT_CAP_READ|SND_SEQ_PORT_CAP_SUBS_READ,
SND_SEQ_PORT_TYPE_APPLICATION)) < 0) {
fprintf(stderr, "Error creating sequencer port.\n");
exit(1);
}
snd_seq_event_t ev;
snd_seq_ev_clear(&ev);
snd_seq_ev_set_source(&ev, 0);
snd_seq_ev_set_subs(&ev);
snd_seq_ev_set_direct(&ev);
while (keep_walking) {
int key = getchar();
printf("Pressionou o %d\n", key);
switch(key){
case 'a':
snd_seq_ev_set_noteon(&ev, 0, 60, 127);
snd_seq_event_output(seq_handle, &ev);
snd_seq_drain_output(seq_handle);
usleep(note_on_time / 3);
snd_seq_ev_set_noteoff(&ev, 0, 60, 0);
snd_seq_event_output(seq_handle, &ev);
snd_seq_drain_output(seq_handle);
break;
case 's':
snd_seq_ev_set_noteon(&ev, 0, 62, 127);
snd_seq_event_output(seq_handle, &ev);
snd_seq_drain_output(seq_handle);
usleep(note_on_time / 3);
snd_seq_ev_set_noteoff(&ev, 0, 62, 0);
snd_seq_event_output(seq_handle, &ev);
snd_seq_drain_output(seq_handle);
}
}
snd_seq_close(seq_handle);
return 0;
}

66
_examples/c/alsamidi3.c Normal file
View File

@ -0,0 +1,66 @@
---
author: "Flávio Schiavoni"
description: Comunicador Alsa MIDI
---
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <alsa/asoundlib.h>
int keep_walking;
static void sigint_handler(int i){
keep_walking = 0;
}
int main(int argc, char *argv[]) {
int note_time = 1000000; // 1 segundo (em microsegundos)
// Pega o Ctrl+C ou signal de Kill para a aplicação.
signal(SIGINT, &sigint_handler);
signal(SIGTERM, &sigint_handler);
keep_walking = 1;
// Crio o dispositivo MIDI
snd_seq_t *seq_handle;
int portid;
if (snd_seq_open(&seq_handle, "hw", SND_SEQ_OPEN_DUPLEX, 0) < 0) {
fprintf(stderr, "Error opening ALSA sequencer.\n");
exit(1);
}
snd_seq_set_client_name(seq_handle, "My App Midi");
if ((portid = snd_seq_create_simple_port(seq_handle, "My Midi Port",
SND_SEQ_PORT_CAP_READ|SND_SEQ_PORT_CAP_SUBS_READ,
SND_SEQ_PORT_TYPE_APPLICATION)) < 0) {
fprintf(stderr, "Error creating sequencer port.\n");
exit(1);
}
snd_seq_event_t ev;
snd_seq_ev_clear(&ev);
snd_seq_ev_set_source(&ev, 0);
snd_seq_ev_set_subs(&ev);
snd_seq_ev_set_direct(&ev);
int value = 0;
while (keep_walking) {
// Note on
snd_seq_ev_set_controller(&ev, 0, 0, value);
snd_seq_event_output(seq_handle, &ev);
snd_seq_drain_output(seq_handle);
// Duration
usleep(note_time);
// value = (value < 127) ? value + 1 : 0;
}
snd_seq_close(seq_handle);
return 0;
}

64
_examples/c/audiotools.c Normal file
View File

@ -0,0 +1,64 @@
---
author: "Flávio Schiavoni"
description: O Blesq Blom!
---
#include <sys/stat.h>
#include <string.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <fcntl.h>
#include <math.h>
#define SAMPLE_RATE 44100
#define TIME 1 //seconds
#define SAMPLE_SIZE 32 // 32 bits float
#define PI 3.141592653
int main(int argc, char ** argv){
char filename[10];
strcpy(filename, "output.wav");
FILE *fp = fopen(filename,"wb+");
fwrite("RIFF", 1, 4, fp);
int size = SAMPLE_RATE * TIME * SAMPLE_SIZE / 8; // 44100 * 10 seconds * 4 bytes per sample
fwrite(&size, 1, sizeof(size), fp);
fwrite("WAVE", 1, 4, fp);
fwrite("fmt ", 1, 4, fp);
int flag = 16; // chunk size
fwrite(&flag, 1, 4, fp);
flag = 0x0003; // compression code
fwrite(&flag, 1, 2, fp);
flag = 1; // number of channels
fwrite(&flag, 1, 2, fp);
flag = SAMPLE_RATE; // sample rate
fwrite(&flag, 1, 4, fp);
flag = SAMPLE_RATE * SAMPLE_SIZE / 8; // bytes per second
fwrite(&flag, 1, 4, fp);
flag = SAMPLE_SIZE / 8; // block align
fwrite(&flag, 1, 2, fp);
flag = SAMPLE_SIZE; // significant bits per sample
fwrite(&flag, 1, 2, fp);
fwrite("data", 1, 4, fp);
fwrite(&size, 1, 4, fp);
float buffer[SAMPLE_RATE * TIME];
float freq = 440.0f;
float step = 2.0f * PI / ((float)SAMPLE_RATE / freq);
printf("Step: %f\n", step);
int i = 0;
for(i = 0 ; i < SAMPLE_RATE * TIME; i++){
buffer[i] = sin((float)i * step);
}
fwrite(buffer, 1, size, fp);
fclose(fp);
}

114
_examples/c/portMidi.c Normal file
View File

@ -0,0 +1,114 @@
---
author: "Flávio Schiavoni"
description: O Blesq Blom!
---
#include <stdio.h>
#include <portmidi.h>
#define INPUT_BUFFER_SIZE 100
#define OUTPUT_BUFFER_SIZE 0
#define DRIVER_INFO NULL
#define TIME_PROC ((int32_t (*)(void *)) Pt_Time)
#define TIME_INFO NULL
#define TIME_START Pt_Start(1, 0, 0) /* timer started w/millisecond accuracy */
#define STRING_MAX 80 /* used for console input */
#define chord_size 5
int32_t latency = 0;
int main(int argc, char* argv) {
PmStream * midi;
char line[80];
int32_t off_time;
int chord[] = { 60, 67, 76, 83, 90 };
PmEvent buffer[chord_size];
PmTimestamp timestamp;
/* determine which output device to use */
int i = get_number("Type output number: ");
/* It is recommended to start timer before PortMidi */
TIME_START;
/* open output device -- since PortMidi avoids opening a timer
when latency is zero, we will pass in a NULL timer pointer
for that case. If PortMidi tries to access the time_proc,
we will crash, so this test will tell us something. */
Pm_OpenOutput(&midi,
i,
DRIVER_INFO,
OUTPUT_BUFFER_SIZE,
(latency == 0 ? NULL : TIME_PROC),
(latency == 0 ? NULL : TIME_INFO),
latency);
printf("Midi Output opened with %ld ms latency.\n", (long) latency);
/* output note on/off w/latency offset; hold until user prompts */
printf("ready to send program 1 change... (type RETURN):");
fgets(line, STRING_MAX, stdin);
/* if we were writing midi for immediate output, we could always use
timestamps of zero, but since we may be writing with latency, we
will explicitly set the timestamp to "now" by getting the time.
The source of timestamps should always correspond to the TIME_PROC
and TIME_INFO parameters used in Pm_OpenOutput(). */
buffer[0].timestamp = TIME_PROC(TIME_INFO);
/* Send a program change to increase the chances we will hear notes */
/* Program 0 is usually a piano, but you can change it here: */
#define PROGRAM 0
buffer[0].message = Pm_Message(0xC0, PROGRAM, 0);
Pm_Write(midi, buffer, 1);
printf("ready to note-on... (type RETURN):");
fgets(line, STRING_MAX, stdin);
buffer[0].timestamp = TIME_PROC(TIME_INFO);
buffer[0].message = Pm_Message(0x90, 60, 100);
Pm_Write(midi, buffer, 1);
printf("ready to note-off... (type RETURN):");
fgets(line, STRING_MAX, stdin);
buffer[0].timestamp = TIME_PROC(TIME_INFO);
buffer[0].message = Pm_Message(0x90, 60, 0);
Pm_Write(midi, buffer, 1);
/* output short note on/off w/latency offset; hold until user prompts */
printf("ready to note-on (short form)... (type RETURN):");
fgets(line, STRING_MAX, stdin);
Pm_WriteShort(midi, TIME_PROC(TIME_INFO),
Pm_Message(0x90, 60, 100));
printf("ready to note-off (short form)... (type RETURN):");
fgets(line, STRING_MAX, stdin);
Pm_WriteShort(midi, TIME_PROC(TIME_INFO),
Pm_Message(0x90, 60, 0));
/* output several note on/offs to test timing.
Should be 1s between notes */
printf("chord will arpeggiate if latency > 0\n");
printf("ready to chord-on/chord-off... (type RETURN):");
fgets(line, STRING_MAX, stdin);
timestamp = TIME_PROC(TIME_INFO);
for (i = 0; i < chord_size; i++) {
buffer[i].timestamp = timestamp + 1000 * i;
buffer[i].message = Pm_Message(0x90, chord[i], 100);
}
Pm_Write(midi, buffer, chord_size);
off_time = timestamp + 1000 + chord_size * 1000;
while (TIME_PROC(TIME_INFO) < off_time)
/* busy wait */;
for (i = 0; i < chord_size; i++) {
buffer[i].timestamp = timestamp + 1000 * i;
buffer[i].message = Pm_Message(0x90, chord[i], 0);
}
Pm_Write(midi, buffer, chord_size);
/* close device (this not explicitly needed in most implementations) */
printf("ready to close and terminate... (type RETURN):");
fgets(line, STRING_MAX, stdin);
Pm_Close(midi);
Pm_Terminate();
printf("done closing and terminating...\n");
}

76
_examples/c/seqdemo.c Normal file
View File

@ -0,0 +1,76 @@
---
author: "Flávio Schiavoni"
description: O Blesq Blom!
---
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <alsa/asoundlib.h>
snd_seq_t *open_seq();
void midi_action(snd_seq_t *seq_handle);
snd_seq_t *open_seq() {
snd_seq_t *seq_handle;
int portid;
if (snd_seq_open(&seq_handle, "hw", SND_SEQ_OPEN_DUPLEX, 0) < 0) {
fprintf(stderr, "Error opening ALSA sequencer.\n");
exit(1);
}
snd_seq_set_client_name(seq_handle, "ALSA Sequencer Demo");
if ((portid = snd_seq_create_simple_port(seq_handle, "ALSA Sequencer Demo",
SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE,
SND_SEQ_PORT_TYPE_APPLICATION)) < 0) {
fprintf(stderr, "Error creating sequencer port.\n");
exit(1);
}
return(seq_handle);
}
void midi_action(snd_seq_t *seq_handle) {
snd_seq_event_t *ev;
do {
snd_seq_event_input(seq_handle, &ev);
switch (ev->type) {
case SND_SEQ_EVENT_CONTROLLER:
fprintf(stderr, "Control event on Channel %2d: %5d \r",
ev->data.control.channel, ev->data.control.value);
break;
case SND_SEQ_EVENT_PITCHBEND:
fprintf(stderr, "Pitchbender event on Channel %2d: %5d \r",
ev->data.control.channel, ev->data.control.value);
break;
case SND_SEQ_EVENT_NOTEON:
fprintf(stderr, "Note On event on Channel %2d: %5d \r",
ev->data.control.channel, ev->data.note.note);
break;
case SND_SEQ_EVENT_NOTEOFF:
fprintf(stderr, "Note Off event on Channel %2d: %5d \r",
ev->data.control.channel, ev->data.note.note);
break;
}
snd_seq_free_event(ev);
} while (snd_seq_event_input_pending(seq_handle, 0) > 0);
}
int main(int argc, char *argv[]) {
snd_seq_t *seq_handle;
int npfd;
struct pollfd *pfd;
seq_handle = open_seq();
npfd = snd_seq_poll_descriptors_count(seq_handle, POLLIN);
pfd = (struct pollfd *)alloca(npfd * sizeof(struct pollfd));
snd_seq_poll_descriptors(seq_handle, pfd, npfd, POLLIN);
while (1) {
if (poll(pfd, npfd, 100000) > 0) {
midi_action(seq_handle);
}
}
}

294
_examples/python/midigen.py Normal file
View File

@ -0,0 +1,294 @@
---
author: "Flávio Schiavoni"
description:
---
# sudo apt install python3-MIDIUtil
from midiutil import MIDIFile
name = "Generate Midi"
keys = ['C','C#','D','D#','E','F','F#','G','G#','A','A#','B']
track = 0
time = 0 # In beats
channel = 0
semibreve = 4 # In beats
seminima = 1 # In beats
colcheia = 0.5 # In beats
volume = 100 # 0-127, as per the MIDI standard
tempo = 120 # In BPM
step = 48
def gerar_pedal(acordes, mf):
global track, channel, time, duration, volume
mf.addTrackName(track, time, "Pedal")
for i, chord in enumerate(acordes):
pitch = keys.index(chord[:1],0) + step
if (chord[1:2] == '#'):
pitch = pitch + 1
if (chord[1:2] == 'b'):
pitch = pitch - 1
mf.addNote(track, channel, pitch, i*4 + 0, seminima, volume)
mf.addNote(track, channel, pitch, i*4 + 1, seminima, volume)
mf.addNote(track, channel, pitch, i*4 + 2, seminima, volume)
mf.addNote(track, channel, pitch, i*4 + 3, seminima, volume)
track = track + 1
def gerar_tonica(acordes, mf):
global track, channel, time, duration, volume
mf.addTrackName(track, time, "Tonica")
for i, chord in enumerate(acordes):
pitch = keys.index(chord[:1],0) + step + 36
if (chord[1:2] == '#'):
pitch = pitch + 1
if (chord[1:2] == 'b'):
pitch = pitch - 1
print("Tônica: ", chord, pitch)
mf.addNote(track, channel, pitch, i*4, semibreve, volume)
track = track + 1
def gerar_quinta(acordes, mf):
global track, channel, time, duration, volume
mf.addTrackName(track, time, "Quinta")
for i, chord in enumerate(acordes):
pitch = keys.index(chord[:1],0) + step + 36
if (chord[1:2] == '#'):
pitch = pitch + 1
if (chord[1:2] == 'b'):
pitch = pitch - 1
pitch = pitch + 7
print("Quinta: ", chord, pitch)
mf.addNote(track, channel, pitch, i*4, semibreve, volume)
track = track + 1
def gerar_terca(acordes, mf):
global track, channel, time, duration, volume
mf.addTrackName(track, time, "Terca")
for i, chord in enumerate(acordes):
pitch = keys.index(chord[:1],0) + step + 36
if (chord[1:2] == '#'):
pitch = pitch + 1
if (chord[1:2] == 'b'):
pitch = pitch - 1
pitch = pitch + 4
if ("m" in chord):
pitch = pitch - 1
print("terça: ", chord, pitch)
mf.addNote(track, channel, pitch, i*4, semibreve, volume)
track = track + 1
def gerar_acordes(acordes, mf):
global track, channel, time, duration, volume
mf.addTrackName(track, time, "acordes")
for i, chord in enumerate(acordes):
pitch = keys.index(chord[:1],0) + step + 24
if (chord[1:2] == '#'):
pitch = pitch + 1
if (chord[1:2] == 'b'):
pitch = pitch - 1
mf.addNote(track, channel, pitch, i*4, semibreve, volume)
quinta = pitch + 7
mf.addNote(track, channel, quinta, i*4, semibreve, volume)
terca = pitch + 4
if ("m" in chord):
terca = terca - 1
mf.addNote(track, channel, terca, i*4, semibreve, volume)
track = track + 1
def gerar_reaggae(acordes, mf):
global track, channel, time, duration, volume
mf.addTrackName(track, time, "reggae")
for i, chord in enumerate(acordes):
pitch = keys.index(chord[:1],0) + step + 24
if (chord[1:2] == '#'):
pitch = pitch + 1
if (chord[1:2] == 'b'):
pitch = pitch - 1
quinta = pitch + 7
terca = pitch + 4
if ("m" in chord):
terca = terca - 1
mf.addNote(track, channel, pitch, i*4 + 1, seminima, volume)
mf.addNote(track, channel, pitch, i*4 + 3, seminima, volume)
mf.addNote(track, channel, terca, i*4 + 1, seminima, volume)
mf.addNote(track, channel, terca, i*4 + 3, seminima, volume)
mf.addNote(track, channel, quinta, i*4 + 1, seminima, volume)
mf.addNote(track, channel, quinta, i*4 + 3, seminima, volume)
track = track + 1
def gerar_baixo1(acordes, mf):
global track, channel, time, duration, volume
mf.addTrackName(track, time, "Baixo1")
for i, chord in enumerate(acordes):
pitch = keys.index(chord[:1],0) + step + 12
if (chord[1:2] == '#'):
pitch = pitch + 1
if (chord[1:2] == 'b'):
pitch = pitch - 1
quinta = pitch + 7
terca = pitch + 4
if ("m" in chord):
terca = terca - 1
mf.addNote(track, channel, pitch, i*4 + 0, seminima + colcheia, volume)
mf.addNote(track, channel, terca, i*4 + 1.5, colcheia, volume)
mf.addNote(track, channel, quinta, i*4 + 2, seminima, volume)
mf.addNote(track, channel, pitch, i*4 + 3, seminima, volume)
track = track + 1
def gerar_baixo2(acordes, mf):
global track, channel, time, duration, volume
mf.addTrackName(track, time, "Baixo2")
for i, chord in enumerate(acordes):
pitch = keys.index(chord[:1],0) + step + 12
mf.addNote(track, channel, pitch, i*4 + 0, seminima, volume)
mf.addNote(track, channel, pitch + 7, i*4 + 1, seminima, volume)
mf.addNote(track, channel, pitch, i*4 + 2, seminima, volume)
mf.addNote(track, channel, pitch + 7, i*4 + 3, seminima, volume)
track = track + 1
def gerar_baixo3(acordes, mf):
global track, channel, time, duration, volume
mf.addTrackName(track, time, "Baixo3")
for i, chord in enumerate(acordes):
pitch = keys.index(chord[:1],0) + step + 12
mf.addNote(track, channel, pitch, i*4 + 0, colcheia, volume)
mf.addNote(track, channel, pitch + 7, i*4 + 0.5, colcheia, volume)
mf.addNote(track, channel, pitch, i*4 + 1, colcheia, volume)
mf.addNote(track, channel, pitch + 7, i*4 + 1.5, colcheia, volume)
mf.addNote(track, channel, pitch, i*4 + 2, colcheia, volume)
mf.addNote(track, channel, pitch + 7, i*4 + 2.5, colcheia, volume)
mf.addNote(track, channel, pitch, i*4 + 3, colcheia, volume)
mf.addNote(track, channel, pitch + 7, i*4 + 3.5, colcheia, volume)
track = track + 1
def gerar_bateria1(acordes, mf):
global track, channel, time, duration, volume
mf.addTrackName(track, time, "Bateria1")
# Bumbo
mf.addNote(track, channel, 48, 0, seminima, volume)
mf.addNote(track, channel, 48, 4, seminima, volume)
# Caixa
mf.addNote(track, channel, 53, 2, seminima, volume)
mf.addNote(track, channel, 53, 6, seminima, volume)
# Cimbal
mf.addNote(track, channel, 60, 0, colcheia, volume + 10)
mf.addNote(track, channel, 61, 0.5, colcheia, volume - 10)
mf.addNote(track, channel, 60, 1, colcheia, volume)
mf.addNote(track, channel, 62, 1.5, colcheia, volume + 10)
mf.addNote(track, channel, 61, 2, colcheia, volume - 10)
mf.addNote(track, channel, 60, 2.5, colcheia, volume)
mf.addNote(track, channel, 61, 3, colcheia, volume + 10)
mf.addNote(track, channel, 62, 3.5, colcheia, volume - 10)
mf.addNote(track, channel, 60, 4, colcheia, volume - 10)
mf.addNote(track, channel, 61, 4.5, colcheia, volume + 10)
mf.addNote(track, channel, 60, 5, colcheia, volume)
mf.addNote(track, channel, 61, 5.5, colcheia, volume - 10)
mf.addNote(track, channel, 62, 6, colcheia, volume + 10)
mf.addNote(track, channel, 60, 6.5, colcheia, volume - 10)
mf.addNote(track, channel, 61, 7, colcheia, volume - 10)
mf.addNote(track, channel, 62, 7.5, colcheia, volume)
track = track + 1
def gerar_bateria2(acordes, mf):
global track, channel, time, duration, volume
mf.addTrackName(track, time, "Bateria2")
# Bumbo
mf.addNote(track, channel, 48, 0, seminima, volume)
mf.addNote(track, channel, 48, 2, colcheia, volume)
mf.addNote(track, channel, 48, 2.5, colcheia, volume)
mf.addNote(track, channel, 48, 4, seminima, volume)
mf.addNote(track, channel, 48, 6, colcheia, volume)
mf.addNote(track, channel, 48, 6.5, colcheia, volume)
# Caixa
mf.addNote(track, channel, 53, 1, seminima, volume)
mf.addNote(track, channel, 53, 3, seminima, volume)
mf.addNote(track, channel, 53, 5, seminima, volume)
mf.addNote(track, channel, 53, 7, seminima, volume)
# Cimbal
mf.addNote(track, channel, 60, 0, colcheia, volume + 10)
mf.addNote(track, channel, 61, 0.5, colcheia, volume - 10)
mf.addNote(track, channel, 60, 1, colcheia, volume)
mf.addNote(track, channel, 62, 1.5, colcheia, volume + 10)
mf.addNote(track, channel, 61, 2, colcheia, volume - 10)
mf.addNote(track, channel, 60, 2.5, colcheia, volume)
mf.addNote(track, channel, 61, 3, colcheia, volume + 10)
mf.addNote(track, channel, 62, 3.5, colcheia, volume - 10)
mf.addNote(track, channel, 60, 4, colcheia, volume - 10)
mf.addNote(track, channel, 61, 4.5, colcheia, volume + 10)
mf.addNote(track, channel, 60, 5, colcheia, volume)
mf.addNote(track, channel, 61, 5.5, colcheia, volume - 10)
mf.addNote(track, channel, 62, 6, colcheia, volume + 10)
mf.addNote(track, channel, 60, 6.5, colcheia, volume - 10)
mf.addNote(track, channel, 61, 7, colcheia, volume - 10)
mf.addNote(track, channel, 62, 7.5, colcheia, volume)
track = track + 1
def gerar_percussao(acordes, mf):
global track, channel, time, duration, volume
mf.addTrackName(track, time, "Percussao")
# Bumbo
mf.addNote(track, channel, 72, 0, seminima, volume)
mf.addNote(track, channel, 73, 0.5, seminima, volume)
mf.addNote(track, channel, 73, 3, seminima, volume)
mf.addNote(track, channel, 72, 3.5, seminima, volume)
mf.addNote(track, channel, 73, 5, seminima, volume)
mf.addNote(track, channel, 72, 5.5, seminima, volume)
mf.addNote(track, channel, 72, 6.5, seminima, volume)
track = track + 1
def gerar_percussao2(acordes, mf):
global track, channel, time, duration, volume
mf.addTrackName(track, time, "Percussao 2")
# Bumbo
mf.addNote(track, channel, 77, 0.5, colcheia, volume)
mf.addNote(track, channel, 78, 1.5, colcheia, volume)
mf.addNote(track, channel, 79, 2, colcheia, volume)
mf.addNote(track, channel, 77, 2.5, colcheia, volume)
mf.addNote(track, channel, 79, 3, colcheia, volume)
track = track + 1
mf = MIDIFile(13, deinterleave=True) # One track, defaults to format 1 (tempo track is created
# name = "Alagados"
# acordes = ['A', 'A', 'E', 'D']
# mf.addTempo(track, time, 200)
# name = "Vapor Barato"
# acordes = ['Am', 'Am', 'G', 'G', 'F', 'F', 'Dm', 'E']
# mf.addTempo(track, time, 132)
# name = "Hey Joe"
# acordes = ['C', 'G', 'D', 'A', 'E', 'E', 'E', 'E']
# mf.addTempo(track, time, 132)
# name = "Ainda é cedo"
# acordes = ['Dm', 'C', 'Am', 'Am']
# mf.addTempo(track, time, 132)
# name = "Creep"
# acordes = ['G', 'G', 'B', 'B', 'C', 'C', 'Cm', 'Cm']
# mf.addTempo(track, time, 100)
# name = "Não chores mais"
# acordes = ['C', 'G', 'Am', 'F']
# mf.addTempo(track, time, 100)
name = "Naquela Mesa"
acordes = ['Am', 'Am', 'Am', 'Dm', 'Dm', 'Dm', 'Dm', 'Am', 'Am', 'Am', 'A', 'Dm', 'Dm', 'Am', 'E', 'Am']
mf.addTempo(track, time, 100)
gerar_bateria1(acordes,mf)
gerar_bateria2(acordes,mf)
gerar_percussao(acordes,mf)
gerar_percussao2(acordes,mf)
gerar_tonica(acordes,mf)
gerar_quinta(acordes,mf)
gerar_terca(acordes,mf)
gerar_acordes(acordes,mf)
gerar_reaggae(acordes,mf)
gerar_pedal(acordes,mf)
gerar_baixo1(acordes,mf)
gerar_baixo2(acordes,mf)
gerar_baixo3(acordes,mf)
with open(name + ".mid", "wb") as output_file:
mf.writeFile(output_file)

View File

@ -0,0 +1,333 @@
---
author: "Flávio Schiavoni"
description:
---
from __future__ import print_function
from unittest import TestCase
class NoteEvent(TestCase):
def test(self):
from alsamidi import noteevent
midi_event = (1, 60, 127, 1000, 10)
data = (1, 60, 127, 0, 10)
expected = (5, 1, 0, 0, (1, 0), (0, 0), (0, 0), data)
self.assertEqual(expected, noteevent(*midi_event))
class NoteOnEvent(TestCase):
def test(self):
from alsamidi import noteonevent
midi_event = (1, 60, 127)
data = (1, 60, 127, 0, 0)
expected = (6, 1, 0, 253, (0, 0), (0, 0), (0, 0), data)
self.assertEqual(expected, noteonevent(*midi_event))
class NoteOffEvent(TestCase):
def test(self):
from alsamidi import noteoffevent
midi_event = (1, 60, 10)
data = (1, 60, 10, 0, 0)
expected = (7, 1, 0, 253, (0, 0), (0, 0), (0, 0), data)
self.assertEqual(expected, noteoffevent(*midi_event))
class PgmChangeEvent(TestCase):
def test_sent_directly(self):
from alsamidi import pgmchangeevent
data = (1, 0, 0, 0, 0, 9)
expected = (11, 1, 0, 253, (0, 0), (0, 0), (0, 0), data)
self.assertEqual(expected, pgmchangeevent(1, 9))
def test_scheduled(self):
from alsamidi import pgmchangeevent
data = (1, 0, 0, 0, 0, 9)
expected = (11, 1, 0, 0, (1, 0), (0, 0), (0, 0), data)
self.assertEqual(expected, pgmchangeevent(1, 9, 1000))
class PitchbendEvent(TestCase):
def test_sent_directly(self):
from alsamidi import pitchbendevent
data = (1, 0, 9)
expected = (13, 1, 0, 253, (0, 0), (0, 0), (0, 0), data)
self.assertEqual(expected, pitchbendevent(1, 9))
def test_scheduled(self):
from alsamidi import pitchbendevent
data = (1, 0, 9)
expected = (13, 1, 0, 0, (1, 0), (0, 0), (0, 0), data)
self.assertEqual(expected, pitchbendevent(1, 9, 1000))
class ChanPress(TestCase):
def test_sent_directly(self):
from alsamidi import chanpress
data = (1, 0, 9)
expected = (12, 1, 0, 253, (0, 0), (0, 0), (0, 0), data)
self.assertEqual(expected, chanpress(1, 9))
def test_scheduled(self):
from alsamidi import chanpress
data = (1, 0, 9)
expected = (12, 1, 0, 0, (1, 0), (0, 0), (0, 0), data)
self.assertEqual(expected, chanpress(1, 9, 1000))
class Tuple2Time(TestCase):
def test(self):
from alsamidi import tuple2time
self.assertEqual(1.5, tuple2time((1, 500000000)))
class Time2Tuple(TestCase):
def test(self):
from alsamidi import time2tuple
self.assertEqual((1, 500000000), time2tuple(1.5))
class ModifyEvent(TestCase):
def test(self):
from alsamidi import modifyevent
data = (1, 60, 127, 0, 10)
event = (5, 1, 0, 0, (1, 0), (0, 0), (0, 0), data)
modified_data = (15, 72, 127, 0, 10)
modified_event = (5, 1, 0, 250, (2, 0), (2, 0), (3, 0), modified_data)
self.assertEqual(modified_event, modifyevent(event, timedelta=1,
ch=15, dest=(3, 0), source=(2, 0), queue=250, keydelta=12))
class ModifyEvents(TestCase):
def test(self):
from alsamidi import modifyevents
data = (1, 60, 127, 0, 10)
event = (5, 1, 0, 0, (1, 0), (0, 0), (0, 0), data)
modified_data = (15, 72, 127, 0, 10)
modified_event = (5, 1, 0, 250, (2, 0), (2, 0), (3, 0), modified_data)
self.assertEqual([modified_event], modifyevents([event], timedelta=1,
ch=15, dest=(3, 0), source=(2, 0), queue=250, keydelta=12))
class Merge(TestCase):
def test_no_tracks(self):
from alsamidi import merge
self.assertEqual([], merge([]))
def test_track(self):
from alsamidi import merge
event = (0, 0, 0, 0, 0)
self.assertEqual([event], merge([[event]]))
class UniqueNotes(TestCase):
def test(self):
from alsamidi import uniquenotes
data = (1, 60, 127, 0, 10)
event = (5, 1, 0, 0, (1, 0), (0, 0), (0, 0), data)
expected = {1: [60]}
self.assertEqual(expected, uniquenotes([event]))
class TestSeq(TestCase):
def setUp(self):
try:
from mock import Mock
except:
from unittest.mock import Mock
import alsamidi
alsamidi.print = Mock()
def tearDown(self):
import alsamidi
del alsamidi.print
def test_instance(self):
from alsamidi import Seq
self.assertTrue(isinstance(Seq(), Seq))
def test_info(self):
from alsamidi import Seq
import alsamidi
data = (9, 60, 127, 0, 10)
event = (5, 1, 0, 0, (1, 0), (0, 0), (0, 0), data)
track = [event]
seq = Seq()
seq.names = ['name']
seq.tags = 'tags'
seq.tracks = [track]
seq.info()
alsamidi.print.assert_any_call('tags')
args = '0:', 'name ', 0, 'Sec.', 1, 'events,', {9: [60]}, 'Hi Bongo'
alsamidi.print.assert_called_with(*args)
class SeqRead(TestCase):
def setUp(self):
import os
try:
from mock import Mock
except:
from unittest.mock import Mock
import alsamidi
self.file = Mock()
text = 'track melody\n' \
'6,1,0,1,2 5430786,20 0,130 0,1 108 82 0 0\n' \
'name = value'
lines = text.split('\n')
self.file.readlines.return_value = lines
lines[0] = lines[0] + '\n'
alsamidi.open = Mock(return_value=self.file)
alsamidi.print = Mock()
self.exits = os.path.exists
os.path.exists = Mock(return_value=True)
def tearDown(self):
import os
import alsamidi
del alsamidi.open
del alsamidi.print
def test_read_not_found(self):
import os
from alsamidi import Seq
os.path.exists.return_value = False
seq = Seq()
seq.read('path')
self.assertEqual([], seq.tracks)
def test_read_named_track(self):
from alsamidi import Seq
seq = Seq()
seq.read('path')
self.assertEqual(['track melody'], seq.names)
def test_read_default_track(self):
from alsamidi import Seq
text = '6,1,0,1,2 5430786,20 0,130 0,1 108 82 0 0'
self.file.readlines.return_value = text.split('\n')
seq = Seq()
seq.read('path')
self.assertEqual(['Default'], seq.names)
def test_read_track(self):
from alsamidi import Seq
seq = Seq()
seq.read('path')
self.assertEqual([[
(6, 1, 0, 1,
(2, 5430786),
(20, 0),
(130, 0), (1, 108, 82, 0, 0))]], seq.tracks)
class SeqWrite(TestCase):
def setUp(self):
try:
from mock import Mock
except:
from unittest.mock import Mock
import alsamidi
self.file = Mock()
alsamidi.open = Mock(return_value=self.file)
alsamidi.print = Mock()
def tearDown(self):
import alsamidi
del alsamidi.open
del alsamidi.print
def test_write(self):
from alsamidi import Seq
data = (9, 60, 127, 0, 10)
event = (5, 1, 0, 0, (1, 0), (0, 0), (0, 0), data)
track = [event]
seq = Seq()
seq.names = ['name']
seq.tags = {'name': 'value'}
seq.orderedtags = ['name']
seq.tracks = [track]
seq.write('path')
line = '5,1,0,0,1 0,0 0,0 0,9 60 127 0 10\n'
self.file.write.assert_called_with(line)
def test_write_no_name(self):
from alsamidi import Seq
data = (9, 60, 127, 0, 10)
event = (5, 1, 0, 0, (1, 0), (0, 0), (0, 0), data)
track = [event]
seq = Seq()
seq.names = []
seq.tags = {'name': 'value'}
seq.orderedtags = ['name']
seq.tracks = [track]
seq.write('path')
line = '5,1,0,0,1 0,0 0,0 0,9 60 127 0 10\n'
self.file.write.assert_called_with(line)
def test_error(self):
from alsamidi import Seq
import alsamidi
alsamidi.open.side_effect = IOError
seq = Seq()
seq.write('path')
if __name__ == '__main__':
unittest.main()

View File

@ -0,0 +1,20 @@
{%- if page.comments != false and jekyll.environment == "production" -%}
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = '{{ page.url | absolute_url }}';
this.page.identifier = '{{ page.url | absolute_url }}';
};
(function() {
var d = document, s = d.createElement('script');
s.src = 'https://{{ site.disqus.shortname }}.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
{%- endif -%}

35
_includes/footer.html Normal file
View File

@ -0,0 +1,35 @@
<footer class="site-footer h-card">
<data class="u-url" href="{{ "/" | relative_url }}"></data>
<div class="wrapper">
<h2 class="footer-heading">{{ site.title | escape }}</h2>
<div class="footer-col-wrapper">
<div class="footer-col footer-col-1">
<ul class="contact-list">
<li class="p-name">
{%- if site.author -%}
{{ site.author | escape }}
{%- else -%}
{{ site.title | escape }}
{%- endif -%}
</li>
{%- if site.email -%}
<li><a class="u-email" href="mailto:{{ site.email }}">{{ site.email }}</a></li>
{%- endif -%}
</ul>
</div>
<div class="footer-col footer-col-2">
{%- include social.html -%}
</div>
<div class="footer-col footer-col-3">
<p>{{- site.description | escape -}}</p>
</div>
</div>
</div>
</footer>

View File

@ -0,0 +1,12 @@
<script>
if(!(window.doNotTrack === "1" || navigator.doNotTrack === "1" || navigator.doNotTrack === "yes" || navigator.msDoNotTrack === "1")) {
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '{{ site.google_analytics }}', 'auto');
ga('send', 'pageview');
}
</script>

11
_includes/head.html Normal file
View File

@ -0,0 +1,11 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
{%- seo -%}
<link rel="stylesheet" href="{{ "/assets/main.css" | relative_url }}">
{%- feed_meta -%}
{%- if jekyll.environment == 'production' and site.google_analytics -%}
{%- include google-analytics.html -%}
{%- endif -%}
</head>

30
_includes/header.html Normal file
View File

@ -0,0 +1,30 @@
<header class="site-header" role="banner">
<div class="wrapper">
{%- assign default_paths = site.pages | map: "path" -%}
{%- assign page_paths = site.header_pages | default: default_paths -%}
<a class="site-title" rel="author" href="{{ "/" | relative_url }}">{{ site.title | escape }}</a>
{%- if page_paths -%}
<nav class="site-nav">
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger">
<span class="menu-icon">
<svg viewBox="0 0 18 15" width="18px" height="15px">
<path d="M18,1.484c0,0.82-0.665,1.484-1.484,1.484H1.484C0.665,2.969,0,2.304,0,1.484l0,0C0,0.665,0.665,0,1.484,0 h15.032C17.335,0,18,0.665,18,1.484L18,1.484z M18,7.516C18,8.335,17.335,9,16.516,9H1.484C0.665,9,0,8.335,0,7.516l0,0 c0-0.82,0.665-1.484,1.484-1.484h15.032C17.335,6.031,18,6.696,18,7.516L18,7.516z M18,13.516C18,14.335,17.335,15,16.516,15H1.484 C0.665,15,0,14.335,0,13.516l0,0c0-0.82,0.665-1.483,1.484-1.483h15.032C17.335,12.031,18,12.695,18,13.516L18,13.516z"/>
</svg>
</span>
</label>
<div class="trigger">
{%- for path in page_paths -%}
{%- assign my_page = site.pages | where: "path", path | first -%}
{%- if my_page.title -%}
<a class="page-link" href="{{ my_page.url | relative_url }}">{{ my_page.title | escape }}</a>
{%- endif -%}
{%- endfor -%}
</div>
</nav>
{%- endif -%}
</div>
</header>

View File

@ -0,0 +1 @@
<a href="https://github.com/{{ include.username }}"><span class="icon icon--github">{% include icon-github.svg %}</span><span class="username">{{ include.username }}</span></a>

View File

@ -0,0 +1 @@
<svg viewBox="0 0 16 16" width="16px" height="16px"><path fill="#828282" d="M7.999,0.431c-4.285,0-7.76,3.474-7.76,7.761 c0,3.428,2.223,6.337,5.307,7.363c0.388,0.071,0.53-0.168,0.53-0.374c0-0.184-0.007-0.672-0.01-1.32 c-2.159,0.469-2.614-1.04-2.614-1.04c-0.353-0.896-0.862-1.135-0.862-1.135c-0.705-0.481,0.053-0.472,0.053-0.472 c0.779,0.055,1.189,0.8,1.189,0.8c0.692,1.186,1.816,0.843,2.258,0.645c0.071-0.502,0.271-0.843,0.493-1.037 C4.86,11.425,3.049,10.76,3.049,7.786c0-0.847,0.302-1.54,0.799-2.082C3.768,5.507,3.501,4.718,3.924,3.65 c0,0,0.652-0.209,2.134,0.796C6.677,4.273,7.34,4.187,8,4.184c0.659,0.003,1.323,0.089,1.943,0.261 c1.482-1.004,2.132-0.796,2.132-0.796c0.423,1.068,0.157,1.857,0.077,2.054c0.497,0.542,0.798,1.235,0.798,2.082 c0,2.981-1.814,3.637-3.543,3.829c0.279,0.24,0.527,0.713,0.527,1.437c0,1.037-0.01,1.874-0.01,2.129 c0,0.208,0.14,0.449,0.534,0.373c3.081-1.028,5.302-3.935,5.302-7.362C15.76,3.906,12.285,0.431,7.999,0.431z"/></svg>

After

Width:  |  Height:  |  Size: 953 B

View File

@ -0,0 +1 @@
<a href="https://twitter.com/{{ include.username }}"><span class="icon icon--twitter">{% include icon-twitter.svg %}</span><span class="username">{{ include.username }}</span></a>

View File

@ -0,0 +1 @@
<svg viewBox="0 0 16 16" width="16px" height="16px"><path fill="#828282" d="M15.969,3.058c-0.586,0.26-1.217,0.436-1.878,0.515c0.675-0.405,1.194-1.045,1.438-1.809c-0.632,0.375-1.332,0.647-2.076,0.793c-0.596-0.636-1.446-1.033-2.387-1.033c-1.806,0-3.27,1.464-3.27,3.27 c0,0.256,0.029,0.506,0.085,0.745C5.163,5.404,2.753,4.102,1.14,2.124C0.859,2.607,0.698,3.168,0.698,3.767 c0,1.134,0.577,2.135,1.455,2.722C1.616,6.472,1.112,6.325,0.671,6.08c0,0.014,0,0.027,0,0.041c0,1.584,1.127,2.906,2.623,3.206 C3.02,9.402,2.731,9.442,2.433,9.442c-0.211,0-0.416-0.021-0.615-0.059c0.416,1.299,1.624,2.245,3.055,2.271 c-1.119,0.877-2.529,1.4-4.061,1.4c-0.264,0-0.524-0.015-0.78-0.046c1.447,0.928,3.166,1.469,5.013,1.469 c6.015,0,9.304-4.983,9.304-9.304c0-0.142-0.003-0.283-0.009-0.423C14.976,4.29,15.531,3.714,15.969,3.058z"/></svg>

After

Width:  |  Height:  |  Size: 814 B

14
_includes/social.html Normal file
View File

@ -0,0 +1,14 @@
<ul class="social-media-list">
{%- if site.dribbble_username -%}<li><a href="https://dribbble.com/{{ site.dribbble_username| cgi_escape | escape }}"><svg class="svg-icon"><use xlink:href="{{ '/assets/minima-social-icons.svg#dribbble' | relative_url }}"></use></svg> <span class="username">{{ site.dribbble_username| escape }}</span></a></li>{%- endif -%}
{%- if site.facebook_username -%}<li><a href="https://www.facebook.com/{{ site.facebook_username| cgi_escape | escape }}"><svg class="svg-icon"><use xlink:href="{{ '/assets/minima-social-icons.svg#facebook' | relative_url }}"></use></svg> <span class="username">{{ site.facebook_username| escape }}</span></a></li>{%- endif -%}
{%- if site.flickr_username -%}<li><a href="https://www.flickr.com/photos/{{ site.flickr_username| cgi_escape | escape }}"><svg class="svg-icon"><use xlink:href="{{ '/assets/minima-social-icons.svg#flickr' | relative_url }}"></use></svg> <span class="username">{{ site.flickr_username| escape }}</span></a></li>{%- endif -%}
{%- if site.github_username -%}<li><a href="https://github.com/{{ site.github_username| cgi_escape | escape }}"><svg class="svg-icon"><use xlink:href="{{ '/assets/minima-social-icons.svg#github' | relative_url }}"></use></svg> <span class="username">{{ site.github_username| escape }}</span></a></li>{%- endif -%}
{%- if site.instagram_username -%}<li><a href="https://instagram.com/{{ site.instagram_username| cgi_escape | escape }}"><svg class="svg-icon"><use xlink:href="{{ '/assets/minima-social-icons.svg#instagram' | relative_url }}"></use></svg> <span class="username">{{ site.instagram_username| escape }}</span></a></li>{%- endif -%}
{%- if site.linkedin_username -%}<li><a href="https://www.linkedin.com/in/{{ site.linkedin_username| cgi_escape | escape }}"><svg class="svg-icon"><use xlink:href="{{ '/assets/minima-social-icons.svg#linkedin' | relative_url }}"></use></svg> <span class="username">{{ site.linkedin_username| escape }}</span></a></li>{%- endif -%}
{%- if site.pinterest_username -%}<li><a href="https://www.pinterest.com/{{ site.pinterest_username| cgi_escape | escape }}"><svg class="svg-icon"><use xlink:href="{{ '/assets/minima-social-icons.svg#pinterest' | relative_url }}"></use></svg> <span class="username">{{ site.pinterest_username| escape }}</span></a></li>{%- endif -%}
{%- for mst in site.mastodon -%}{%- if mst.username and mst.instance -%}<li><a href="https://{{ mst.instance| cgi_escape | escape}}/@{{mst.username}}"><svg class="svg-icon"><use xlink:href="{{ '/assets/minima-social-icons.svg#mastodon' | relative_url }}"></use></svg> <span class="username">{{ mst.username|escape }}</span></a></li>{%- endif -%}{%- endfor -%}
{%- if site.twitter_username -%}<li><a href="https://www.twitter.com/{{ site.twitter_username| cgi_escape | escape }}"><svg class="svg-icon"><use xlink:href="{{ '/assets/minima-social-icons.svg#twitter' | relative_url }}"></use></svg> <span class="username">{{ site.twitter_username| escape }}</span></a></li>{%- endif -%}
{%- if site.youtube_username -%}<li><a href="https://youtube.com/{{ site.youtube_username| cgi_escape | escape }}"><svg class="svg-icon"><use xlink:href="{{ '/assets/minima-social-icons.svg#youtube' | relative_url }}"></use></svg> <span class="username">{{ site.youtube_username| escape }}</span></a></li>{%- endif -%}
{%- if site.googleplus_username -%}<li><a href="https://plus.google.com/{{ site.googleplus_username| escape }}"><svg class="svg-icon"><use xlink:href="{{ '/assets/minima-social-icons.svg#googleplus' | relative_url }}"></use></svg> <span class="username">{{ site.googleplus_username| escape }}</span></a></li>{%- endif -%}
{%- if site.rss -%}<li><a href="{{ 'feed.xml' | relative_url }}"><svg class="svg-icon"><use xlink:href="{{ '/assets/minima-social-icons.svg#rss' | relative_url }}"></use></svg> <span>{{ site.rss | escape }}</span></a></li>{%- endif -%}
</ul>

17
_layouts/code.html Normal file
View File

@ -0,0 +1,17 @@
---
layout: default
---
<article class="post">
<header class="post-header">
<h1 class="post-title">{{ page.title }}</h1>
</header>
Autor: {{ page.author }} <br />
Data: {{ page.date }} <br/>
Download: <a href='{{page.name}}'>{{page.name}}</a>
<div class="post-content">
<pre><code>{{ content }}</code></pre>
</div>
</article>

20
_layouts/default.html Normal file
View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="{{ page.lang | default: site.lang | default: "en" }}">
{%- include head.html -%}
<body>
{%- include header.html -%}
<main class="page-content" aria-label="Content">
<div class="wrapper">
{{ content }}
</div>
</main>
{%- include footer.html -%}
</body>
</html>

34
_layouts/home.html Normal file
View File

@ -0,0 +1,34 @@
---
layout: default
---
<div class="home">
{%- if page.title -%}
<h1 class="page-heading">{{ page.title }}</h1>
{%- endif -%}
{{ content }}
{%- if site.posts.size > 0 -%}
<h2 class="post-list-heading">{{ page.list_title | default: "Posts" }}</h2>
<ul class="post-list">
{%- for post in site.posts -%}
<li>
{%- assign date_format = site.minima.date_format | default: "%b %-d, %Y" -%}
<span class="post-meta">{{ post.date | date: date_format }}</span>
<h3>
<a class="post-link" href="{{ post.url | relative_url }}">
{{ post.title | escape }}
</a>
</h3>
{%- if site.show_excerpts -%}
{{ post.excerpt }}
{%- endif -%}
</li>
{%- endfor -%}
</ul>
<p class="rss-subscribe">subscribe <a href="{{ "/feed.xml" | relative_url }}">via RSS</a></p>
{%- endif -%}
</div>

51
_sass/minima.scss Normal file
View File

@ -0,0 +1,51 @@
@charset "utf-8";
// Define defaults for each variable.
$base-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol" !default;
$base-font-size: 16px !default;
$base-font-weight: 400 !default;
$small-font-size: $base-font-size * 0.875 !default;
$base-line-height: 1.5 !default;
$spacing-unit: 30px !default;
$text-color: #111 !default;
$background-color: #fdfdfd !default;
$brand-color: #2a7ae2 !default;
$grey-color: #828282 !default;
$grey-color-light: lighten($grey-color, 40%) !default;
$grey-color-dark: darken($grey-color, 25%) !default;
$table-text-align: left !default;
// Width of the content area
$content-width: 800px !default;
$on-palm: 600px !default;
$on-laptop: 800px !default;
// Use media queries like this:
// @include media-query($on-palm) {
// .wrapper {
// padding-right: $spacing-unit / 2;
// padding-left: $spacing-unit / 2;
// }
// }
@mixin media-query($device) {
@media screen and (max-width: $device) {
@content;
}
}
@mixin relative-font-size($ratio) {
font-size: $base-font-size * $ratio;
}
// Import partials.
@import
"minima/base",
"minima/layout",
"minima/syntax-highlighting"
;

254
_sass/minima/_base.scss Normal file
View File

@ -0,0 +1,254 @@
/**
* Reset some basic elements
*/
body, h1, h2, h3, h4, h5, h6,
p, blockquote, pre, hr,
dl, dd, ol, ul, figure {
margin: 0;
padding: 0;
}
/**
* Basic styling
*/
body {
font: $base-font-weight #{$base-font-size}/#{$base-line-height} $base-font-family;
color: $text-color;
background-color: $background-color;
-webkit-text-size-adjust: 100%;
-webkit-font-feature-settings: "kern" 1;
-moz-font-feature-settings: "kern" 1;
-o-font-feature-settings: "kern" 1;
font-feature-settings: "kern" 1;
font-kerning: normal;
display: flex;
min-height: 100vh;
flex-direction: column;
}
/**
* Set `margin-bottom` to maintain vertical rhythm
*/
h1, h2, h3, h4, h5, h6,
p, blockquote, pre,
ul, ol, dl, figure,
%vertical-rhythm {
margin-bottom: $spacing-unit * 0.5;
}
/**
* `main` element
*/
main {
display: block; /* Default value of `display` of `main` element is 'inline' in IE 11. */
}
/**
* Images
*/
img {
max-width: 100%;
vertical-align: middle;
}
/**
* Figures
*/
figure > img {
display: block;
}
figcaption {
font-size: $small-font-size;
}
/**
* Lists
*/
ul, ol {
margin-left: $spacing-unit;
}
li {
> ul,
> ol {
margin-bottom: 0;
}
}
/**
* Headings
*/
h1, h2, h3, h4, h5, h6 {
font-weight: $base-font-weight;
}
/**
* Links
*/
a {
color: $brand-color;
text-decoration: none;
&:visited {
color: darken($brand-color, 15%);
}
&:hover {
color: $text-color;
text-decoration: underline;
}
.social-media-list &:hover {
text-decoration: none;
.username {
text-decoration: underline;
}
}
}
/**
* Blockquotes
*/
blockquote {
color: $grey-color;
border-left: 4px solid $grey-color-light;
padding-left: $spacing-unit * 0.5;
@include relative-font-size(1.125);
letter-spacing: -1px;
font-style: italic;
> :last-child {
margin-bottom: 0;
}
}
/**
* Code formatting
*/
pre,
code {
@include relative-font-size(0.9375);
border: 1px solid $grey-color-light;
border-radius: 3px;
background-color: #eef;
}
code {
padding: 1px 5px;
}
pre {
padding: 8px 12px;
overflow-x: auto;
> code {
border: 0;
padding-right: 0;
padding-left: 0;
}
}
/**
* Wrapper
*/
.wrapper {
max-width: -webkit-calc(#{$content-width} - (#{$spacing-unit} * 2));
max-width: calc(#{$content-width} - (#{$spacing-unit} * 2));
margin-right: auto;
margin-left: auto;
padding-right: $spacing-unit;
padding-left: $spacing-unit;
@extend %clearfix;
@include media-query($on-laptop) {
max-width: -webkit-calc(#{$content-width} - (#{$spacing-unit}));
max-width: calc(#{$content-width} - (#{$spacing-unit}));
padding-right: $spacing-unit * 0.5;
padding-left: $spacing-unit * 0.5;
}
}
/**
* Clearfix
*/
%clearfix:after {
content: "";
display: table;
clear: both;
}
/**
* Icons
*/
.svg-icon {
width: 16px;
height: 16px;
display: inline-block;
fill: #{$grey-color};
padding-right: 5px;
vertical-align: text-top;
}
.social-media-list {
li + li {
padding-top: 5px;
}
}
/**
* Tables
*/
table {
margin-bottom: $spacing-unit;
width: 100%;
text-align: $table-text-align;
color: lighten($text-color, 18%);
border-collapse: collapse;
border: 1px solid $grey-color-light;
tr {
&:nth-child(even) {
background-color: lighten($grey-color-light, 6%);
}
}
th, td {
padding: ($spacing-unit * 0.3333333333) ($spacing-unit * 0.5);
}
th {
background-color: lighten($grey-color-light, 3%);
border: 1px solid darken($grey-color-light, 4%);
border-bottom-color: darken($grey-color-light, 12%);
}
td {
border: 1px solid $grey-color-light;
}
}

255
_sass/minima/_layout.scss Normal file
View File

@ -0,0 +1,255 @@
/**
* Site header
*/
.site-header {
border-top: 5px solid $grey-color-dark;
border-bottom: 1px solid $grey-color-light;
min-height: $spacing-unit * 1.865;
// Positioning context for the mobile navigation icon
position: relative;
}
.site-title {
@include relative-font-size(1.625);
font-weight: 300;
line-height: $base-line-height * $base-font-size * 2.25;
letter-spacing: -1px;
margin-bottom: 0;
float: left;
&,
&:visited {
color: $grey-color-dark;
}
}
.site-nav {
float: right;
line-height: $base-line-height * $base-font-size * 2.25;
.nav-trigger {
display: none;
}
.menu-icon {
display: none;
}
.page-link {
color: $text-color;
line-height: $base-line-height;
// Gaps between nav items, but not on the last one
&:not(:last-child) {
margin-right: 20px;
}
}
@include media-query($on-palm) {
position: absolute;
top: 9px;
right: $spacing-unit * 0.5;
background-color: $background-color;
border: 1px solid $grey-color-light;
border-radius: 5px;
text-align: right;
label[for="nav-trigger"] {
display: block;
float: right;
width: 36px;
height: 36px;
z-index: 2;
cursor: pointer;
}
.menu-icon {
display: block;
float: right;
width: 36px;
height: 26px;
line-height: 0;
padding-top: 10px;
text-align: center;
> svg {
fill: $grey-color-dark;
}
}
input ~ .trigger {
clear: both;
display: none;
}
input:checked ~ .trigger {
display: block;
padding-bottom: 5px;
}
.page-link {
display: block;
margin-left: 20px;
padding: 5px 10px;
&:not(:last-child) {
margin-right: 0;
}
}
}
}
/**
* Site footer
*/
.site-footer {
border-top: 1px solid $grey-color-light;
padding: $spacing-unit 0;
}
.footer-heading {
@include relative-font-size(1.125);
margin-bottom: $spacing-unit * 0.5;
}
.contact-list,
.social-media-list {
list-style: none;
margin-left: 0;
}
.footer-col-wrapper {
@include relative-font-size(0.9375);
color: $grey-color;
margin-left: -$spacing-unit * 0.5;
@extend %clearfix;
}
.footer-col {
float: left;
margin-bottom: $spacing-unit * 0.5;
padding-left: $spacing-unit * 0.5;
}
.footer-col-1 {
width: -webkit-calc(35% - (#{$spacing-unit} / 2));
width: calc(35% - (#{$spacing-unit} / 2));
}
.footer-col-2 {
width: -webkit-calc(20% - (#{$spacing-unit} / 2));
width: calc(20% - (#{$spacing-unit} / 2));
}
.footer-col-3 {
width: -webkit-calc(45% - (#{$spacing-unit} / 2));
width: calc(45% - (#{$spacing-unit} / 2));
}
@include media-query($on-laptop) {
.footer-col-1,
.footer-col-2 {
width: -webkit-calc(50% - (#{$spacing-unit} / 2));
width: calc(50% - (#{$spacing-unit} / 2));
}
.footer-col-3 {
width: -webkit-calc(100% - (#{$spacing-unit} / 2));
width: calc(100% - (#{$spacing-unit} / 2));
}
}
@include media-query($on-palm) {
.footer-col {
float: none;
width: -webkit-calc(100% - (#{$spacing-unit} / 2));
width: calc(100% - (#{$spacing-unit} / 2));
}
}
/**
* Page content
*/
.page-content {
padding: $spacing-unit 0;
flex: 1;
}
.page-heading {
@include relative-font-size(2);
}
.post-list-heading {
@include relative-font-size(1.75);
}
.post-list {
margin-left: 0;
list-style: none;
> li {
margin-bottom: $spacing-unit;
}
}
.post-meta {
font-size: $small-font-size;
color: $grey-color;
}
.post-link {
display: block;
@include relative-font-size(1.5);
}
/**
* Posts
*/
.post-header {
margin-bottom: $spacing-unit;
}
.post-title {
@include relative-font-size(2.625);
letter-spacing: -1px;
line-height: 1;
@include media-query($on-laptop) {
@include relative-font-size(2.25);
}
}
.post-content {
margin-bottom: $spacing-unit;
h2 {
@include relative-font-size(2);
@include media-query($on-laptop) {
@include relative-font-size(1.75);
}
}
h3 {
@include relative-font-size(1.625);
@include media-query($on-laptop) {
@include relative-font-size(1.375);
}
}
h4 {
@include relative-font-size(1.25);
@include media-query($on-laptop) {
@include relative-font-size(1.125);
}
}
}

View File

@ -0,0 +1,71 @@
/**
* Syntax highlighting styles
*/
.highlight {
background: #fff;
@extend %vertical-rhythm;
.highlighter-rouge & {
background: #eef;
}
.c { color: #998; font-style: italic } // Comment
.err { color: #a61717; background-color: #e3d2d2 } // Error
.k { font-weight: bold } // Keyword
.o { font-weight: bold } // Operator
.cm { color: #998; font-style: italic } // Comment.Multiline
.cp { color: #999; font-weight: bold } // Comment.Preproc
.c1 { color: #998; font-style: italic } // Comment.Single
.cs { color: #999; font-weight: bold; font-style: italic } // Comment.Special
.gd { color: #000; background-color: #fdd } // Generic.Deleted
.gd .x { color: #000; background-color: #faa } // Generic.Deleted.Specific
.ge { font-style: italic } // Generic.Emph
.gr { color: #a00 } // Generic.Error
.gh { color: #999 } // Generic.Heading
.gi { color: #000; background-color: #dfd } // Generic.Inserted
.gi .x { color: #000; background-color: #afa } // Generic.Inserted.Specific
.go { color: #888 } // Generic.Output
.gp { color: #555 } // Generic.Prompt
.gs { font-weight: bold } // Generic.Strong
.gu { color: #aaa } // Generic.Subheading
.gt { color: #a00 } // Generic.Traceback
.kc { font-weight: bold } // Keyword.Constant
.kd { font-weight: bold } // Keyword.Declaration
.kp { font-weight: bold } // Keyword.Pseudo
.kr { font-weight: bold } // Keyword.Reserved
.kt { color: #458; font-weight: bold } // Keyword.Type
.m { color: #099 } // Literal.Number
.s { color: #d14 } // Literal.String
.na { color: #008080 } // Name.Attribute
.nb { color: #0086B3 } // Name.Builtin
.nc { color: #458; font-weight: bold } // Name.Class
.no { color: #008080 } // Name.Constant
.ni { color: #800080 } // Name.Entity
.ne { color: #900; font-weight: bold } // Name.Exception
.nf { color: #900; font-weight: bold } // Name.Function
.nn { color: #555 } // Name.Namespace
.nt { color: #000080 } // Name.Tag
.nv { color: #008080 } // Name.Variable
.ow { font-weight: bold } // Operator.Word
.w { color: #bbb } // Text.Whitespace
.mf { color: #099 } // Literal.Number.Float
.mh { color: #099 } // Literal.Number.Hex
.mi { color: #099 } // Literal.Number.Integer
.mo { color: #099 } // Literal.Number.Oct
.sb { color: #d14 } // Literal.String.Backtick
.sc { color: #d14 } // Literal.String.Char
.sd { color: #d14 } // Literal.String.Doc
.s2 { color: #d14 } // Literal.String.Double
.se { color: #d14 } // Literal.String.Escape
.sh { color: #d14 } // Literal.String.Heredoc
.si { color: #d14 } // Literal.String.Interpol
.sx { color: #d14 } // Literal.String.Other
.sr { color: #009926 } // Literal.String.Regex
.s1 { color: #d14 } // Literal.String.Single
.ss { color: #990073 } // Literal.String.Symbol
.bp { color: #999 } // Name.Builtin.Pseudo
.vc { color: #008080 } // Name.Variable.Class
.vg { color: #008080 } // Name.Variable.Global
.vi { color: #008080 } // Name.Variable.Instance
.il { color: #099 } // Literal.Number.Integer.Long
}

8
about.md Normal file
View File

@ -0,0 +1,8 @@
---
layout: page
title: Sobre
permalink: /sobre.html
---
Este site foi feito com [jekyllrb.com](https://jekyllrb.com/)

18
codes.md Normal file
View File

@ -0,0 +1,18 @@
---
# Feel free to add content and custom Front Matter to this file.
# To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults
title: Codes
layout: home
permalink: /codes.html
---
Códigos disponíveis em nosso site:
{% for code in site.examples %}
<h2>
<a href="{{ code.url }}">
{{ code.name }}
</a>
</h2>
{% endfor %}

1
examples Symbolic link
View File

@ -0,0 +1 @@
_examples

10
index.md Normal file
View File

@ -0,0 +1,10 @@
---
# Feel free to add content and custom Front Matter to this file.
# To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults
layout: home
---
Seja bem vindo ao site de exemplos do Livro Computação Musical, uma gentil introdução.